NFS: Remove nfs_page_group_clear_bits()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 19 Jul 2017 17:50:07 +0000 (13:50 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 15 Aug 2017 15:54:47 +0000 (11:54 -0400)
At this point, we only expect ever to potentially see PG_REMOVE and
PG_TEARDOWN being set on the subrequests.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/write.c

index ffb9934607ef819da802276924ef3c2b1ed778f0..20d44ea328b638363b6cfdcb1227296ed68b2e29 100644 (file)
@@ -347,22 +347,6 @@ static void nfs_end_page_writeback(struct nfs_page *req)
                clear_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC);
 }
 
-
-/* nfs_page_group_clear_bits
- *   @req - an nfs request
- * clears all page group related bits from @req
- */
-static void
-nfs_page_group_clear_bits(struct nfs_page *req)
-{
-       clear_bit(PG_TEARDOWN, &req->wb_flags);
-       clear_bit(PG_UNLOCKPAGE, &req->wb_flags);
-       clear_bit(PG_UPTODATE, &req->wb_flags);
-       clear_bit(PG_WB_END, &req->wb_flags);
-       clear_bit(PG_REMOVE, &req->wb_flags);
-}
-
-
 /*
  * nfs_unroll_locks_and_wait -  unlock all newly locked reqs and wait on @req
  *
@@ -417,13 +401,12 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list,
                /* make sure old group is not used */
                subreq->wb_this_page = subreq;
 
+               clear_bit(PG_REMOVE, &subreq->wb_flags);
+
                /* Note: races with nfs_page_group_destroy() */
                if (!kref_read(&subreq->wb_kref)) {
-                       bool freeme = test_bit(PG_TEARDOWN, &subreq->wb_flags);
-
-                       nfs_page_group_clear_bits(subreq);
                        /* Check if we raced with nfs_page_group_destroy() */
-                       if (freeme)
+                       if (test_and_clear_bit(PG_TEARDOWN, &subreq->wb_flags))
                                nfs_free_request(subreq);
                        continue;
                }
@@ -437,7 +420,6 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list,
                        spin_unlock(&inode->i_lock);
                }
 
-               nfs_page_group_clear_bits(subreq);
                /* subreq is now totally disconnected from page group or any
                 * write / commit lists. last chance to wake any waiters */
                nfs_unlock_and_release_request(subreq);
@@ -573,11 +555,6 @@ try_again:
                spin_unlock(&inode->i_lock);
        }
 
-       /*
-        * prepare head request to be added to new pgio descriptor
-        */
-       nfs_page_group_clear_bits(head);
-
        nfs_page_group_unlock(head);
 
        nfs_destroy_unlinked_subrequests(destroy_list, head, inode);