Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-30 Thread Ming Lei
On Wed, Jul 29, 2015 at 6:08 PM, Dave Chinner wrote: > On Wed, Jul 29, 2015 at 07:21:47AM -0400, Ming Lei wrote: >> On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner wrote: >> > On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: >> >> On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig >> >>

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-30 Thread Ming Lei
On Wed, Jul 29, 2015 at 6:08 PM, Dave Chinner da...@fromorbit.com wrote: On Wed, Jul 29, 2015 at 07:21:47AM -0400, Ming Lei wrote: On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner da...@fromorbit.com wrote: On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: On Mon, Jul 27, 2015 at 1:33

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Dave Chinner
On Wed, Jul 29, 2015 at 07:21:47AM -0400, Ming Lei wrote: > On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner wrote: > > On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: > >> On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig > >> wrote: > >> > On Mon, Jul 27, 2015 at 05:53:33AM -0400,

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Ming Lei
On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner wrote: > On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: >> On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig >> wrote: >> > On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: >> >> Because size has to be 4k aligned too. >> > >> >

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Dave Chinner
On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: > On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig wrote: > > On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: > >> Because size has to be 4k aligned too. > > > > Yes. But again I don't see any reason to limit us to a hardcoded

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Ming Lei
On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig wrote: > On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: >> Because size has to be 4k aligned too. > > Yes. But again I don't see any reason to limit us to a hardcoded 512 > byte block size here, especially considering the patches to

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Dave Chinner
On Wed, Jul 29, 2015 at 07:21:47AM -0400, Ming Lei wrote: On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner da...@fromorbit.com wrote: On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Ming Lei
On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: Because size has to be 4k aligned too. Yes. But again I don't see any reason to limit us to a hardcoded 512 byte block size here, especially considering the

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Dave Chinner
On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: Because size has to be 4k aligned too. Yes. But again I don't see any reason to limit us to a

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-29 Thread Ming Lei
On Wed, Jul 29, 2015 at 4:41 AM, Dave Chinner da...@fromorbit.com wrote: On Wed, Jul 29, 2015 at 03:33:52AM -0400, Ming Lei wrote: On Mon, Jul 27, 2015 at 1:33 PM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: Because size has to be

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Dave Chinner
On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: > On Mon, Jul 27, 2015 at 5:45 AM, Christoph Hellwig wrote: > > On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: > >> > Why the hardcoded value? I suspect this should be more like: > >> > > >> > if (dio &&

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: > Because size has to be 4k aligned too. Yes. But again I don't see any reason to limit us to a hardcoded 512 byte block size here, especially considering the patches to finally allow enabling other block sizes from userspace. -- To

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Ming Lei
On Mon, Jul 27, 2015 at 5:45 AM, Christoph Hellwig wrote: > On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: >> > Why the hardcoded value? I suspect this should be more like: >> > >> > if (dio && inode->i_sb->s_bdev && >> > (lo->lo_offset &

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: > > Why the hardcoded value? I suspect this should be more like: > > > > if (dio && inode->i_sb->s_bdev && > > (lo->lo_offset & (bdev_io_min(inode->i_sb->s_bdev) - 1)) != 0) > > dio = false; > > The

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Ming Lei
On Mon, Jul 27, 2015 at 4:40 AM, Christoph Hellwig wrote: >> + /* >> + * loop block's logical block size is 512, now >> + * we support direct I/O only if the backing >> + * block devices' minimize I/O size is 512 and >> + * the offset is aligned with 512. >> + */ >> +

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
> + /* > + * loop block's logical block size is 512, now > + * we support direct I/O only if the backing > + * block devices' minimize I/O size is 512 and > + * the offset is aligned with 512. > + */ > + if (dio) { > + if (inode->i_sb->s_bdev && > +

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: Because size has to be 4k aligned too. Yes. But again I don't see any reason to limit us to a hardcoded 512 byte block size here, especially considering the patches to finally allow enabling other block sizes from userspace. -- To

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Dave Chinner
On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: On Mon, Jul 27, 2015 at 5:45 AM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: Why the hardcoded value? I suspect this should be more like: if (dio

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Ming Lei
On Mon, Jul 27, 2015 at 4:40 AM, Christoph Hellwig h...@infradead.org wrote: + /* + * loop block's logical block size is 512, now + * we support direct I/O only if the backing + * block devices' minimize I/O size is 512 and + * the offset is aligned with 512. +

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: Why the hardcoded value? I suspect this should be more like: if (dio inode-i_sb-s_bdev (lo-lo_offset (bdev_io_min(inode-i_sb-s_bdev) - 1)) != 0) dio = false; The above can't work if the

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Ming Lei
On Mon, Jul 27, 2015 at 5:45 AM, Christoph Hellwig h...@infradead.org wrote: On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: Why the hardcoded value? I suspect this should be more like: if (dio inode-i_sb-s_bdev (lo-lo_offset

Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-27 Thread Christoph Hellwig
+ /* + * loop block's logical block size is 512, now + * we support direct I/O only if the backing + * block devices' minimize I/O size is 512 and + * the offset is aligned with 512. + */ + if (dio) { + if (inode-i_sb-s_bdev +

[PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-16 Thread Ming Lei
This patches provides one interface for enabling direct IO from user space: - userspace(such as losetup) can pass 'file' which is opened/fcntl as O_DIRECT Also __loop_update_dio() is introduced to check if direct I/O can be used on current loop setting. The last big change is to

[PATCH v7 4/6] block: loop: prepare for supporing direct IO

2015-07-16 Thread Ming Lei
This patches provides one interface for enabling direct IO from user space: - userspace(such as losetup) can pass 'file' which is opened/fcntl as O_DIRECT Also __loop_update_dio() is introduced to check if direct I/O can be used on current loop setting. The last big change is to