aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-21 14:48:04 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:16 -0400
commit8006bfba36d42b6976ed92979f51e5f9bef2625c (patch)
tree83b5c3761408b6cbfef4112431ef466b5392f909 /fs/nfs
parent579342785f7069d32e9637ef30d59c4256dcec3d (diff)
NFSv4.1: Get rid of the NFS_LAYOUT_DESTROYED state
We already have a mechanism for blocking LAYOUTGET by means of the plh_block_lgets counter. The only "service" that NFS_LAYOUT_DESTROYED provides at this point is to block layoutget once the layout segment list is empty, which basically means that you have to wait until the pnfs_layout_hdr is destroyed before you can do pNFS on that file again. This patch enables the reuse of the pnfs_layout_hdr if the layout segment list is empty. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4filelayout.c3
-rw-r--r--fs/nfs/pnfs.c9
-rw-r--r--fs/nfs/pnfs.h7
3 files changed, 2 insertions, 17 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 6cce57e7fe55..52d847212066 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -279,8 +279,7 @@ filelayout_reset_to_mds(struct pnfs_layout_segment *lseg)
279{ 279{
280 struct nfs4_deviceid_node *node = FILELAYOUT_DEVID_NODE(lseg); 280 struct nfs4_deviceid_node *node = FILELAYOUT_DEVID_NODE(lseg);
281 281
282 return pnfs_test_layout_destroyed(lseg->pls_layout) || 282 return filelayout_test_devid_unavailable(node);
283 filelayout_test_devid_unavailable(node);
284} 283}
285 284
286/* 285/*
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index fcc72ecf2fd7..bda88a275071 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -331,8 +331,6 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
331 list_del_init(&lseg->pls_list); 331 list_del_init(&lseg->pls_list);
332 /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ 332 /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
333 atomic_dec(&lo->plh_refcount); 333 atomic_dec(&lo->plh_refcount);
334 if (list_empty(&lo->plh_segs))
335 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
336 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); 334 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
337} 335}
338 336
@@ -463,10 +461,8 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
463 461
464 dprintk("%s:Begin lo %p\n", __func__, lo); 462 dprintk("%s:Begin lo %p\n", __func__, lo);
465 463
466 if (list_empty(&lo->plh_segs)) { 464 if (list_empty(&lo->plh_segs))
467 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
468 return 0; 465 return 0;
469 }
470 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) 466 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
471 if (!recall_range || 467 if (!recall_range ||
472 should_free_lseg(&lseg->pls_range, recall_range)) { 468 should_free_lseg(&lseg->pls_range, recall_range)) {
@@ -590,7 +586,6 @@ pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid,
590 (int)(lo->plh_barrier - be32_to_cpu(stateid->seqid)) >= 0) 586 (int)(lo->plh_barrier - be32_to_cpu(stateid->seqid)) >= 0)
591 return true; 587 return true;
592 return lo->plh_block_lgets || 588 return lo->plh_block_lgets ||
593 test_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags) ||
594 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || 589 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
595 (list_empty(&lo->plh_segs) && 590 (list_empty(&lo->plh_segs) &&
596 (atomic_read(&lo->plh_outstanding) > lget)); 591 (atomic_read(&lo->plh_outstanding) > lget));
@@ -912,8 +907,6 @@ pnfs_find_alloc_layout(struct inode *ino,
912 dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout); 907 dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout);
913 908
914 if (nfsi->layout) { 909 if (nfsi->layout) {
915 if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags))
916 return NULL;
917 pnfs_get_layout_hdr(nfsi->layout); 910 pnfs_get_layout_hdr(nfsi->layout);
918 return nfsi->layout; 911 return nfsi->layout;
919 } 912 }
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index aacda7fbb536..92f6ce6532ba 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -62,7 +62,6 @@ enum {
62 NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ 62 NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */
63 NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ 63 NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */
64 NFS_LAYOUT_ROC, /* some lseg had roc bit set */ 64 NFS_LAYOUT_ROC, /* some lseg had roc bit set */
65 NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */
66 NFS_LAYOUT_RETURNED, /* layout has already been returned */ 65 NFS_LAYOUT_RETURNED, /* layout has already been returned */
67}; 66};
68 67
@@ -278,12 +277,6 @@ pnfs_test_layout_returned(struct pnfs_layout_hdr *lo)
278 return test_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags); 277 return test_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags);
279} 278}
280 279
281static inline bool
282pnfs_test_layout_destroyed(struct pnfs_layout_hdr *lo)
283{
284 return test_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
285}
286
287static inline struct pnfs_layout_segment * 280static inline struct pnfs_layout_segment *
288pnfs_get_lseg(struct pnfs_layout_segment *lseg) 281pnfs_get_lseg(struct pnfs_layout_segment *lseg)
289{ 282{