Commit a8e3765e authored by Trond Myklebust's avatar Trond Myklebust

NFSv4/pNFS: Scan the full list of commit arrays when committing

Add support for scanning the full list of per-layout segment commit
arrays to pnfs_generic_scan_commit_lists()
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent c21e7168
...@@ -118,10 +118,14 @@ pnfs_free_commit_array(struct pnfs_commit_array *p) ...@@ -118,10 +118,14 @@ pnfs_free_commit_array(struct pnfs_commit_array *p)
} }
EXPORT_SYMBOL_GPL(pnfs_free_commit_array); EXPORT_SYMBOL_GPL(pnfs_free_commit_array);
/*
* Locks the nfs_page requests for commit and moves them to
* @bucket->committing.
*/
static int static int
pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, pnfs_bucket_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
struct nfs_commit_info *cinfo, struct nfs_commit_info *cinfo,
int max) int max)
{ {
struct list_head *src = &bucket->written; struct list_head *src = &bucket->written;
struct list_head *dst = &bucket->committing; struct list_head *dst = &bucket->committing;
...@@ -142,20 +146,44 @@ pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, ...@@ -142,20 +146,44 @@ pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
return ret; return ret;
} }
static int pnfs_bucket_scan_array(struct nfs_commit_info *cinfo,
struct pnfs_commit_bucket *buckets,
unsigned int nbuckets,
int max)
{
unsigned int i;
int rv = 0, cnt;
for (i = 0; i < nbuckets && max != 0; i++) {
cnt = pnfs_bucket_scan_ds_commit_list(&buckets[i], cinfo, max);
rv += cnt;
max -= cnt;
}
return rv;
}
/* Move reqs from written to committing lists, returning count /* Move reqs from written to committing lists, returning count
* of number moved. * of number moved.
*/ */
int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max)
int max)
{ {
int i, rv = 0, cnt; struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
struct pnfs_commit_array *array;
lockdep_assert_held(&NFS_I(cinfo->inode)->commit_mutex); int rv = 0, cnt;
for (i = 0; i < cinfo->ds->nbuckets && max != 0; i++) {
cnt = pnfs_generic_scan_ds_commit_list(&cinfo->ds->buckets[i], cnt = pnfs_bucket_scan_array(cinfo, fl_cinfo->buckets,
cinfo, max); fl_cinfo->nbuckets, max);
max -= cnt; rv += cnt;
max -= cnt;
if (!max)
return rv;
list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) {
cnt = pnfs_bucket_scan_array(cinfo, array->buckets,
array->nbuckets, max);
rv += cnt; rv += cnt;
max -= cnt;
if (!max)
break;
} }
return rv; return rv;
} }
......
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