pNFS: Add a helper to allocate the array of buckets
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
@@ -87,6 +87,37 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_generic_clear_request_commit);
|
||||
|
||||
struct pnfs_commit_array *
|
||||
pnfs_alloc_commit_array(size_t n, gfp_t gfp_flags)
|
||||
{
|
||||
struct pnfs_commit_array *p;
|
||||
struct pnfs_commit_bucket *b;
|
||||
|
||||
p = kmalloc(struct_size(p, buckets, n), gfp_flags);
|
||||
if (!p)
|
||||
return NULL;
|
||||
p->nbuckets = n;
|
||||
INIT_LIST_HEAD(&p->cinfo_list);
|
||||
INIT_LIST_HEAD(&p->lseg_list);
|
||||
p->lseg = NULL;
|
||||
for (b = &p->buckets[0]; n != 0; b++, n--) {
|
||||
INIT_LIST_HEAD(&b->written);
|
||||
INIT_LIST_HEAD(&b->committing);
|
||||
b->wlseg = NULL;
|
||||
b->clseg = NULL;
|
||||
b->direct_verf.committed = NFS_INVALID_STABLE_HOW;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_alloc_commit_array);
|
||||
|
||||
void
|
||||
pnfs_free_commit_array(struct pnfs_commit_array *p)
|
||||
{
|
||||
kfree_rcu(p, rcu);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_free_commit_array);
|
||||
|
||||
static int
|
||||
pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
|
||||
struct nfs_commit_info *cinfo,
|
||||
|
Reference in New Issue
Block a user