NFS: call block plug around direct write
Subsystems (2)
PATCH 1/2 NFS: call block plug around direct write
We bypass generic_file_aio_write() but would want to call block plug.
--- fs/nfs/direct.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
fs/nfs/direct.c +4 -0
@@ -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;
Signature · 1 line
1.7.1.262.g5ef3d
PATCH 2/2 NFS: call block plug around direct read
--- fs/nfs/direct.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/nfs/direct.c +3 -0
@@ -866,6 +866,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,ssize_t retval = -EINVAL ;struct file *file = iocb->ki_filp;struct address_space *mapping = file->f_mapping; +struct blk_plug plug;size_t count; count =iov_length (iov, nr_segs);
@@ -886,7 +887,9 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,task_io_account_read (count); +blk_start_plug (&plug); retval =nfs_direct_read (iocb, iov, nr_segs, pos); +blk_finish_plug (&plug);if (retval >0 ) iocb->ki_pos = pos + retval;
Signature · 1 line
1.7.1.262.g5ef3d
Re: [PATCH 2/2] NFS: call block plug around direct read
T24gVHVlLCAyMDEyLTA1LTE1IGF0IDIzOjM4ICswODAwLCBQZW5n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19kaXJlY3RfcmVhZChpb2NiLCBpb3YsIG5yX3NlZ3Ms IHBvcyk7DQo+ICsJYmxrX2ZpbmlzaF9wbHVnKCZwbHVnKTsNCj4gIAlpZiAocmV0dmFsID4gMCkN Cj4gIAkJaW9jYi0+a2lfcG9zID0gcG9zICsgcmV0dmFsOw0KPiAgDQoNCkRpdHRvLiBUaGlzIGlz IG5vdCBnZW5lcmljLi4uDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50 IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5l dGFwcC5jb20NCg0K
Quoted 1 line · Peng Tao
We bypass
generic_file_aio_write()but would want to call block plug.
We in this case is the pnfs block driver at most. Thus these should be pnfs block code.
Quoted 10 lines · Christoph Hellwig
Quoted 1 line · Peng Tao
We bypass
generic_file_aio_write()but would want to call block plug.We in this case is the pnfs block driver at most. Thus these should be pnfs block code.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
I thought so too.
But reading the code more closely it might be hard for the blocklayout to figure out the right state to call these two. Specially the call to blk_finish_plug(). So you might need to add a new LD API such as LD()->finish_plug() which is empty for others.
But again inspecting the code it looks like blk_start_plug() is a no-op and blk_finish_plug() is specially optimized for the empty case.
So is it worth it, the extra effort? I do understand the temptation to get lazy here.
Just my $0.017
Boaz
Quoted 7 lines · Boaz Harrosh
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Peng Tao
We bypass
generic_file_aio_write()but would want to call block plug.We in this case is the pnfs block driver at most. Thus these should be pnfs block code.
Agreed. Just that for buffer IO case all call into block plug, so I thought it might be OK in DIO case as well... Anyway. I will make it block specific and call it LD()->dio_begin and LD()->dio_end. I am cooking some dio alignment patches for block layout driver and would love to put them there as well.
Quoted 9 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlI thought so too.
Quoted 8 lines
But reading the code more closely it might be hard for the blocklayout to figure out the right state to call these two. Specially the call to
blk_finish_plug(). So you might need to add a new LD API such as LD()->finish_plug() which is empty for others.But again inspecting the code it looks like
blk_start_plug()is a no-op andblk_finish_plug()is specially optimized for the empty case.
They are empty only when !CONFIG_BLOCK. I will make it block layout specific as said above.
Thanks,
Tao
Quoted 5 lines
So is it worth it, the extra effort? I do understand the temptation to get lazy here.
Just my $0.017
Boaz
Quoted 28 lines · Peng Tao
Quoted 7 lines · Boaz Harrosh
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Peng Tao
We bypass
generic_file_aio_write()but would want to call block plug.We in this case is the pnfs block driver at most. Thus these should be pnfs block code.
Agreed. Just that for buffer IO case all call into block plug, so I thought it might be OK in DIO case as well... Anyway. I will make it block specific and call it LD()->dio_begin and LD()->dio_end. I am cooking some dio alignment patches for block layout driver and would love to put them there as well.
Quoted 14 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlI thought so too.
But reading the code more closely it might be hard for the blocklayout to figure out the right state to call these two. Specially the call to
blk_finish_plug(). So you might need to add a new LD API such as LD()->finish_plug() which is empty for others.
Quoted 6 lines
Quoted 3 lines
But again inspecting the code it looks like
blk_start_plug()is a no-op andblk_finish_plug()is specially optimized for the empty case.They are empty only when !CONFIG_BLOCK. I will make it block layout specific as said above.
You miss understood. At the very top of blk_finish_plug() there is an if (list_empty()) return. So if there was no activity between plug/unplug the function is very fast.
But your above plan for alignment+plug sounds very good.
Thanks
Boaz
Quoted 7 lines
Thanks,
TaoQuoted 5 lines
So is it worth it, the extra effort? I do understand the temptation to get lazy here.
Just my $0.017
Boaz
T24gVHVlLCAyMDEyLTA1LTE1IGF0IDIzOjM4ICswODAwLCBQZW5nIFRhbyB3cm90ZToNCj4gV2Ug Ynl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