Skip to contentSkip to conversation

NFS: Fix a write performance regression

PATCH In review Trond Myklebust 2 participants 2 messages Oct 1, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Fix a write performance regression

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 232s instead of >1400s on my test rig.

Fixes bd61e0a9c852 ("locks: convert posix locks to file_lock_context")
Cc Jeff Layton <[email protected]>
---
 fs/nfs/write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +1 -1
index 72624dc4a623..1d6f6b43b7f4 100644
@@ -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;
Signature · 1 line
2.4.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · On Thu, 1 Oct 2015 19:12:26 -0400 Trond Myklebust…

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 232s instead of >1400s on my test rig.

Fixes bd61e0a9c852 ("locks: convert posix locks to file_lock_context")
Cc Jeff Layton <[email protected]>
---
 fs/nfs/write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +0 -0
index 72624dc4a623..1d6f6b43b7f4 100644

fs/nfs/write.c static int nfs_can_extend_write(struct file *file, struct page *page, struct ino · line 1229

Quoted 8 lines
fs/nfs/write.c +1 -1
@@ -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;

Ouch -- mea culpa. Actually broken originally in 5263e31e452fb84138b9bee061d5c06c0f359fea, I think...

In any case: