linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] [RESEND] Remove plugging at buffered write time
@ 2012-08-05  8:26 Fengguang Wu
  2012-08-05  8:26 ` [PATCH 1/2] block: remove " Fengguang Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-08-05  8:26 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Andrew Morton, linux-fsdevel, Damien Wyart, Li Shaohua,
	Jeff Moyer, Fengguang Wu, LKML

Hi all,

It seems this patch was silently forgotten, but the review comments have all
been addressed: the patch has been split into two pieces and tests show no
performance regressions (nor noticeable gains..).

Thanks to Damien for reminding me of the patch!

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] block: remove plugging at buffered write time
  2012-08-05  8:26 [PATCH 0/2] [RESEND] Remove plugging at buffered write time Fengguang Wu
@ 2012-08-05  8:26 ` Fengguang Wu
  2012-08-05  8:26 ` [PATCH 2/2] block: move down direct IO plugging Fengguang Wu
  2012-08-09 13:23 ` [PATCH 0/2] [RESEND] Remove plugging at buffered write time Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-08-05  8:26 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Andrew Morton, Li Shaohua, Wu Fengguang, linux-fsdevel,
	Damien Wyart, Jeff Moyer, LKML

[-- Attachment #1: remove-write-plug.patch --]
[-- Type: text/plain, Size: 1285 bytes --]

Buffered write(2) is not directly tied to IO, so it's not suitable to
handle plug in generic_file_aio_write().

Note that plugging for O_SYNC writes is also removed. The user may pass
arbitrary @size arguments, which may be much larger than the preferable
I/O size, or may cross extent/device boundaries. Let the lower layers
handle the plugging. The plugging code here actually turns them into
no-ops.

CC: Li Shaohua <shli@fusionio.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 mm/filemap.c |    3 ---
 1 file changed, 3 deletions(-)

--- linux-next.orig/mm/filemap.c	2012-08-05 16:23:53.000000000 +0800
+++ linux-next/mm/filemap.c	2012-08-05 16:24:07.251464157 +0800
@@ -2527,14 +2527,12 @@ ssize_t generic_file_aio_write(struct ki
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_mapping->host;
-	struct blk_plug plug;
 	ssize_t ret;
 
 	BUG_ON(iocb->ki_pos != pos);
 
 	sb_start_write(inode->i_sb);
 	mutex_lock(&inode->i_mutex);
-	blk_start_plug(&plug);
 	ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
 	mutex_unlock(&inode->i_mutex);
 
@@ -2545,7 +2543,6 @@ ssize_t generic_file_aio_write(struct ki
 		if (err < 0 && ret > 0)
 			ret = err;
 	}
-	blk_finish_plug(&plug);
 	sb_end_write(inode->i_sb);
 	return ret;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] block: move down direct IO plugging
  2012-08-05  8:26 [PATCH 0/2] [RESEND] Remove plugging at buffered write time Fengguang Wu
  2012-08-05  8:26 ` [PATCH 1/2] block: remove " Fengguang Wu
@ 2012-08-05  8:26 ` Fengguang Wu
  2012-08-09 13:23 ` [PATCH 0/2] [RESEND] Remove plugging at buffered write time Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-08-05  8:26 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Andrew Morton, Li Shaohua, Jeff Moyer, Wu Fengguang,
	linux-fsdevel, Damien Wyart, LKML

[-- Attachment #1: move-down-directio-plug.patch --]
[-- Type: text/plain, Size: 1811 bytes --]

Move unplugging for direct I/O from around ->direct_IO() down to
do_blockdev_direct_IO(). This implicitly adds plugging for direct
writes.

CC: Li Shaohua <shli@fusionio.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 fs/direct-io.c |    5 +++++
 mm/filemap.c   |    4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)

--- linux-next.orig/mm/filemap.c	2012-08-05 16:24:47.859465122 +0800
+++ linux-next/mm/filemap.c	2012-08-05 16:24:48.407465135 +0800
@@ -1412,12 +1412,8 @@ generic_file_aio_read(struct kiocb *iocb
 			retval = filemap_write_and_wait_range(mapping, pos,
 					pos + iov_length(iov, nr_segs) - 1);
 			if (!retval) {
-				struct blk_plug plug;
-
-				blk_start_plug(&plug);
 				retval = mapping->a_ops->direct_IO(READ, iocb,
 							iov, pos, nr_segs);
-				blk_finish_plug(&plug);
 			}
 			if (retval > 0) {
 				*ppos = pos + retval;
--- linux-next.orig/fs/direct-io.c	2012-07-07 21:46:39.531508198 +0800
+++ linux-next/fs/direct-io.c	2012-08-05 16:24:48.411465136 +0800
@@ -1062,6 +1062,7 @@ do_blockdev_direct_IO(int rw, struct kio
 	unsigned long user_addr;
 	size_t bytes;
 	struct buffer_head map_bh = { 0, };
+	struct blk_plug plug;
 
 	if (rw & WRITE)
 		rw = WRITE_ODIRECT;
@@ -1177,6 +1178,8 @@ do_blockdev_direct_IO(int rw, struct kio
 				PAGE_SIZE - user_addr / PAGE_SIZE);
 	}
 
+	blk_start_plug(&plug);
+
 	for (seg = 0; seg < nr_segs; seg++) {
 		user_addr = (unsigned long)iov[seg].iov_base;
 		sdio.size += bytes = iov[seg].iov_len;
@@ -1235,6 +1238,8 @@ do_blockdev_direct_IO(int rw, struct kio
 	if (sdio.bio)
 		dio_bio_submit(dio, &sdio);
 
+	blk_finish_plug(&plug);
+
 	/*
 	 * It is possible that, we return short IO due to end of file.
 	 * In that case, we need to release all the pages we got hold on.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] [RESEND] Remove plugging at buffered write time
  2012-08-05  8:26 [PATCH 0/2] [RESEND] Remove plugging at buffered write time Fengguang Wu
  2012-08-05  8:26 ` [PATCH 1/2] block: remove " Fengguang Wu
  2012-08-05  8:26 ` [PATCH 2/2] block: move down direct IO plugging Fengguang Wu
@ 2012-08-09 13:23 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2012-08-09 13:23 UTC (permalink / raw)
  To: Fengguang Wu
  Cc: Andrew Morton, linux-fsdevel, Damien Wyart, Li Shaohua,
	Jeff Moyer, LKML

On 08/05/2012 10:26 AM, Fengguang Wu wrote:
> Hi all,
> 
> It seems this patch was silently forgotten, but the review comments have all
> been addressed: the patch has been split into two pieces and tests show no
> performance regressions (nor noticeable gains..).
> 
> Thanks to Damien for reminding me of the patch!

Thanks Wu, applied.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-09 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-05  8:26 [PATCH 0/2] [RESEND] Remove plugging at buffered write time Fengguang Wu
2012-08-05  8:26 ` [PATCH 1/2] block: remove " Fengguang Wu
2012-08-05  8:26 ` [PATCH 2/2] block: move down direct IO plugging Fengguang Wu
2012-08-09 13:23 ` [PATCH 0/2] [RESEND] Remove plugging at buffered write time Jens Axboe

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).