From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, khoa@us.ibm.com
Subject: [PATCH] nfs: only do COMMIT for range written with direct I/O
Date: Wed, 30 Nov 2011 09:07:54 -0500 [thread overview]
Message-ID: <1322662074-3843-1-git-send-email-jlayton@redhat.com> (raw)
When given a range to write with unstable writes, the current code
always does a COMMIT of the entire file afterward. This is potentially
expensive on some servers and unnecessary. Instead, just do a COMMIT for
the offset and count that was written.
Khoa, who reported this bug, stated that this made a big difference in
performance in their environment, which I believe involves GPFS on the
server. He didn't pass along any hard numbers so I can't quantify the
gain, but it stands to reason that clustered filesystems might suffer
more contention issues when issuing a commit over the whole file.
Reported-by: Khoa Huynh <khoa@us.ibm.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfs/direct.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 1940f1a..33f2be7 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -77,6 +77,7 @@ struct nfs_direct_req {
/* completion state */
atomic_t io_count; /* i/os we're waiting for */
spinlock_t lock; /* protect completion state */
+ loff_t pos; /* offset into file */
ssize_t count, /* bytes actually processed */
error; /* any reported error */
struct completion completion; /* wait for i/o completion */
@@ -584,8 +585,8 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
data->cred = msg.rpc_cred;
data->args.fh = NFS_FH(data->inode);
- data->args.offset = 0;
- data->args.count = 0;
+ data->args.offset = dreq->pos;
+ data->args.count = dreq->count;
data->args.context = dreq->ctx;
data->args.lock_context = dreq->l_ctx;
data->res.count = 0;
@@ -877,6 +878,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
sync = NFS_FILE_SYNC;
dreq->inode = inode;
+ dreq->pos = pos;
dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
if (dreq->l_ctx == NULL)
--
1.7.6.4
next reply other threads:[~2011-11-30 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-30 14:07 Jeff Layton [this message]
2011-11-30 14:56 ` [PATCH] nfs: only do COMMIT for range written with direct I/O Malahal Naineni
2011-11-30 19:25 ` Jeff Layton
2011-12-05 17:11 ` Jeff Layton
2011-12-05 18:06 ` Myklebust, Trond
2011-12-13 15:02 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322662074-3843-1-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=khoa@us.ibm.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox