diff options
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index d47c188682b1..6279cff7df74 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "iostat.h" | 35 | #include "iostat.h" |
36 | #include "nfs4trace.h" | 36 | #include "nfs4trace.h" |
37 | #include "delegation.h" | 37 | #include "delegation.h" |
38 | #include "nfs42.h" | ||
38 | 39 | ||
39 | #define NFSDBG_FACILITY NFSDBG_PNFS | 40 | #define NFSDBG_FACILITY NFSDBG_PNFS |
40 | #define PNFS_LAYOUTGET_RETRY_TIMEOUT (120*HZ) | 41 | #define PNFS_LAYOUTGET_RETRY_TIMEOUT (120*HZ) |
@@ -2250,3 +2251,51 @@ struct nfs4_threshold *pnfs_mdsthreshold_alloc(void) | |||
2250 | } | 2251 | } |
2251 | return thp; | 2252 | return thp; |
2252 | } | 2253 | } |
2254 | |||
2255 | int | ||
2256 | pnfs_report_layoutstat(struct inode *inode) | ||
2257 | { | ||
2258 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | ||
2259 | struct nfs_server *server = NFS_SERVER(inode); | ||
2260 | struct nfs42_layoutstat_data *data; | ||
2261 | struct pnfs_layout_hdr *hdr; | ||
2262 | int status = 0; | ||
2263 | |||
2264 | if (!pnfs_enabled_sb(server) || !ld->prepare_layoutstats) | ||
2265 | goto out; | ||
2266 | |||
2267 | spin_lock(&inode->i_lock); | ||
2268 | if (!NFS_I(inode)->layout) { | ||
2269 | spin_unlock(&inode->i_lock); | ||
2270 | goto out; | ||
2271 | } | ||
2272 | hdr = NFS_I(inode)->layout; | ||
2273 | pnfs_get_layout_hdr(hdr); | ||
2274 | spin_unlock(&inode->i_lock); | ||
2275 | |||
2276 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
2277 | if (!data) { | ||
2278 | status = -ENOMEM; | ||
2279 | goto out_put; | ||
2280 | } | ||
2281 | |||
2282 | data->args.fh = NFS_FH(inode); | ||
2283 | data->args.inode = inode; | ||
2284 | nfs4_stateid_copy(&data->args.stateid, &hdr->plh_stateid); | ||
2285 | status = ld->prepare_layoutstats(&data->args); | ||
2286 | if (status) | ||
2287 | goto out_free; | ||
2288 | |||
2289 | status = nfs42_proc_layoutstats_generic(NFS_SERVER(inode), data); | ||
2290 | |||
2291 | out: | ||
2292 | dprintk("%s returns %d\n", __func__, status); | ||
2293 | return status; | ||
2294 | |||
2295 | out_free: | ||
2296 | kfree(data); | ||
2297 | out_put: | ||
2298 | pnfs_put_layout_hdr(hdr); | ||
2299 | goto out; | ||
2300 | } | ||
2301 | EXPORT_SYMBOL_GPL(pnfs_report_layoutstat); | ||