Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Ming Lei
On Wed, Mar 15, 2017 at 09:35:03PM +, Bart Van Assche wrote: > On Thu, 2017-03-16 at 00:22 +0800, Ming Lei wrote: > > On Wed, Mar 15, 2017 at 03:36:31PM +, Bart Van Assche wrote: > > > Please have another look at __blk_mq_requeue_request(). In that function > > > the following code occurs:

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

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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 Signed-off-by: Goldwyn Rodrigues --- mm/filemap.c | 7 ++- 1 file changed, 6

[PATCH 1/8] nowait aio: Introduce IOCB_RW_FLAG_NOWAIT

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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

[PATCH 8/8] nowait aio: btrfs

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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 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 finish.

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

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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 buffered

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

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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 ---

[PATCH 6/8] nowait aio: ext4

2017-03-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues 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 ---

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

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

[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

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Bart Van Assche
On Wed, 2017-03-15 at 20:18 +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 12:07:37AM +, Bart Van Assche wrote: > > Both the old and the new check look racy to me. The REQ_ATOM_STARTED bit can > > be changed concurrently by blk_mq_start_request(), __blk_mq_finish_request() > >

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Bart Van Assche
On Thu, 2017-03-16 at 00:22 +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 03:36:31PM +, Bart Van Assche wrote: > > Please have another look at __blk_mq_requeue_request(). In that function > > the following code occurs: if (test_and_clear_bit(REQ_ATOM_STARTED, > > >atomic_flags)) { ... } > >

[GIT PULL] Block fixes for 4.11-rc

2017-03-15 Thread Jens Axboe
Hi Linus, Four small fixes for this cycle. This pull request contains: - Followup fix from Neil for a fix that went in before -rc2, ensuring that we always see the full per-task bio_list. - Fix for blk-mq-sched from me that ensures that we retain similar direct-to-issue behavior on running

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Jens Axboe
On 03/15/2017 11:02 AM, Paolo Valente wrote: > >> Il giorno 15 mar 2017, alle ore 17:56, Jens Axboe ha >> scritto: >> >> On 03/04/2017 09:01 AM, Paolo Valente wrote: >>> @@ -6330,7 +7012,41 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, >>> struct bfq_queue *bfqq, >>>

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Jens Axboe
On 03/15/2017 10:59 AM, Paolo Valente wrote: > >> Il giorno 15 mar 2017, alle ore 17:30, Jens Axboe ha >> scritto: >> >> On 03/15/2017 09:47 AM, Jens Axboe wrote: >>> I think you understood me correctly. Currently I think the putting of >>> the io context is somewhat of a mess.

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Paolo Valente
> Il giorno 15 mar 2017, alle ore 17:56, Jens Axboe ha > scritto: > > On 03/04/2017 09:01 AM, Paolo Valente wrote: >> @@ -6330,7 +7012,41 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, >> struct bfq_queue *bfqq, >> >> static void __bfq_insert_request(struct bfq_data

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Paolo Valente
> Il giorno 15 mar 2017, alle ore 17:30, Jens Axboe ha > scritto: > > On 03/15/2017 09:47 AM, Jens Axboe wrote: >> I think you understood me correctly. Currently I think the putting of >> the io context is somewhat of a mess. You have seemingly random places >> where you have

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Jens Axboe
On 03/04/2017 09:01 AM, Paolo Valente wrote: > @@ -6330,7 +7012,41 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, > struct bfq_queue *bfqq, > > static void __bfq_insert_request(struct bfq_data *bfqd, struct request *rq) > { > - struct bfq_queue *bfqq = RQ_BFQQ(rq); > + struct

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Ming Lei
On Thu, Mar 16, 2017 at 12:22:01AM +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 03:36:31PM +, Bart Van Assche wrote: > > OK, this race should only exist in case that the requeue happens after > dispatch > busy, because COMPLETE flag isn't set. And if the requeue is from io > completion,

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Jens Axboe
On 03/15/2017 09:47 AM, Jens Axboe wrote: > I think you understood me correctly. Currently I think the putting of > the io context is somewhat of a mess. You have seemingly random places > where you have to use special unlock functions, to ensure that you > notice that some caller deeper down has

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Ming Lei
On Wed, Mar 15, 2017 at 03:36:31PM +, Bart Van Assche wrote: > On Wed, 2017-03-15 at 20:40 +0800, Ming Lei wrote: > > On Wed, Mar 15, 2017 at 08:18:53PM +0800, Ming Lei wrote: > > > On Wed, Mar 15, 2017 at 12:07:37AM +, Bart Van Assche wrote: > > > > > > > or __blk_mq_requeue_request().

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Jens Axboe
On 03/15/2017 06:01 AM, Paolo Valente wrote: > >> Il giorno 07 mar 2017, alle ore 18:44, Jens Axboe ha >> scritto: >> >> On 03/04/2017 09:01 AM, Paolo Valente wrote: >>> @@ -560,6 +600,15 @@ struct bfq_data { >>> struct bfq_io_cq *bio_bic; >>> /* bfqq associated with

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Bart Van Assche
On Wed, 2017-03-15 at 20:40 +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 08:18:53PM +0800, Ming Lei wrote: > > On Wed, Mar 15, 2017 at 12:07:37AM +, Bart Van Assche wrote: > > > > > or __blk_mq_requeue_request(). Another issue with this function is that > > > the > > > >

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Yi Zhang
Thanks Ming. Tested-by: Yi Zhang Best Regards, Yi Zhang - Original Message - From: "Ming Lei" To: "Jens Axboe" , linux-ker...@vger.kernel.org, linux-block@vger.kernel.org, "Christoph Hellwig" Cc: "Yi

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Ming Lei
On Wed, Mar 15, 2017 at 08:18:53PM +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 12:07:37AM +, Bart Van Assche wrote: > > > or __blk_mq_requeue_request(). Another issue with this function is that the > > __blk_mq_requeue_request() can be run from two pathes: > > - dispatch failure,

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

2017-03-15 Thread Ming Lei
On Wed, Mar 15, 2017 at 12:07:37AM +, Bart Van Assche wrote: > On Thu, 2017-03-09 at 21:02 +0800, Ming Lei wrote: > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > index 159187a28d66..0aff380099d5 100644 > > --- a/block/blk-mq.c > > +++ b/block/blk-mq.c > > @@ -697,17 +697,8 @@ static void

Re: [PATCH RFC 10/14] block, bfq: add Early Queue Merge (EQM)

2017-03-15 Thread Paolo Valente
> Il giorno 07 mar 2017, alle ore 18:44, Jens Axboe ha > scritto: > > On 03/04/2017 09:01 AM, Paolo Valente wrote: >> @@ -560,6 +600,15 @@ struct bfq_data { >> struct bfq_io_cq *bio_bic; >> /* bfqq associated with the task issuing current bio for merging */ >>