Commit c21e7168 authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent d7242c46
...@@ -305,6 +305,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) ...@@ -305,6 +305,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void)
kref_get(&dreq->kref); kref_get(&dreq->kref);
init_completion(&dreq->completion); init_completion(&dreq->completion);
INIT_LIST_HEAD(&dreq->mds_cinfo.list); INIT_LIST_HEAD(&dreq->mds_cinfo.list);
pnfs_init_ds_commit_info(&dreq->ds_cinfo);
dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */ dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */
INIT_WORK(&dreq->work, nfs_direct_write_schedule_work); INIT_WORK(&dreq->work, nfs_direct_write_schedule_work);
spin_lock_init(&dreq->lock); spin_lock_init(&dreq->lock);
......
...@@ -1140,7 +1140,10 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags) ...@@ -1140,7 +1140,10 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
struct nfs4_filelayout *flo; struct nfs4_filelayout *flo;
flo = kzalloc(sizeof(*flo), gfp_flags); flo = kzalloc(sizeof(*flo), gfp_flags);
return flo != NULL ? &flo->generic_hdr : NULL; if (flo == NULL)
return NULL;
pnfs_init_ds_commit_info(&flo->commit_info);
return &flo->generic_hdr;
} }
static void static void
......
...@@ -48,6 +48,7 @@ ff_layout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags) ...@@ -48,6 +48,7 @@ ff_layout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
ffl = kzalloc(sizeof(*ffl), gfp_flags); ffl = kzalloc(sizeof(*ffl), gfp_flags);
if (ffl) { if (ffl) {
pnfs_init_ds_commit_info(&ffl->commit_info);
INIT_LIST_HEAD(&ffl->error_list); INIT_LIST_HEAD(&ffl->error_list);
INIT_LIST_HEAD(&ffl->mirrors); INIT_LIST_HEAD(&ffl->mirrors);
ffl->last_report_time = ktime_get(); ffl->last_report_time = ktime_get();
......
...@@ -462,6 +462,12 @@ pnfs_get_ds_info(struct inode *inode) ...@@ -462,6 +462,12 @@ pnfs_get_ds_info(struct inode *inode)
return ld->get_ds_info(inode); return ld->get_ds_info(inode);
} }
static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
{
INIT_LIST_HEAD(&fl_cinfo->commits);
}
static inline void static inline void
pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node) pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
{ {
...@@ -759,6 +765,11 @@ pnfs_get_ds_info(struct inode *inode) ...@@ -759,6 +765,11 @@ pnfs_get_ds_info(struct inode *inode)
return NULL; return NULL;
} }
static inline void
pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
{
}
static inline bool static inline bool
pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
struct nfs_commit_info *cinfo, u32 ds_commit_idx) struct nfs_commit_info *cinfo, u32 ds_commit_idx)
......
...@@ -1280,6 +1280,7 @@ struct pnfs_commit_array { ...@@ -1280,6 +1280,7 @@ struct pnfs_commit_array {
}; };
struct pnfs_ds_commit_info { struct pnfs_ds_commit_info {
struct list_head commits;
unsigned int nwritten; unsigned int nwritten;
unsigned int ncommitting; unsigned int ncommitting;
unsigned int nbuckets; unsigned int nbuckets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment