All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, Peng Tao <tao.peng@emc.com>
Subject: [PATCH 1/2] NFS: call block plug around direct write
Date: Tue, 15 May 2012 23:38:22 +0800	[thread overview]
Message-ID: <1337096303-2516-1-git-send-email-bergwolf@gmail.com> (raw)

We bypass generic_file_aio_write() but would want to call block plug.

Signed-off-by: Peng Tao <tao.peng@emc.com>
---
 fs/nfs/direct.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index a1b81dd..a485560 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -46,6 +46,7 @@
 #include <linux/kref.h>
 #include <linux/slab.h>
 #include <linux/task_io_accounting_ops.h>
+#include <linux/blkdev.h>
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
@@ -922,6 +923,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
 	struct file *file = iocb->ki_filp;
 	struct address_space *mapping = file->f_mapping;
 	size_t count;
+	struct blk_plug plug;
 
 	count = iov_length(iov, nr_segs);
 	nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
@@ -948,7 +950,9 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
 
 	task_io_account_write(count);
 
+	blk_start_plug(&plug);
 	retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
+	blk_finish_plug(&plug);
 	if (retval > 0) {
 		struct inode *inode = mapping->host;
 
-- 
1.7.1.262.g5ef3d


             reply	other threads:[~2012-05-15 15:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 15:38 Peng Tao [this message]
2012-05-15 15:38 ` [PATCH 2/2] NFS: call block plug around direct read Peng Tao
2012-05-16 17:12   ` Myklebust, Trond
2012-05-15 16:08 ` [PATCH 1/2] NFS: call block plug around direct write Christoph Hellwig
2012-05-15 16:23   ` Boaz Harrosh
2012-05-16  0:35     ` Peng Tao
2012-05-16  7:43       ` Boaz Harrosh
2012-05-16 17:12 ` Myklebust, Trond

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=1337096303-2516-1-git-send-email-bergwolf@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tao.peng@emc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.