diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-03 00:27:57 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-09-10 15:47:03 -0400 |
commit | 661373b13d0490ff410a2133d4a7a117f2dd037e (patch) | |
tree | a2f515ecbc46316adfd1b937d62eeb9a48957d1c /fs/nfs/filelayout/filelayout.c | |
parent | 848746bd247cdc3ce1d103e92913316445763778 (diff) |
pnfs: factor GETDEVICEINFO implementations
Add support to the common pNFS core to issue GETDEVICEINFO calls on
a device ID cache miss. The code is taken from the well debugged
file layout implementation and calls out to the layoutdriver through
a new alloc_deviceid_node method. The calling conventions for
nfs4_find_get_deviceid are changed so that all information needed to
send a GETDEVICEINFO request is passed to the common code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/filelayout/filelayout.c')
-rw-r--r-- | fs/nfs/filelayout/filelayout.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 163cad1d4127..abc5056999d6 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
@@ -649,18 +649,15 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo, | |||
649 | } | 649 | } |
650 | 650 | ||
651 | /* find and reference the deviceid */ | 651 | /* find and reference the deviceid */ |
652 | d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode)->pnfs_curr_ld, | 652 | d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), id, |
653 | NFS_SERVER(lo->plh_inode)->nfs_client, id); | 653 | lo->plh_lc_cred, gfp_flags); |
654 | if (d == NULL) { | 654 | if (d == NULL) |
655 | dsaddr = filelayout_get_device_info(lo->plh_inode, id, | 655 | goto out; |
656 | lo->plh_lc_cred, gfp_flags); | 656 | |
657 | if (dsaddr == NULL) | 657 | dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node); |
658 | goto out; | ||
659 | } else | ||
660 | dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node); | ||
661 | /* Found deviceid is unavailable */ | 658 | /* Found deviceid is unavailable */ |
662 | if (filelayout_test_devid_unavailable(&dsaddr->id_node)) | 659 | if (filelayout_test_devid_unavailable(&dsaddr->id_node)) |
663 | goto out_put; | 660 | goto out_put; |
664 | 661 | ||
665 | fl->dsaddr = dsaddr; | 662 | fl->dsaddr = dsaddr; |
666 | 663 | ||
@@ -1371,6 +1368,17 @@ out: | |||
1371 | cinfo->ds->ncommitting = 0; | 1368 | cinfo->ds->ncommitting = 0; |
1372 | return PNFS_ATTEMPTED; | 1369 | return PNFS_ATTEMPTED; |
1373 | } | 1370 | } |
1371 | static struct nfs4_deviceid_node * | ||
1372 | filelayout_alloc_deviceid_node(struct nfs_server *server, | ||
1373 | struct pnfs_device *pdev, gfp_t gfp_flags) | ||
1374 | { | ||
1375 | struct nfs4_file_layout_dsaddr *dsaddr; | ||
1376 | |||
1377 | dsaddr = nfs4_fl_alloc_deviceid_node(server, pdev, gfp_flags); | ||
1378 | if (!dsaddr) | ||
1379 | return NULL; | ||
1380 | return &dsaddr->id_node; | ||
1381 | } | ||
1374 | 1382 | ||
1375 | static void | 1383 | static void |
1376 | filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d) | 1384 | filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d) |
@@ -1423,6 +1431,7 @@ static struct pnfs_layoutdriver_type filelayout_type = { | |||
1423 | .commit_pagelist = filelayout_commit_pagelist, | 1431 | .commit_pagelist = filelayout_commit_pagelist, |
1424 | .read_pagelist = filelayout_read_pagelist, | 1432 | .read_pagelist = filelayout_read_pagelist, |
1425 | .write_pagelist = filelayout_write_pagelist, | 1433 | .write_pagelist = filelayout_write_pagelist, |
1434 | .alloc_deviceid_node = filelayout_alloc_deviceid_node, | ||
1426 | .free_deviceid_node = filelayout_free_deveiceid_node, | 1435 | .free_deviceid_node = filelayout_free_deveiceid_node, |
1427 | }; | 1436 | }; |
1428 | 1437 | ||