NFS: Fix a write performance regression
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 1 Oct 2015 22:38:27 +0000 (18:38 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 2 Oct 2015 19:43:07 +0000 (15:43 -0400)
If all other conditions in nfs_can_extend_write() are met, and there
are no locks, then we should be able to assume close-to-open semantics
and the ability to extend our write to cover the whole page.

With this patch, the xfstests generic/074 test completes in 242s instead
of >1400s on my test rig.

Fixes: bd61e0a9c852 ("locks: convert posix locks to file_lock_context")
Cc: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/write.c

index cfa47761a8cea26eb6b1583eafefb1a55902f348..75ab7622e0cc193bab28f2ba5bb56d37e5f49465 100644 (file)
@@ -1223,7 +1223,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page, struct ino
                return 1;
        if (!flctx || (list_empty_careful(&flctx->flc_flock) &&
                       list_empty_careful(&flctx->flc_posix)))
-               return 0;
+               return 1;
 
        /* Check to see if there are whole file write locks */
        ret = 0;