diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-03 06:27:58 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-09-10 21:47:04 +0200 |
commit | 9dd2fcd32f488ea89c2227cc56069446147376e8 (patch) | |
tree | 30ea4e772c5c64cdf8120ad960b0910f622a92bf /fs/nfs/pnfs_dev.c | |
parent | pnfs: factor GETDEVICEINFO implementations (diff) | |
download | linux-9dd2fcd32f488ea89c2227cc56069446147376e8.tar.xz linux-9dd2fcd32f488ea89c2227cc56069446147376e8.zip |
pnfs: add a common GETDEVICELIST implementation
At a simple helper to issue a GETDEVICELIST operation and pre-load
the device id cache based on the result.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs_dev.c')
-rw-r--r-- | fs/nfs/pnfs_dev.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index 791f8b3c4cff..82c2836fdb38 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c @@ -359,3 +359,32 @@ nfs4_deviceid_mark_client_invalid(struct nfs_client *clp) rcu_read_unlock(); } +int +nfs4_deviceid_getdevicelist(struct nfs_server *server, + const struct nfs_fh *fh) +{ + struct pnfs_devicelist *dlist; + struct nfs4_deviceid_node *d; + int error = 0, i; + + dlist = kzalloc(sizeof(struct pnfs_devicelist), GFP_NOFS); + if (!dlist) + return -ENOMEM; + + while (!dlist->eof) { + error = nfs4_proc_getdevicelist(server, fh, dlist); + if (error) + break; + + for (i = 0; i < dlist->num_devs; i++) { + d = nfs4_find_get_deviceid(server, &dlist->dev_id[i], + NULL, GFP_NOFS); + if (d) + nfs4_put_deviceid_node(d); + } + } + + kfree(dlist); + return error; +} +EXPORT_SYMBOL_GPL(nfs4_deviceid_getdevicelist); |