NFSv4.1: Get rid of pNFS layout state "NFS_LAYOUT_INVALID"
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 20 Sep 2012 19:07:45 +0000 (15:07 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 28 Sep 2012 20:03:12 +0000 (16:03 -0400)
In all cases where we set NFS_LAYOUT_INVALID, we also set NFS_LAYOUT_DESTROYED.
Furthermore, in all cases where we test for NFS_LAYOUT_INVALID, we should
also be testing for NFS_LAYOUT_DESTROYED, since the latter means that
we hold no valid layout segments.
Ergo the two are redundant.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4filelayout.c
fs/nfs/nfs4filelayout.h
fs/nfs/pnfs.h

index dac2162c3ac46230da2a33c87ebdc2a7816177a6..6cce57e7fe55cda70f27f056d3bf570c42998c55 100644 (file)
@@ -190,8 +190,6 @@ static int filelayout_async_handle_error(struct rpc_task *task,
                 * i/o and all i/o waiting on the slot table to the MDS until
                 * layout is destroyed and a new valid layout is obtained.
                 */
-               set_bit(NFS_LAYOUT_INVALID,
-                               &NFS_I(inode)->layout->plh_flags);
                pnfs_destroy_layout(NFS_I(inode));
                rpc_wake_up(&tbl->slot_tbl_waitq);
                goto reset;
@@ -281,7 +279,7 @@ filelayout_reset_to_mds(struct pnfs_layout_segment *lseg)
 {
        struct nfs4_deviceid_node *node = FILELAYOUT_DEVID_NODE(lseg);
 
-       return filelayout_test_layout_invalid(lseg->pls_layout) ||
+       return pnfs_test_layout_destroyed(lseg->pls_layout) ||
                filelayout_test_devid_unavailable(node);
 }
 
index 10b0f134400bd009762dd2e8ec60f3ed7eeddb47..dca47d78671026810c67b139763cd1b27548d42d 100644 (file)
@@ -128,12 +128,6 @@ filelayout_mark_devid_invalid(struct nfs4_deviceid_node *node)
        set_bit(NFS_DEVICEID_INVALID, &node->flags);
 }
 
-static inline bool
-filelayout_test_layout_invalid(struct pnfs_layout_hdr *lo)
-{
-       return test_bit(NFS_LAYOUT_INVALID, &lo->plh_flags);
-}
-
 static inline bool
 filelayout_test_devid_invalid(struct nfs4_deviceid_node *node)
 {
index aa9fa1b1ff4af145e5bdc16ca5809217dda0cb75..aacda7fbb536d5981658c9e672dca1b19893785c 100644 (file)
@@ -63,7 +63,6 @@ enum {
        NFS_LAYOUT_BULK_RECALL,         /* bulk recall affecting layout */
        NFS_LAYOUT_ROC,                 /* some lseg had roc bit set */
        NFS_LAYOUT_DESTROYED,           /* no new use of layout allowed */
-       NFS_LAYOUT_INVALID,             /* layout is being destroyed */
        NFS_LAYOUT_RETURNED,            /* layout has already been returned */
 };
 
@@ -279,6 +278,12 @@ pnfs_test_layout_returned(struct pnfs_layout_hdr *lo)
        return test_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags);
 }
 
+static inline bool
+pnfs_test_layout_destroyed(struct pnfs_layout_hdr *lo)
+{
+       return test_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
+}
+
 static inline struct pnfs_layout_segment *
 pnfs_get_lseg(struct pnfs_layout_segment *lseg)
 {