Skip to content

Commit bc28e1c

Browse files
committed
pNFS/flexfiles: Clean up calls to pnfs_set_layoutcommit()
Let's just have one place where we check ff_layout_need_layoutcommit(). Signed-off-by: Trond Myklebust <[email protected]>
1 parent c001c87 commit bc28e1c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,15 +1325,16 @@ ff_layout_need_layoutcommit(struct pnfs_layout_segment *lseg)
13251325
* we always send layoutcommit after DS writes.
13261326
*/
13271327
static void
1328-
ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr)
1328+
ff_layout_set_layoutcommit(struct inode *inode,
1329+
struct pnfs_layout_segment *lseg,
1330+
loff_t end_offset)
13291331
{
1330-
if (!ff_layout_need_layoutcommit(hdr->lseg))
1332+
if (!ff_layout_need_layoutcommit(lseg))
13311333
return;
13321334

1333-
pnfs_set_layoutcommit(hdr->inode, hdr->lseg,
1334-
hdr->mds_offset + hdr->res.count);
1335-
dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino,
1336-
(unsigned long) NFS_I(hdr->inode)->layout->plh_lwb);
1335+
pnfs_set_layoutcommit(inode, lseg, end_offset);
1336+
dprintk("%s inode %lu pls_end_pos %llu\n", __func__, inode->i_ino,
1337+
(unsigned long long) NFS_I(inode)->layout->plh_lwb);
13371338
}
13381339

13391340
static bool
@@ -1494,7 +1495,8 @@ static int ff_layout_write_done_cb(struct rpc_task *task,
14941495

14951496
if (hdr->res.verf->committed == NFS_FILE_SYNC ||
14961497
hdr->res.verf->committed == NFS_DATA_SYNC)
1497-
ff_layout_set_layoutcommit(hdr);
1498+
ff_layout_set_layoutcommit(hdr->inode, hdr->lseg,
1499+
hdr->mds_offset + (loff_t)hdr->res.count);
14981500

14991501
/* zero out fattr since we don't care DS attr at all */
15001502
hdr->fattr.valid = 0;
@@ -1530,8 +1532,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,
15301532
return -EAGAIN;
15311533
}
15321534

1533-
if (ff_layout_need_layoutcommit(data->lseg))
1534-
pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb);
1535+
ff_layout_set_layoutcommit(data->inode, data->lseg, data->lwb);
15351536

15361537
return 0;
15371538
}

0 commit comments

Comments
 (0)