Commit c21e7168848d4ff4158120dbd4464f0d5cfb1456

Authored by Trond Myklebust
1 parent d7242c4641

NFSv4/pnfs: Support a list of commit arrays in struct pnfs_ds_commit_info

When we have multiple layout segments with different lists of mirrored
data, we need to track the commits on a per layout segment basis.
This patch adds a list to support this tracking in struct
pnfs_ds_commit_info.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

Showing 5 changed files with 18 additions and 1 deletions Side-by-side Diff

... ... @@ -305,6 +305,7 @@
305 305 kref_get(&dreq->kref);
306 306 init_completion(&dreq->completion);
307 307 INIT_LIST_HEAD(&dreq->mds_cinfo.list);
  308 + pnfs_init_ds_commit_info(&dreq->ds_cinfo);
308 309 dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */
309 310 INIT_WORK(&dreq->work, nfs_direct_write_schedule_work);
310 311 spin_lock_init(&dreq->lock);
fs/nfs/filelayout/filelayout.c
... ... @@ -1140,7 +1140,10 @@
1140 1140 struct nfs4_filelayout *flo;
1141 1141  
1142 1142 flo = kzalloc(sizeof(*flo), gfp_flags);
1143   - return flo != NULL ? &flo->generic_hdr : NULL;
  1143 + if (flo == NULL)
  1144 + return NULL;
  1145 + pnfs_init_ds_commit_info(&flo->commit_info);
  1146 + return &flo->generic_hdr;
1144 1147 }
1145 1148  
1146 1149 static void
fs/nfs/flexfilelayout/flexfilelayout.c
... ... @@ -48,6 +48,7 @@
48 48  
49 49 ffl = kzalloc(sizeof(*ffl), gfp_flags);
50 50 if (ffl) {
  51 + pnfs_init_ds_commit_info(&ffl->commit_info);
51 52 INIT_LIST_HEAD(&ffl->error_list);
52 53 INIT_LIST_HEAD(&ffl->mirrors);
53 54 ffl->last_report_time = ktime_get();
... ... @@ -463,6 +463,12 @@
463 463 }
464 464  
465 465 static inline void
  466 +pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
  467 +{
  468 + INIT_LIST_HEAD(&fl_cinfo->commits);
  469 +}
  470 +
  471 +static inline void
466 472 pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
467 473 {
468 474 set_bit(NFS_DEVICEID_INVALID, &node->flags);
... ... @@ -757,6 +763,11 @@
757 763 pnfs_get_ds_info(struct inode *inode)
758 764 {
759 765 return NULL;
  766 +}
  767 +
  768 +static inline void
  769 +pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
  770 +{
760 771 }
761 772  
762 773 static inline bool
include/linux/nfs_xdr.h
... ... @@ -1280,6 +1280,7 @@
1280 1280 };
1281 1281  
1282 1282 struct pnfs_ds_commit_info {
  1283 + struct list_head commits;
1283 1284 unsigned int nwritten;
1284 1285 unsigned int ncommitting;
1285 1286 unsigned int nbuckets;