diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-02-28 20:34:21 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-11 15:38:43 -0500 |
commit | ea8eecdd11ee6becd09c095c8efa88aa7df95961 (patch) | |
tree | 4db9c584989d006790637e255657a010c8243cb9 /fs/nfs/nfs4filelayout.c | |
parent | cbdabc7f8bf14ca1d40ab1cb86f64b3bc09716e8 (diff) |
NFSv4.1 move deviceid cache to filelayout driver
No need for generic cache with only one user.
Keep a simple hash of deviceids in the filelayout driver.
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Acked-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 6a424c19abea..a922e75af42e 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -42,32 +42,6 @@ MODULE_DESCRIPTION("The NFSv4 file layout driver"); | |||
42 | 42 | ||
43 | #define FILELAYOUT_POLL_RETRY_MAX (15*HZ) | 43 | #define FILELAYOUT_POLL_RETRY_MAX (15*HZ) |
44 | 44 | ||
45 | static int | ||
46 | filelayout_set_layoutdriver(struct nfs_server *nfss) | ||
47 | { | ||
48 | int status = pnfs_alloc_init_deviceid_cache(nfss->nfs_client, | ||
49 | nfs4_fl_free_deviceid_callback); | ||
50 | if (status) { | ||
51 | printk(KERN_WARNING "%s: deviceid cache could not be " | ||
52 | "initialized\n", __func__); | ||
53 | return status; | ||
54 | } | ||
55 | dprintk("%s: deviceid cache has been initialized successfully\n", | ||
56 | __func__); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | /* Clear out the layout by destroying its device list */ | ||
61 | static int | ||
62 | filelayout_clear_layoutdriver(struct nfs_server *nfss) | ||
63 | { | ||
64 | dprintk("--> %s\n", __func__); | ||
65 | |||
66 | if (nfss->nfs_client->cl_devid_cache) | ||
67 | pnfs_put_deviceid_cache(nfss->nfs_client); | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static loff_t | 45 | static loff_t |
72 | filelayout_get_dense_offset(struct nfs4_filelayout_segment *flseg, | 46 | filelayout_get_dense_offset(struct nfs4_filelayout_segment *flseg, |
73 | loff_t offset) | 47 | loff_t offset) |
@@ -295,7 +269,7 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo, | |||
295 | } | 269 | } |
296 | 270 | ||
297 | /* find and reference the deviceid */ | 271 | /* find and reference the deviceid */ |
298 | dsaddr = nfs4_fl_find_get_deviceid(nfss->nfs_client, id); | 272 | dsaddr = nfs4_fl_find_get_deviceid(id); |
299 | if (dsaddr == NULL) { | 273 | if (dsaddr == NULL) { |
300 | dsaddr = get_device_info(lo->plh_inode, id); | 274 | dsaddr = get_device_info(lo->plh_inode, id); |
301 | if (dsaddr == NULL) | 275 | if (dsaddr == NULL) |
@@ -330,7 +304,7 @@ out: | |||
330 | dprintk("--> %s returns %d\n", __func__, status); | 304 | dprintk("--> %s returns %d\n", __func__, status); |
331 | return status; | 305 | return status; |
332 | out_put: | 306 | out_put: |
333 | pnfs_put_deviceid(nfss->nfs_client->cl_devid_cache, &dsaddr->deviceid); | 307 | nfs4_fl_put_deviceid(dsaddr); |
334 | goto out; | 308 | goto out; |
335 | } | 309 | } |
336 | 310 | ||
@@ -439,12 +413,10 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid, | |||
439 | static void | 413 | static void |
440 | filelayout_free_lseg(struct pnfs_layout_segment *lseg) | 414 | filelayout_free_lseg(struct pnfs_layout_segment *lseg) |
441 | { | 415 | { |
442 | struct nfs_server *nfss = NFS_SERVER(lseg->pls_layout->plh_inode); | ||
443 | struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); | 416 | struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); |
444 | 417 | ||
445 | dprintk("--> %s\n", __func__); | 418 | dprintk("--> %s\n", __func__); |
446 | pnfs_put_deviceid(nfss->nfs_client->cl_devid_cache, | 419 | nfs4_fl_put_deviceid(fl->dsaddr); |
447 | &fl->dsaddr->deviceid); | ||
448 | _filelayout_free_lseg(fl); | 420 | _filelayout_free_lseg(fl); |
449 | } | 421 | } |
450 | 422 | ||
@@ -474,13 +446,11 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | |||
474 | } | 446 | } |
475 | 447 | ||
476 | static struct pnfs_layoutdriver_type filelayout_type = { | 448 | static struct pnfs_layoutdriver_type filelayout_type = { |
477 | .id = LAYOUT_NFSV4_1_FILES, | 449 | .id = LAYOUT_NFSV4_1_FILES, |
478 | .name = "LAYOUT_NFSV4_1_FILES", | 450 | .name = "LAYOUT_NFSV4_1_FILES", |
479 | .owner = THIS_MODULE, | 451 | .owner = THIS_MODULE, |
480 | .set_layoutdriver = filelayout_set_layoutdriver, | 452 | .alloc_lseg = filelayout_alloc_lseg, |
481 | .clear_layoutdriver = filelayout_clear_layoutdriver, | 453 | .free_lseg = filelayout_free_lseg, |
482 | .alloc_lseg = filelayout_alloc_lseg, | ||
483 | .free_lseg = filelayout_free_lseg, | ||
484 | .pg_test = filelayout_pg_test, | 454 | .pg_test = filelayout_pg_test, |
485 | .read_pagelist = filelayout_read_pagelist, | 455 | .read_pagelist = filelayout_read_pagelist, |
486 | }; | 456 | }; |