All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices.
@ 2012-07-16  1:30 majianpeng
  2012-07-16  5:21 ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: majianpeng @ 2012-07-16  1:30 UTC (permalink / raw)
  To: Neil Brown, viro; +Cc: linux-raid, linux-fsdevel

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

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

* Re: [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices.
  2012-07-16  1:30 [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices majianpeng
@ 2012-07-16  5:21 ` NeilBrown
  2012-07-16  5:30   ` majianpeng
  0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-07-16  5:21 UTC (permalink / raw)
  To: majianpeng; +Cc: viro, linux-raid, linux-fsdevel, axboe

[-- Attachment #1: Type: text/plain, Size: 1973 bytes --]

On Mon, 16 Jul 2012 09:30:50 +0800 majianpeng <majianpeng@gmail.com> wrote:

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

[cc:ing Jens Axboe]

I think we do need something like this, but I don't think this is the right
place for it.

For normal filesystem writes, the blk_{start,finish}_plug calls are in
generic_file_aio_write which is the "aio_write" function, or is called by it.
aio_write calls generic_file_aio_write, calls blk_start_plug, call
__generic_file_aio_write.

For block devices we bypass the generic_file_aio_write:

aio_write calls blkdev_aio_write calls __generic_file_aio_write - without
calling blk_start_plug.
So I think the calls to blk_start_plug and blk_finish_plug should go in
blkdev_aio_write.  i.e. blkdev_aio_write should be made to look more like
generic_file_aio_write (just without the mutex_lock/unlock).

If you redo the patch like that and test it I'll happily add my Reviewed-by.

I suspect it should be merged through Jens' tree.

Thanks,
NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: Re: [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices.
  2012-07-16  5:21 ` NeilBrown
@ 2012-07-16  5:30   ` majianpeng
  0 siblings, 0 replies; 3+ messages in thread
From: majianpeng @ 2012-07-16  5:30 UTC (permalink / raw)
  To: Neil Brown; +Cc: viro, linux-raid, linux-fsdevel, axboe

On 2012-07-16 13:21 NeilBrown <neilb@suse.de> Wrote:
>On Mon, 16 Jul 2012 09:30:50 +0800 majianpeng <majianpeng@gmail.com> wrote:
>
>> 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)
>
>[cc:ing Jens Axboe]
>
>I think we do need something like this, but I don't think this is the right
>place for it.
>
>For normal filesystem writes, the blk_{start,finish}_plug calls are in
>generic_file_aio_write which is the "aio_write" function, or is called by it.
>aio_write calls generic_file_aio_write, calls blk_start_plug, call
>__generic_file_aio_write.
>
>For block devices we bypass the generic_file_aio_write:
>
>aio_write calls blkdev_aio_write calls __generic_file_aio_write - without
>calling blk_start_plug.
>So I think the calls to blk_start_plug and blk_finish_plug should go in
>blkdev_aio_write.  i.e. blkdev_aio_write should be made to look more like
>generic_file_aio_write (just without the mutex_lock/unlock).
>
>If you redo the patch like that and test it I'll happily add my Reviewed-by.
>
>I suspect it should be merged through Jens' tree.
>
>Thanks,
>NeilBrown
>
>
Thanks, i'll do it and resend the patch.

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

end of thread, other threads:[~2012-07-16  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16  1:30 [PATCH 1/2] fs/block-dev.c:fix performance regression in O_DIRECT writes to md block devices majianpeng
2012-07-16  5:21 ` NeilBrown
2012-07-16  5:30   ` majianpeng

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.