Commit ac48c0dd authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] nfs: Optimize away unnecessary NFSv3 COMMIT calls.

Currently, when calling nfs_commit_file(), we check the range argument,
and only commit NFS write requests that fall within the given range.
This is silly, since all servers use fsync(), to honour a COMMIT call,
and so will sync all pending writes to stable storage.

The following patch ensures that if at least one NFS write falls within
the range specified by the call to nfs_commit_file(), then we commit all
outstanding writes on that file.

This fixes a sometimes severe inefficiency when combining reads and
writes: nfs_wb_page() is used to clear out writes prior to scheduling a
read(), and can end up calling COMMIT for each page to be read.
parent 2f4c9a2d
......@@ -1074,9 +1074,12 @@ int nfs_commit_file(struct inode *inode, struct file *file, unsigned long idx_st
spin_lock(&nfs_wreq_lock);
res = nfs_scan_commit(inode, &head, file, idx_start, npages);
spin_unlock(&nfs_wreq_lock);
if (res)
if (res) {
res += nfs_scan_commit(inode, &head, NULL, 0, 0);
spin_unlock(&nfs_wreq_lock);
error = nfs_commit_list(&head, how);
} else
spin_unlock(&nfs_wreq_lock);
if (error < 0)
return error;
return res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment