[PATCH 4/7] nonblocking aio: return on congested block device

2017-02-13 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new flag BIO_NONBLOCKING is introduced to identify bio's orignating from iocb with IOCB_NONBLOCKING. struct request are requested using BLK_MQ_REQ_NOWAIT if BIO_NONBLOCKING is set. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --

Re: [PATCH 4/7] nonblocking aio: return on congested block device

2017-02-15 Thread Goldwyn Rodrigues
On 02/13/2017 09:55 PM, Ming Lei wrote: > On Tue, Feb 14, 2017 at 10:46 AM, Goldwyn Rodrigues <rgold...@suse.de> wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> >> A new flag BIO_NONBLOCKING is introduced to identify bio's >> orignating from ioc

[PATCH] blk-mq: Call bio_io_error if request returned is NULL

2017-02-13 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If blk_mq_map_request returns NULL, bio_endio() function is not called. Call bio_io_error() in case request returned is NULL. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- block/blk-mq.c | 8 ++-- 1 file changed, 6 inse

[PATCH 8/8] nowait aio: btrfs

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 4/8] nowait aio: Introduce IOMAP_NOWAIT

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2 files changed, 3 insertions(+)

[PATCH 7/8] nowait aio: xfs

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extending, writing to a hole, or COW. Signed-off-by: Goldwyn Rod

[PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 0/8 v2] Non-blocking AIO

2017-02-28 Thread Goldwyn Rodrigues
This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block device The goal of the patch series is to

[PATCH 2/8] nowait aio: Return if cannot get hold of i_rwsem

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A failure to lock i_rwsem would mean there is I/O being performed by another thread. So, let's bail. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- mm/filemap.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) dif

[PATCH 5/8] nowait aio: return on congested block device

2017-02-28 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new flag BIO_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --

Re: [PATCH 1/8] nowait aio: Introduce IOCB_FLAG_NOWAIT

2017-03-01 Thread Goldwyn Rodrigues
On 03/01/2017 09:56 AM, Christoph Hellwig wrote: > On Wed, Mar 01, 2017 at 07:36:48AM -0800, Christoph Hellwig wrote: >> Given that we aren't validating aio_flags in older kernels we can't >> just add this flag as it will be a no-op in older kernels. I think >> we will have to add

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-03-24 Thread Goldwyn Rodrigues
On 03/16/2017 09:33 AM, Jens Axboe wrote: > On 03/15/2017 03:51 PM, Goldwyn Rodrigues wrote: >> diff --git a/block/blk-core.c b/block/blk-core.c >> index 0eeb99e..2e5cba2 100644 >> --- a/block/blk-core.c >> +++ b/block/blk-core.c >> @@ -2014,7 +2019,7 @@ blk_qc_

Re: [PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-03-16 Thread Goldwyn Rodrigues
On 03/16/2017 08:20 AM, Matthew Wilcox wrote: > On Wed, Mar 15, 2017 at 04:51:02PM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> >> Find out if the write will trigger a wait due to writeback. If yes, >> return -EAGAIN. >

Re: [PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-03-16 Thread Goldwyn Rodrigues
On 03/16/2017 08:08 AM, Matthew Wilcox wrote: > On Wed, Mar 15, 2017 at 04:51:02PM -0500, Goldwyn Rodrigues wrote: >> This introduces a new function filemap_range_has_page() which >> returns true if the file's mapping has a page within the range >> mentioned. > &g

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-03-17 Thread Goldwyn Rodrigues
On 03/16/2017 09:33 AM, Jens Axboe wrote: > On 03/15/2017 03:51 PM, Goldwyn Rodrigues wrote: >> diff --git a/block/blk-core.c b/block/blk-core.c >> index 0eeb99e..2e5cba2 100644 >> --- a/block/blk-core.c >> +++ b/block/blk-core.c >> @@ -2014,7 +2019,7 @@ blk_qc_

[PATCH 6/8] nowait aio: ext4

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 4/8] nowait-aio: Introduce IOMAP_NOWAIT

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2 files changed, 3 insertions(+)

[PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 5/8] nowait aio: return on congested block device

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new flag BIO_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --

[PATCH 0/8 v3] No wait AIO

2017-03-15 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 1/8] nowait aio: Introduce IOCB_RW_FLAG_NOWAIT

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 2/8] nowait aio: Return if cannot get hold of i_rwsem

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A failure to lock i_rwsem would mean there is I/O being performed by another thread. So, let's bail. Reviewed-by: Christoph Hellwig <h...@lst.de> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- mm/filemap.c | 7 ++-

[PATCH 8/8] nowait aio: btrfs

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 7/8] nowait aio: xfs

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

Re: [PATCH 6/8] nowait aio: ext4

2017-04-04 Thread Goldwyn Rodrigues
On 04/04/2017 03:41 AM, Christoph Hellwig wrote: > On Tue, Apr 04, 2017 at 09:58:53AM +0200, Jan Kara wrote: >> FS_NOWAIT looks a bit too generic given these are filesystem feature flags. >> Can we call it FS_NOWAIT_IO? > > It's way to generic as it's a feature of the particular file_operations

[PATCH 7/9] nowait aio: xfs

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 6/9] nowait aio: ext4

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 4/9] nowait-aio: Introduce IOMAP_NOWAIT

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index 141c3c

[PATCH 8/9] nowait aio: btrfs

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 5/9] nowait aio: return on congested block device

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new flag BIO_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. To facilitate this, QUEUE_FLAG_NOWAIT is set to devices

[PATCH 2/9] nowait aio: Introduce RWF_NOWAIT

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 1/9] Use RWF_* flags for AIO operations

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_* flags is used for preadv2/pwritev2 calls. Port to use it for aio operations as well. For this, aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry these flags. This is a precursor to the nowait AIO calls.

[PATCH 0/9 v5] No wait AIO

2017-04-11 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 9/9] nowait aio: Return -EOPNOTSUPP if filesystem does not support

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> The check is in generic_file_write_iter(), which is called by most filesystems, either through fsops.write_iter() or through the function defined by write_iter(). If not, we perform the check in the defined .write_iter() function which is

[PATCH 3/9] nowait aio: return if direct write will trigger writeback

2017-04-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 5/8] nowait aio: return on congested block device

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new flag BIO_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. To facilitate this, QUEUE_FLAG_NOWAIT is set to devices

[PATCH 6/8] nowait aio: ext4

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location --- fs/ext4/file.c

[PATCH 7/8] nowait aio: xfs

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 4/8] nowait-aio: Introduce IOMAP_NOWAIT

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index 141c3cd..d1c8175

[PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 8/8] nowait aio: btrfs

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated --- fs/btrfs/file.c

[PATCH 0/8 v4] No wait AIO

2017-04-03 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 1/8] nowait aio: Introduce IOCB_RW_FLAG_NOWAIT

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 2/8] nowait aio: Return if cannot get hold of i_rwsem

2017-04-03 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A failure to lock i_rwsem would mean there is I/O being performed by another thread. So, let's bail. Reviewed-by: Christoph Hellwig <h...@lst.de> --- mm/filemap.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm

Re: [PATCH 5/9] nowait aio: return on congested block device

2017-04-12 Thread Goldwyn Rodrigues
On 04/12/2017 03:36 AM, Christoph Hellwig wrote: > As mentioned last time around, this should be a REQ_NOWAIT flag so > that it can be easily passed dow? n to the request layer. > >> +static inline void bio_wouldblock_error(struct bio *bio) >> +{ >> +bio->bi_error = -EAGAIN; >> +

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-04-19 Thread Goldwyn Rodrigues
On 04/19/2017 01:45 AM, Christoph Hellwig wrote: > >> +if (bio->bi_opf & REQ_NOWAIT) { >> +if (!blk_queue_nowait(q)) { >> +err = -EOPNOTSUPP; >> +goto end_io; >> +} >> +if (!(bio->bi_opf & REQ_SYNC)) { > > I don't

[PATCH 5/8] nowait aio: return on congested block device

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. To facilitate this, QUEUE_FLAG_NOWAIT

[PATCH 6/8] nowait aio: ext4

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 7/8] nowait aio: xfs

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 8/8] nowait aio: btrfs

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 1/8] Use RWF_* flags for AIO operations

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_* flags is used for preadv2/pwritev2 calls. Port to use it for aio operations as well. For this, aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry these flags. This is a precursor to the nowait AIO calls.

[PATCH 2/8] nowait aio: Introduce RWF_NOWAIT

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 0/8 v6] No wait AIO

2017-04-14 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 4/8] nowait-aio: Introduce IOMAP_NOWAIT

2017-04-14 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index 141c3c

Re: [PATCH 2/8] nowait aio: Introduce RWF_NOWAIT

2017-04-19 Thread Goldwyn Rodrigues
On 04/19/2017 01:39 AM, Christoph Hellwig wrote: > >> @@ -1593,6 +1593,11 @@ static int io_submit_one(struct kioctx *ctx, struct >> iocb __user *user_iocb, >> } >> >> req->common.ki_flags |= iocb_rw_flags(iocb->aio_rw_flags); >> +if ((req->common.ki_flags & IOCB_NOWAIT) && >> +

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-03-08 Thread Goldwyn Rodrigues
On 03/08/2017 01:03 AM, Sagi Grimberg wrote: > >> -if (likely(blk_queue_enter(q, false) == 0)) { >> +if (likely(blk_queue_enter(q, bio_flagged(bio, BIO_NOWAIT)) >> == 0)) { >> ret = q->make_request_fn(q, bio); > > I think that for ->make_request to not block we'd

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-03-08 Thread Goldwyn Rodrigues
On 03/08/2017 10:17 AM, Jens Axboe wrote: > On 03/08/2017 08:00 AM, Goldwyn Rodrigues wrote: >> >> >> On 03/08/2017 01:03 AM, Sagi Grimberg wrote: >>> >>>> -if (likely(blk_queue_enter(q, false) == 0)) { >>>> +if (likely(blk_

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-10 Thread Goldwyn Rodrigues
On 08/09/2017 09:17 PM, Jens Axboe wrote: > On 08/09/2017 08:07 PM, Goldwyn Rodrigues wrote: >>>>>>>> No, from a multi-device point of view, this is inconsistent. I >>>>>>>> have tried the request bio returns -EAGAIN before the split,

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-10 Thread Goldwyn Rodrigues
On 08/09/2017 09:18 PM, Jens Axboe wrote: > On 08/08/2017 02:36 PM, Jens Axboe wrote: >> On 08/08/2017 02:32 PM, Shaohua Li wrote: diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 25f6a0cb27d3..fae021ebec1b 100644 --- a/include/linux/blkdev.h +++

Re: Commit edf064e7c (btrfs: nowait aio support) breaks shells

2017-07-07 Thread Goldwyn Rodrigues
On 07/04/2017 05:16 PM, Jens Axboe wrote: > > Please expedite getting this upstream, asap. > Jens, I have posted an updated patch [1] and it is acked by David. Would you pick it up or should it go through the btrfs tree (or some other tree)? [1] https://patchwork.kernel.org/patch/9825813/

[PATCH 0/9] Nowait feature for stacked block devices

2017-07-26 Thread Goldwyn Rodrigues
This is a continuation of the nowait support which was incorporated a while back. We introduced REQ_NOWAIT which would return immediately if the call would block at the block layer. Request based-devices do not wait. However, bio based devices (the ones which exclusively call make_request_fn) need

[PATCH 2/9] md: Add nowait support to md

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Set queue flags to QUEUE_FLAG_NOWAIT to indicate REQ_NOWAIT will be handled. If an I/O on the md will be delayed, it would bail by calling bio_wouldblock_error(). The conditions when this could happen are: + MD is suspended + There is a

[PATCH 3/9] md: raid1 nowait support

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> The RAID1 driver would bail with EAGAIN in case of: + I/O has to wait for a barrier + array is frozen + Area is suspended + There are too many pending I/O that it will be queued. To facilitate error for wait barriers, wait_barrier() is ret

[PATCH 5/9] md: raid10 nowait support

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Bail and status to EAGAIN if raid10 is going to wait for: + barriers + reshape operation + Too many queued requests Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- drivers/md/r

[PATCH 6/9] dm: add nowait support

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Add support for bio based dm devices, which exclusively sets a make_request_fn(). Request based devices are supported by default. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- drivers/md/dm.c | 3 +++ 1 file changed, 3 inserti

[PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Nowait is a feature of direct AIO, where users can request to return immediately if the I/O is going to block. This translates to REQ_NOWAIT in bio.bi_opf flags. While request based devices don't wait, stacked devices such as md/dm will. In

[PATCH 9/9] dm-mpath: Add nowait support

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If there are no queues, bail if REQ_NOWAIT is set instead of queueing up I/O. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- drivers/md/dm-mpath.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/md/dm-mpath.c b/d

[PATCH 8/9] dm: Add nowait support to dm-delay

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> I/O should bail out if any value for delay is set. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- drivers/md/dm-delay.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index

[PATCH 7/9] dm: Add nowait support to raid1

2017-07-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If the I/O would block because the devices are syncing, bail. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- drivers/md/dm-raid1.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-r

Re: [PATCH 3/3] fs: support RWF_NOWAIT for buffered reads

2017-06-29 Thread Goldwyn Rodrigues
On 06/29/2017 04:25 PM, Christoph Hellwig wrote: > This is based on the old idea and code from Milosz Tanski. With the > aio nowait code it becomes mostly trivial now. > > Signed-off-by: Christoph Hellwig > --- > fs/aio.c | 6 -- > fs/btrfs/file.c| 2 +- >

Re: [PATCH 3/3] fs: support RWF_NOWAIT for buffered reads

2017-06-30 Thread Goldwyn Rodrigues
On 06/30/2017 01:15 PM, Christoph Hellwig wrote: > This is based on the old idea and code from Milosz Tanski. With the > aio nowait code it becomes mostly trivial now. > Looks Good. Reviewed-by: Goldwyn Rodrigues <rgold...@suse.com> -- Goldwyn

Re: Commit edf064e7c (btrfs: nowait aio support) breaks shells

2017-07-04 Thread Goldwyn Rodrigues
On 07/04/2017 02:45 AM, Markus Trippelsdorf wrote: > On 2017.07.04 at 06:23 +0200, Markus Trippelsdorf wrote: >> commit edf064e7c6fec3646b06c944a8e35d1a3de5c2c3 (HEAD, refs/bisect/bad) >> Author: Goldwyn Rodrigues <rgold...@suse.com> >> Date: Tue Jun 20 07:05:49

Re: [PATCH 3/3] fs: support RWF_NOWAIT for buffered reads

2017-07-03 Thread Goldwyn Rodrigues
On 06/30/2017 01:15 PM, Christoph Hellwig wrote: > This is based on the old idea and code from Milosz Tanski. With the > aio nowait code it becomes mostly trivial now. > > Signed-off-by: Christoph Hellwig > --- > fs/aio.c | 6 -- > fs/btrfs/file.c| 9

[PATCH v2] btrfs: Correct assignment of pos

2017-07-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Assigning pos for usage early messes up in append mode, where the pos is re-assigned in generic_write_checks(). Assign pos later to get the correct position to write from iocb->ki_pos. Since check_can_nocow also uses the value of pos,

[PATCH] btrfs: Correct assignment of pos

2017-07-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Assigning pos for usage early messes up in append mode, where the pos is re-assigned in generic_write_checks(). Re-assign pos to get the correct position to write from iocb->ki_pos. Fixes: edf064e7c6fe ("btrfs: nowait aio suppor

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-04-24 Thread Goldwyn Rodrigues
On 04/19/2017 01:45 AM, Christoph Hellwig wrote: > On Fri, Apr 14, 2017 at 07:02:54AM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> > >> +/* Request queue supports BIO_NOWAIT */ >> +queue_flag_set_unlocked(QU

Re: [PATCH 4/9] md: raid5 nowait support

2017-08-09 Thread Goldwyn Rodrigues
On 08/08/2017 03:43 PM, Shaohua Li wrote: > On Wed, Jul 26, 2017 at 06:58:01PM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> >> Return EAGAIN in case RAID5 would block because of waiting due to: >> + Reshaping >&g

Re: [PATCH 3/9] md: raid1 nowait support

2017-08-09 Thread Goldwyn Rodrigues
On 08/08/2017 03:39 PM, Shaohua Li wrote: > On Wed, Jul 26, 2017 at 06:58:00PM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> >> The RAID1 driver would bail with EAGAIN in case of: >> + I/O has to wait for a barrier

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-09 Thread Goldwyn Rodrigues
On 08/08/2017 03:32 PM, Shaohua Li wrote: > On Wed, Jul 26, 2017 at 06:57:58PM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> >> Nowait is a feature of direct AIO, where users can request >> to return immediately if the I/O i

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-09 Thread Goldwyn Rodrigues
On 08/09/2017 10:02 AM, Shaohua Li wrote: > On Wed, Aug 09, 2017 at 06:44:55AM -0500, Goldwyn Rodrigues wrote: >> >> >> On 08/08/2017 03:32 PM, Shaohua Li wrote: >>> On Wed, Jul 26, 2017 at 06:57:58PM -0500, Goldwyn Rodrigues wrote: >>>>

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-09 Thread Goldwyn Rodrigues
On 08/09/2017 03:21 PM, Shaohua Li wrote: > On Wed, Aug 09, 2017 at 10:35:39AM -0500, Goldwyn Rodrigues wrote: >> >> >> On 08/09/2017 10:02 AM, Shaohua Li wrote: >>> On Wed, Aug 09, 2017 at 06:44:55AM -0500, Goldwyn Rodrigues wrote: >>>> >>

Re: [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait

2017-08-09 Thread Goldwyn Rodrigues
On 08/09/2017 08:17 PM, Shaohua Li wrote: > On Wed, Aug 09, 2017 at 05:16:23PM -0500, Goldwyn Rodrigues wrote: >> >> >> On 08/09/2017 03:21 PM, Shaohua Li wrote: >>> On Wed, Aug 09, 2017 at 10:35:39AM -0500, Goldwyn Rodrigues wrote: >>>> >>

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-05-11 Thread Goldwyn Rodrigues
On 05/11/2017 02:44 AM, Christoph Hellwig wrote: > Looks fine, > > Reviewed-by: Christoph Hellwig > > Although lifting the make_request limit is something a lot of users > would appreciate in the near future.. > Yes, I understand. That will be on my todo list next on priority.

[PATCH 4/8] nowait-aio: Introduce IOMAP_NOWAIT

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/iomap.c| 2 ++ include/linu

[PATCH 2/8] nowait aio: Introduce RWF_NOWAIT

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 1/8] Use RWF_* flags for AIO operations

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_* flags is used for preadv2/pwritev2 calls. Port to use it for aio operations as well. For this, aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry these flags. This is a precursor to the nowait AIO calls.

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in

[PATCH 09/10] xfs: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 08/10] ext4: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 01/10] fs: Separate out kiocb flags setup based on RWF_* flags

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/read_write.c| 12 +++- include/linux/fs.h | 14 ++ 2 files changed, 17 insertions(+), 9 deletions(-

[PATCH 07/10] fs: return on congested block device

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 05/10] fs: return if direct write will trigger writeback

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. Return -EINVAL for buffered AIO: there are multiple causes of delay such as page locks, dirty throttling logic, page loading from disk etc. which cannot be take

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT fo

[PATCH 10/10] btrfs: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/iomap.c| 2 ++ include/linu

[PATCH 0/10 v8] No wait AIO

2017-05-11 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

Re: [PATCH 0/10 v11] No wait AIO

2017-06-12 Thread Goldwyn Rodrigues
On 06/10/2017 12:34 AM, Al Viro wrote: > On Thu, Jun 08, 2017 at 12:39:10AM -0700, Christoph Hellwig wrote: >> As already indicated this whole series looks fine to me. >> >> Al: are you going to pick this up? Or Andrew? > > The main issue here is "let's bail out from ->write_iter() instances"

[PATCH 08/10] ext4: nowait aio support

2017-06-20 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

  1   2   >