linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: "Neil Brown" <neilb@suse.de>, viro <viro@ZenIV.linux.org.uk>
Cc: linux-raid <linux-raid@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices.
Date: Mon, 16 Jul 2012 09:30:50 +0800	[thread overview]
Message-ID: <201207160930466402203@gmail.com> (raw)

For regular file, write operaion used blk_plug function.But for block
file,write operation did not use blk_plug.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 fs/block_dev.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index c2bbe1f..22cd436 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -215,9 +215,14 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_mapping->host;
+	struct blk_plug plug;
+	ssize_t ret;
 
-	return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iov, offset,
+	blk_start_plug(&plug);
+	ret =  __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iov, offset,
 				    nr_segs, blkdev_get_blocks, NULL, NULL, 0);
+	blk_finish_plug(&plug);
+	return ret;
 }
 
 int __sync_blockdev(struct block_device *bdev, int wait)
-- 
1.7.5.4

             reply	other threads:[~2012-07-16  1:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16  1:30 majianpeng [this message]
2012-07-16  5:21 ` [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices NeilBrown
2012-07-16  5:30   ` majianpeng

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=201207160930466402203@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).