[PATCH V2 3/3] blk-mq: dequeue request one by one from sw queue iff hctx is busy

2018-06-29 Thread Ming Lei
berman Cc: Omar Sandoval Cc: Christoph Hellwig Cc: Bart Van Assche Cc: Hannes Reinecke Reported-by: Kashyap Desai Signed-off-by: Ming Lei --- block/blk-mq-sched.c | 11 ++- block/blk-mq.c | 24 +++- include/linux/blk-mq.h | 1 + 3 files changed, 26

[PATCH V2 0/3] blk-mq: improve IO perf in case of none io sched

2018-06-29 Thread Ming Lei
1/3 Ming Lei (3): blk-mq: use list_splice_tail_init() to insert requests blk-mq: only attempt to merge bio if there is rq in sw queue blk-mq: dequeue request one by one from sw queue iff hctx is busy block/blk-mq-sched.c | 14 -- block/blk-mq.c |

[PATCH V2 2/3] blk-mq: only attempt to merge bio if there is rq in sw queue

2018-06-29 Thread Ming Lei
igned-off-by: Ming Lei --- block/blk-mq-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 56c493c6cd90..f5745acc2d98 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -339,7 +339,8 @@ bool __blk_mq_sched_

[PATCH V2 1/3] blk-mq: use list_splice_tail_init() to insert requests

2018-06-29 Thread Ming Lei
off-by: Ming Lei --- block/blk-mq.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 22fe394d0b49..359382b59d40 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1545,19 +1545,19 @@ void blk_mq_insert_requests(str

Re: [PATCH] blk-mq: don't queue more if we get a busy return

2018-06-28 Thread Ming Lei
On Thu, Jun 28, 2018 at 08:18:04PM -0600, Jens Axboe wrote: > On 6/28/18 7:59 PM, Ming Lei wrote: > > On Thu, Jun 28, 2018 at 09:46:50AM -0600, Jens Axboe wrote: > >> Some devices have different queue limits depending on the type of IO. A > >> classic case is SATA N

Re: [PATCH] blk-mq: don't queue more if we get a busy return

2018-06-28 Thread Ming Lei
On Thu, Jun 28, 2018 at 09:46:50AM -0600, Jens Axboe wrote: > Some devices have different queue limits depending on the type of IO. A > classic case is SATA NCQ, where some commands can queue, but others > cannot. If we have NCQ commands inflight and encounter a non-queueable > command, the driver

Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

2018-06-28 Thread Ming Lei
On Thu, Jun 28, 2018 at 11:21 PM, Bart Van Assche wrote: > On 06/27/18 17:30, Ming Lei wrote: >> >> One core idea of immutable bvec is to use bio->bi_iter and the original >> bvec table to iterate over anywhere in the bio. That is why .bi_io_vec >> needs to co

Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

2018-06-28 Thread Ming Lei
On Thu, Jun 28, 2018 at 09:53:23AM -0600, Jens Axboe wrote: > On 6/27/18 2:12 PM, Bart Van Assche wrote: > > Although __bio_clone_fast() copies bi_io_vec, it does not copy bi_vcnt, > > the number of elements in bi_io_vec[] that contains data. Copy bi_vcnt > > such that code that needs this member

Re: [PATCH 0/3] blk-mq: improve IO perf in case of none io sched

2018-06-28 Thread Ming Lei
On Thu, Jun 28, 2018 at 02:03:47PM +0800, jianchao.wang wrote: > > > On 06/28/2018 01:42 PM, Kashyap Desai wrote: > > Ming - > > > > Performance drop is resolved on my setup, but may be some stability of the > > kernel is caused due to this patch set. I have not tried without patch > > set, but

[PATCH 1/3] blk-mq: use list_splice_tail() to insert requests

2018-06-27 Thread Ming Lei
ted-by: Kashyap Desai Signed-off-by: Ming Lei --- block/blk-mq.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 70c65bb6c013..20b0519cb3b8 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1533,19 +1533,19 @@ v

[PATCH 2/3] blk-mq: only attempt to merge bio if there is rq in sw queue

2018-06-27 Thread Ming Lei
igned-off-by: Ming Lei --- block/blk-mq-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 56c493c6cd90..f5745acc2d98 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -339,7 +339,8 @@ bool __blk_mq_sched_

[PATCH 0/3] blk-mq: improve IO perf in case of none io sched

2018-06-27 Thread Ming Lei
Hi, The 1st 2 patch improves ctx->lock uses, and it is observed that IOPS may be improved by ~5% in rand IO test on MegaRaid SAS run by Kashyap. The 3rd patch fixes rand IO performance regression on MegaRaid SAS test, still reported by Kashyap. Ming Lei (3): blk-mq: use list_splice_t

Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

2018-06-27 Thread Ming Lei
On Wed, Jun 27, 2018 at 04:59:41PM -0700, Bart Van Assche wrote: > On 06/27/18 16:50, Ming Lei wrote: > > On Wed, Jun 27, 2018 at 01:12:31PM -0700, Bart Van Assche wrote: > > > Although __bio_clone_fast() copies bi_io_vec, it does not copy bi_vcnt, > > > the numb

Re: [PATCH] block: Simplify the bio cloning implementation

2018-06-27 Thread Ming Lei
On Wed, Jun 27, 2018 at 04:55:20PM -0700, Bart Van Assche wrote: > On 06/27/18 16:21, Ming Lei wrote: > > What we need to do is to only copy the 1st bvec for WRITE_SAME, your patch > > changes to copy (bio->bi_iter.bi_size / block size) bvecs, then memory > > corruption

Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

2018-06-27 Thread Ming Lei
original > and for cloned requests. > > Signed-off-by: Bart Van Assche > Cc: Christoph Hellwig > Cc: Mike Snitzer > Cc: Ming Lei > Cc: Hannes Reinecke > Cc: Johannes Thumshirn > --- > block/bio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/bio.c

Re: [PATCH] block: Fix cloning of requests with a special payload

2018-06-27 Thread Ming Lei
28/0x60d > irq_exit+0x100/0x110 > smp_call_function_single_interrupt+0x90/0x330 > call_function_single_interrupt+0xf/0x20 > > > Fixes: f9d03f96b988 ("block: improve handling of the magic discard payload") > Signed-off-by: Bart Van Assche > Cc: Christoph He

Re: [PATCH v2] blk-mq: Fix a race condition in blk_mq_mark_tag_wait()

2018-06-27 Thread Ming Lei
On Wed, Jun 27, 2018 at 01:02:12PM -0700, Bart Van Assche wrote: > Because the hctx lock is not held around the only > blk_mq_tag_wakeup_all() call in the block layer, the wait queue > entry removal in blk_mq_dispatch_wake() is protected by the wait > queue lock only. Since the hctx->dispatch_wait

Re: [PATCH] block: Simplify the bio cloning implementation

2018-06-27 Thread Ming Lei
On Wed, Jun 27, 2018 at 10:48:06AM -0700, Bart Van Assche wrote: > On 06/26/18 18:13, Ming Lei wrote: > > On Tue, Jun 26, 2018 at 03:26:24PM -0700, Bart Van Assche wrote: > > > There is no good reason to use different code paths for different > > > request operations. H

Re: [PATCH] block: Simplify the bio cloning implementation

2018-06-26 Thread Ming Lei
On Tue, Jun 26, 2018 at 03:26:24PM -0700, Bart Van Assche wrote: > There is no good reason to use different code paths for different > request operations. Hence remove the switch/case statement from > bio_clone_bioset(). > > Signed-off-by: Bart Van Assche > Cc: Christoph Hellw

Re: [PATCH blktests 00/15] Add SRP initiator driver tests

2018-06-25 Thread Ming Lei
On Mon, Jun 25, 2018 at 10:05:41AM -0700, Bart Van Assche wrote: > On 06/22/18 20:15, Ming Lei wrote: > > Just tried srp/001 > > > > [root@ktest-04 blktests]# ./check srp/001 > > srp/001 (Create and remove LUNs) [failed] > >

[PATCH 4/5] blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set()

2018-06-25 Thread Ming Lei
org Reported-by: Andrew Jones Cc: Andrew Jones Signed-off-by: Ming Lei --- block/blk-mq-sched.c | 85 +++--- block/blk-mq.c | 10 ++ include/linux/blkdev.h | 2 -- 3 files changed, 7 insertions(+), 90 deletions(-) diff --git a/block/blk-mq

[PATCH 5/5] blk-mq: avoid to synchronize rcu inside blk_cleanup_queue()

2018-06-25 Thread Ming Lei
Jones Cc: Omar Sandoval Cc: Andrew Jones Cc: Bart Van Assche Cc: linux-s...@vger.kernel.org Cc: "Martin K. Petersen" Cc: Christoph Hellwig Signed-off-by: Ming Lei --- block/blk-core.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/blk-core.c b/bl

[PATCH 3/5] blk-mq: introduce new lock for protecting hctx->dispatch_wait

2018-06-25 Thread Ming Lei
drew Jones Cc: Christoph Hellwig Cc: Omar Sandoval Cc: Bart Van Assche Signed-off-by: Ming Lei --- block/blk-mq.c | 26 +- include/linux/blk-mq.h | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index d

[PATCH 2/5] blk-mq: don't pass **hctx to blk_mq_mark_tag_wait()

2018-06-25 Thread Ming Lei
'hctx' won't be changed at all, so not necessary to pass '**hctx' to blk_mq_mark_tag_wait(). Cc: Andrew Jones Cc: Christoph Hellwig Cc: Omar Sandoval Cc: Bart Van Assche Signed-off-by: Ming Lei --- block/blk-mq.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions

[PATCH 1/5] blk-mq: cleanup blk_mq_get_driver_tag()

2018-06-25 Thread Ming Lei
We never pass 'wait' as true to blk_mq_get_driver_tag(), then won't get new hctx passed out. So cleanup the usage and remove the two extra parameters. Cc: Omar Sandoval Cc: Andrew Jones Cc: Bart Van Assche Cc: Christoph Hellwig Signed-off-by: Ming Lei --- block/blk-mq.c | 19

Re: [PATCH blktests 00/15] Add SRP initiator driver tests

2018-06-22 Thread Ming Lei
On Sat, Jun 23, 2018 at 11:14 AM, Ming Lei wrote: > On Sat, Jun 23, 2018 at 6:19 AM, Bart Van Assche > wrote: >> Hello Omar, >> >> As promised during LSF/MM, I have converted the srp-tests software to the >> blktests framework. This patch series included all blk

Re: [PATCH blktests 00/15] Add SRP initiator driver tests

2018-06-22 Thread Ming Lei
-Unloaded the ib_srpt kernel module +Unloaded the ib_srp kernel module +modprobe: FATAL: Module target_core_mod is in use. +modprobe: FATAL: Module target_core_mod is in use. +modprobe: FATAL: Module target_core_mod is in use. +modprobe: FATAL: Module target_core_mod is in use. +modprobe: FATAL: Module target_core_mod is in use. ... (Run 'diff -u tests/srp/001.out results/nodev/srp/001.out.bad' to see the entire diff) [root@ktest-04 blktests]# lsmod | grep target iscsi_target_mod 303104 1 ib_isert target_core_mod 356352 2 iscsi_target_mod,ib_isert Thanks, Ming Lei

Re: [PATCH] blk-wbt: fix indefinite background writeback sleep

2018-06-22 Thread Ming Lei
On Fri, Jun 22, 2018 at 05:13:31PM -0600, Jens Axboe wrote: > On 6/22/18 5:11 PM, Ming Lei wrote: > > On Fri, Jun 22, 2018 at 04:51:26PM -0600, Jens Axboe wrote: > >> On 6/22/18 4:43 PM, Ming Lei wrote: > >>> On Fri, Jun 22, 2018 at 01:26:10PM -0600, Jens Axboe wrot

Re: [PATCH] blk-wbt: fix indefinite background writeback sleep

2018-06-22 Thread Ming Lei
On Fri, Jun 22, 2018 at 04:51:26PM -0600, Jens Axboe wrote: > On 6/22/18 4:43 PM, Ming Lei wrote: > > On Fri, Jun 22, 2018 at 01:26:10PM -0600, Jens Axboe wrote: > >> blk-wbt adds waiters to the tail of the waitqueue, and factors in the > >> task placement in its

Re: [PATCH] blk-wbt: fix indefinite background writeback sleep

2018-06-22 Thread Ming Lei
On Fri, Jun 22, 2018 at 01:26:10PM -0600, Jens Axboe wrote: > blk-wbt adds waiters to the tail of the waitqueue, and factors in the > task placement in its decision making on whether or not the current task > can proceed. This can cause issues for the lowest class of writers, > since they can get

Re: [RFC] cleanup bcache bio handling

2018-06-13 Thread Ming Lei
On Wed, Jun 13, 2018 at 10:54:09AM -0400, Kent Overstreet wrote: > On Wed, Jun 13, 2018 at 03:56:32PM +0200, Christoph Hellwig wrote: > > On Wed, Jun 13, 2018 at 07:06:41PM +0800, Ming Lei wrote: > > > > before bio_alloc_pages) that can be switched to something that

Re: [RFC] cleanup bcache bio handling

2018-06-13 Thread Ming Lei
On Wed, Jun 13, 2018 at 05:58:01AM -0400, Kent Overstreet wrote: > On Mon, Jun 11, 2018 at 09:48:00PM +0200, Christoph Hellwig wrote: > > Hi all, > > > > this series cleans up various places where bcache is way too intimate > > with bio internals. This is intended as a baseline for the

Re: Regarding the recent new blk-mq timeout handling

2018-06-12 Thread Ming Lei
ld avoid the request tag to be released and life-recycle, but not > completion. > > For the scsi mid-layer, what if a request is in error handler and normal > completion come > at the moment ? Per my understanding, now the protection needs to be done completely by driver. Thanks, Ming Lei

Re: [PATCH 1/1] blk-mq: reinit q->tag_set_list entry only after grace period

2018-06-11 Thread Ming Lei
ach_entry_rcu_rr(), thus soft lockup. > > Fix is simple: reinit list entry after an RCU grace period elapsed. > > Signed-off-by: Roman Pen > Cc: Jens Axboe > Cc: Bart Van Assche > Cc: Christoph Hellwig > Cc: Sagi Grimberg > Cc: Ming Lei > Cc: linux-block@vger.ker

Re: [PATCH 3/3] block: use bio_add_page in bio_iov_iter_get_pages

2018-06-04 Thread Ming Lei
On Tue, Jun 05, 2018 at 11:41:19AM +0800, Ming Lei wrote: > On Mon, Jun 04, 2018 at 03:58:53PM +0200, Christoph Hellwig wrote: > > Replace a nasty hack with a different nasty hack to prepare for multipage > > bio_vecs. By moving the temporary page array as far up as possible i

Re: [PATCH 3/3] block: use bio_add_page in bio_iov_iter_get_pages

2018-06-04 Thread Ming Lei
ffset; > - bv[0].bv_len -= offset; > - if (diff) > - bv[bio->bi_vcnt - 1].bv_len -= diff; > + len = min_t(size_t, PAGE_SIZE - offset, left); > + if (WARN_ON_ONCE(bio_add_page(bio, page, len, offset) != len)) > + return -EINVAL; > + offset = 0; > + } One invariant is that the page index 'i' is always <= bvec index of the added page, and the two can only be same when adding the last page. So this approach is correct and looks smart & clean: Reviewed-by: Ming Lei Thanks, Ming

Re: [PATCH 2/3] block: bio_set_pages_dirty can't see NULL bv_page in a valid bio_vec

2018-06-04 Thread Ming Lei
> - > - if (page && !PageCompound(page)) > - set_page_dirty_lock(page); > + if (!PageCompound(bvec->bv_page)) > + set_page_dirty_lock(bvec->bv_page); > } > } Looks reasonable: Reviewed-by: Ming Lei Thanks, Ming

Re: [PATCH 1/3] block: simplify bio_check_pages_dirty

2018-06-04 Thread Ming Lei
> + bio_put(bio); > + return; > +defer: > + spin_lock_irqsave(_dirty_lock, flags); > + bio->bi_private = bio_dirty_list; > + bio_dirty_list = bio; > + spin_unlock_irqrestore(_dirty_lock, flags); > + schedule_work(_dirty_work); > } > > void generic_start_io_acct(struct request_queue *q, int rw, It is good simplification, and the only effect may be some pages which will be freed a bit late in partial clean case. I have run fio randread on null_blk in a 512M ram fedora 27 cloud image based VM, not see IOPS drop, so: Tested-by: Ming Lei Reviewed-by: Ming Lei Thanks, Ming

[PATCH] blk-mq: update nr_requests when switching to 'none' scheduler

2018-06-02 Thread Ming Lei
Now we setup q->nr_requests when switching to one new scheduler, but not do it for 'none', then q->nr_requests may not be correct for 'none'. This patch fixes this issue by always updating 'nr_requests' when switching to 'none'. Cc: Marco Patalano Cc: "Ewan D. Milne" Signed-

Re: [PATCH] blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler

2018-06-02 Thread Ming Lei
On Sat, Jun 02, 2018 at 12:59:21PM +0800, Ming Lei wrote: > If the current io scheduler is 'none', the max allowed 'nr_requests' > should be from set->queue_depth, instead of the tags's depth, which > can be adjusted before. > > This patch fixes this issue by using set->q

[PATCH] block/021: test setting 'nr_requests'

2018-06-01 Thread Ming Lei
Milne" Signed-off-by: Ming Lei --- tests/block/021 | 51 +++ tests/block/021.out | 2 ++ 2 files changed, 53 insertions(+) create mode 100755 tests/block/021 create mode 100755 tests/block/021.out diff --git a/tests/block/021 b/tests/block/02

[PATCH] blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler

2018-06-01 Thread Ming Lei
switching to 'none' scheduler. Cc: Marco Patalano Cc: "Ewan D. Milne" Signed-off-by: Ming Lei --- This issue can be reproduced by the blktests block/021, which will be posted soon. block/blk-mq-sched.c | 1 + block/blk-mq-tag.c | 6 -- 2 files changed, 5 insertions(+), 2 delet

Re: [bug report] IO blocked after offline CPU during fio on nvme SSD

2018-05-30 Thread Ming Lei
806] RSP: 002b:7f42ba98ab60 EFLAGS: 0293 ORIG_RAX: > 0012 > [ 370.056260] RAX: ffda RBX: 7f429400cd40 RCX: > 7f42e0955073 > [ 370.064229] RDX: 00006400 RSI: 7f4294001000 RDI: > 002c > [ 370.072197] RBP: 7f42bf1add40 R08: 03e0 R09: > 0005 > [ 370.080164] R10: 0030c362a400 R11: 0293 R12: > 0001 > [ 370.088132] R13: 6400 R14: 7f429400cd68 R15: > 7f42bf1add48 > That is exactly the issue triggered by block/011, and I guess Keith is working V4 fix: http://lists.infradead.org/pipermail/linux-nvme/2018-May/017813.html Thanks, Ming Lei

[PATCH] block/020: not pass shared_tags to null_blk

2018-05-29 Thread Ming Lei
The issue isn't related with shared tag, and it can be triggered in case 'shared_tags' is set as 0. Remove this so that this test can be run in older kernel, and avoid to cause misunderstanding. Signed-off-by: Ming Lei --- tests/block/020 | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH 03/14] nvme: return BLK_EH_DONE from ->timeout

2018-05-28 Thread Ming Lei
On Mon, May 28, 2018 at 01:44:25PM +0200, Christoph Hellwig wrote: > On Thu, May 24, 2018 at 12:45:15PM +0800, Ming Lei wrote: > > This change should have been done after '[PATCH 13/14] blk-mq: Remove > > generation seqeunce', otherwise the timed-out request won

Re: [RESEND PATCH V5 00/33] block: support multipage bvec

2018-05-27 Thread Ming Lei
On Fri, May 25, 2018 at 10:30:46AM -0600, Jens Axboe wrote: > On 5/24/18 10:53 PM, Kent Overstreet wrote: > > On Fri, May 25, 2018 at 11:45:48AM +0800, Ming Lei wrote: > >> Hi, > >> > >> This patchset brings multipage bvec into block layer: > > > &g

[RESEND PATCH V5 01/33] block: rename bio_for_each_segment* with bio_for_each_page*

2018-05-24 Thread Ming Lei
bvec is in, each bvec will store a real multipage segment, so people won't be confused with these wrong names. Signed-off-by: Ming Lei <ming@redhat.com> --- Documentation/block/biovecs.txt | 4 ++-- arch/m68k/emu/nfblock.c | 2 +- arch/xtensa/platforms/iss/simdisk.

[RESEND PATCH V5 02/33] block: rename rq_for_each_segment as rq_for_each_page

2018-05-24 Thread Ming Lei
rq_for_each_segment() still deceives us since this helper only returns one page in each bvec, so fixes its name. Signed-off-by: Ming Lei <ming@redhat.com> --- Documentation/block/biodoc.txt | 6 +++--- block/blk-core.c | 2 +- drivers/block/floppy.c | 4 ++-- d

[RESEND PATCH V5 15/33] block: introduce bio_clone_seg_bioset()

2018-05-24 Thread Ming Lei
There is one use case(DM) which requires to clone bio segment by segement, so introduce this API. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 56 +++-- include/linux/bio.h | 1 + 2 files changed, 43 insertions(

[RESEND PATCH V5 06/33] block: use bio_for_each_segment() to compute segments count

2018-05-24 Thread Ming Lei
max segment size, so we have to split the big bvec into several segments. Thirdly during splitting multipage bvec into segments, max segment number may be reached, then the bio need to be splitted when this happens. Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-merge.

[RESEND PATCH V5 14/33] block: loop: pass segments to iov_iter

2018-05-24 Thread Ming Lei
iov_iter is implemented with bvec itererator, so it is safe to pass segment to it, and this way is much more efficient than passing one page in each bvec. Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

[RESEND PATCH V5 13/33] block: introduce rq_for_each_segment()

2018-05-24 Thread Ming Lei
There are still cases in which rq_for_each_segment() is required, for example, loop. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/blkdev.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1e8e9b430008..0b15bc

[RESEND PATCH V5 16/33] dm: clone bio via bio_clone_seg_bioset

2018-05-24 Thread Ming Lei
multipage bio. Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f1db181e082e..425e99e20f5c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1581,8 +1581,8 @@

[RESEND PATCH V5 08/33] block: introduce segment_last_page()

2018-05-24 Thread Ming Lei
BTRFS and guard_bio_eod() need to get the last page from one segment, so introduce this helper to make them happy. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bvec.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/include/linux/bvec.h b/i

[RESEND PATCH V5 04/33] block: introduce multipage page bvec helpers

2018-05-24 Thread Ming Lei
current bvec iterator which is thought as singlepage only by drivers, fs, dm and etc. These helpers will build singlepage bvec in flight, so users of current bio/bvec iterator still can work well and needn't change even though we store real multipage segment into bvec table. Signed-off-by: Ming Lei

[RESEND PATCH V5 05/33] block: introduce bio_for_each_segment()

2018-05-24 Thread Ming Lei
This helper is used to iterate multipage bvec for bio spliting/merge, and it is required in bio_clone_bioset() too, so introduce it. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 34 +++--- include/linux/bvec.

[RESEND PATCH V5 17/33] block: bio: introduce bio_for_each_page_all2 and bio_for_each_segment_all

2018-05-24 Thread Ming Lei
table directly, and users should be carful about this helper since it returns real multipage segment now. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 18 ++ include/linux/bvec.h | 6 ++ 2 files changed, 24 insertions(+) diff --git a/include

[RESEND PATCH V5 20/33] md/dm/bcache: conver to bio_for_each_page_all2 and bio_for_each_segment

2018-05-24 Thread Ming Lei
we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/bcache/btree.c | 3 ++- drivers/md/bcache/util.c | 2 +- drivers/md/dm-crypt.c | 3 ++- drivers/md/raid1.c| 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff

[RESEND PATCH V5 19/33] block: convert to bio_for_each_page_all2()

2018-05-24 Thread Ming Lei
We have to convert to bio_for_each_page_all2() for iterating page by page. bio_for_each_page_all() can't be used any more after multipage bvec is enabled. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 18 -- block/blk-zoned.c | 5 +++--

[RESEND PATCH V5 18/33] block: deal with dirtying pages for multipage bvec

2018-05-24 Thread Ming Lei
ase all these pages if all are dirtied, otherwise dirty them all in deferred wrokqueue. This patch introduces segment_for_each_page_all() to deal with the case a bit easier. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 45 +

[RESEND PATCH V5 22/33] btrfs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/btrfs/compression.c | 3 ++- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/extent_io.c | 9 ++--- fs

[RESEND PATCH V5 25/33] xfs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Given bvec can't be changed under bio_for_each_page_all2(), this patch marks the bvec parameter as 'const' for xfs_finish_page_writeback(). Signed-off-by: Ming Lei

[RESEND PATCH V5 26/33] exofs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/exofs/ore.c | 3 ++- fs/exofs/ore_raid.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)

[RESEND PATCH V5 24/33] f2fs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/f2fs/data.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.

[RESEND PATCH V5 31/33] block: bio: pass segments to bio if bio_add_page() is bypassed

2018-05-24 Thread Ming Lei
Under some situations, such as block direct I/O, we can't use bio_add_page() for merging pages into multipage bvec, so a new function is implemented for converting page array into one segment array, then these cases can benefit from multipage bvec too. Signed-off-by: Ming Lei <ming@redhat.

[RESEND PATCH V5 30/33] block: enable multipage bvecs

2018-05-24 Thread Ming Lei
This patch pulls the trigger for multipage bvecs. Now any request queue which supports queue cluster will see multipage bvecs. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c

[RESEND PATCH V5 29/33] block: rename bio_for_each_page_all2 as bio_for_each_page_all

2018-05-24 Thread Ming Lei
Now bio_for_each_page_all() is gone, we can reuse the name to iterate bio page by page, which is done via bio_for_each_page_all2() now. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 14 +++--- block/blk-zoned.c | 4 ++-- block/bo

[RESEND PATCH V5 28/33] block: kill bio_for_each_page_all()

2018-05-24 Thread Ming Lei
No one uses it any more, so kill it and we can reuse this helper name. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 5ae2bc876295..c5e692

[RESEND PATCH V5 33/33] block: document usage of bio iterator helpers

2018-05-24 Thread Ming Lei
Now multipage bvec is supported, and some helpers may return page by page, and some may return segment by segment, this patch documents the usage for helping us use them correctly. Signed-off-by: Ming Lei <ming@redhat.com> --- Documentation/block/biovecs.tx

[RESEND PATCH V5 32/33] block: always define BIO_MAX_PAGES as 256

2018-05-24 Thread Ming Lei
Now multipage bvec can cover CONFIG_THP_SWAP, so we don't need to increase BIO_MAX_PAGES for it. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 8 1 file changed, 8 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index fc8a82

[RESEND PATCH V5 23/33] ext4: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/ext4/page-io.c | 3 ++- fs/ext4/readpage.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)

[RESEND PATCH V5 11/33] block: implement bio_pages_all() via bio_for_each_page_all()

2018-05-24 Thread Ming Lei
As multipage bvec will be enabled soon, bio->bi_vcnt isn't same with page count in the bio any more, so use bio_for_each_page_all() to compute the number. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion

[RESEND PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
Preparing for supporting multipage bvec. Cc: Chris Mason <c...@fb.com> Cc: Josef Bacik <jba...@fb.com> Cc: David Sterba <dste...@suse.com> Cc: linux-bt...@vger.kernel.org Signed-off-by: Ming Lei <ming@redhat.com> --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_i

[RESEND PATCH V5 07/33] block: use bio_for_each_segment() to map sg

2018-05-24 Thread Ming Lei
It is more efficient to use bio_for_each_segment() to map sg, meantime we have to consider splitting multipage bvec as done in blk_bio_segment_split(). Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-merge.c | 72 +++ 1 file c

[RESEND PATCH V5 00/33] block: support multipage bvec

2018-05-24 Thread Ming Lei
://marc.info/?t=14982021534=1=2 Ming Lei (33): block: rename bio_for_each_segment* with bio_for_each_page* block: rename rq_for_each_segment as rq_for_each_page block: rename bio_segments() with bio_pages() block: introduce multipage page bvec helpers block: introduce

Re: [PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
On Thu, May 24, 2018 at 11:44:41PM +0200, David Sterba wrote: > On Thu, May 24, 2018 at 05:01:15PM +0800, Ming Lei wrote: > > Preparing for supporting multipage bvec. > > Could you please also CC the cover letter so we have a chance to learn > what multipage bvec means or wh

[PATCH V5 31/33] block: bio: pass segments to bio if bio_add_page() is bypassed

2018-05-24 Thread Ming Lei
Under some situations, such as block direct I/O, we can't use bio_add_page() for merging pages into multipage bvec, so a new function is implemented for converting page array into one segment array, then these cases can benefit from multipage bvec too. Signed-off-by: Ming Lei <ming@redhat.

[PATCH V5 32/33] block: always define BIO_MAX_PAGES as 256

2018-05-24 Thread Ming Lei
Now multipage bvec can cover CONFIG_THP_SWAP, so we don't need to increase BIO_MAX_PAGES for it. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 8 1 file changed, 8 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index fc8a82

[PATCH V5 33/33] block: document usage of bio iterator helpers

2018-05-24 Thread Ming Lei
Now multipage bvec is supported, and some helpers may return page by page, and some may return segment by segment, this patch documents the usage for helping us use them correctly. Signed-off-by: Ming Lei <ming@redhat.com> --- Documentation/block/biovecs.tx

[PATCH V5 30/33] block: enable multipage bvecs

2018-05-24 Thread Ming Lei
This patch pulls the trigger for multipage bvecs. Now any request queue which supports queue cluster will see multipage bvecs. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c

[PATCH V5 27/33] gfs2: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Given bvec can't be changed inside bio_for_each_page_all2(), this patch marks the bvec parameter as 'const' for gfs2_end_log_write_bh(). Signed-off-by: Ming Lei

[PATCH V5 29/33] block: rename bio_for_each_page_all2 as bio_for_each_page_all

2018-05-24 Thread Ming Lei
Now bio_for_each_page_all() is gone, we can reuse the name to iterate bio page by page, which is done via bio_for_each_page_all2() now. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 14 +++--- block/blk-zoned.c | 4 ++-- block/bo

[PATCH V5 26/33] exofs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/exofs/ore.c | 3 ++- fs/exofs/ore_raid.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)

[PATCH V5 28/33] block: kill bio_for_each_page_all()

2018-05-24 Thread Ming Lei
No one uses it any more, so kill it and we can reuse this helper name. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 5ae2bc876295..c5e692

[PATCH V5 25/33] xfs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Given bvec can't be changed under bio_for_each_page_all2(), this patch marks the bvec parameter as 'const' for xfs_finish_page_writeback(). Signed-off-by: Ming Lei

[PATCH V5 24/33] f2fs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/f2fs/data.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.

[PATCH V5 22/33] btrfs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/btrfs/compression.c | 3 ++- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/extent_io.c | 9 ++--- fs

[PATCH V5 23/33] ext4: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/ext4/page-io.c | 3 ++- fs/ext4/readpage.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)

[PATCH V5 21/33] fs: conver to bio_for_each_page_all2

2018-05-24 Thread Ming Lei
bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- fs/block_dev.c | 6 -- fs/crypto/bio.c | 3 ++- fs/direct-io.c | 4 +++- fs/iomap.c | 3 ++- fs/m

[PATCH V5 19/33] block: convert to bio_for_each_page_all2()

2018-05-24 Thread Ming Lei
We have to convert to bio_for_each_page_all2() for iterating page by page. bio_for_each_page_all() can't be used any more after multipage bvec is enabled. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 18 -- block/blk-zoned.c | 5 +++--

[PATCH V5 20/33] md/dm/bcache: conver to bio_for_each_page_all2 and bio_for_each_segment

2018-05-24 Thread Ming Lei
we have to convert to bio_for_each_page_all2(). Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/bcache/btree.c | 3 ++- drivers/md/bcache/util.c | 2 +- drivers/md/dm-crypt.c | 3 ++- drivers/md/raid1.c| 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff

[PATCH V5 16/33] dm: clone bio via bio_clone_seg_bioset

2018-05-24 Thread Ming Lei
multipage bio. Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f1db181e082e..425e99e20f5c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1581,8 +1581,8 @@

[PATCH V5 17/33] block: bio: introduce bio_for_each_page_all2 and bio_for_each_segment_all

2018-05-24 Thread Ming Lei
table directly, and users should be carful about this helper since it returns real multipage segment now. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 18 ++ include/linux/bvec.h | 6 ++ 2 files changed, 24 insertions(+) diff --git a/include

[PATCH V5 18/33] block: deal with dirtying pages for multipage bvec

2018-05-24 Thread Ming Lei
ase all these pages if all are dirtied, otherwise dirty them all in deferred wrokqueue. This patch introduces segment_for_each_page_all() to deal with the case a bit easier. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 45 +

[PATCH V5 15/33] block: introduce bio_clone_seg_bioset()

2018-05-24 Thread Ming Lei
There is one use case(DM) which requires to clone bio segment by segement, so introduce this API. Signed-off-by: Ming Lei <ming@redhat.com> --- block/bio.c | 56 +++-- include/linux/bio.h | 1 + 2 files changed, 43 insertions(

[PATCH V5 14/33] block: loop: pass segments to iov_iter

2018-05-24 Thread Ming Lei
iov_iter is implemented with bvec itererator, so it is safe to pass segment to it, and this way is much more efficient than passing one page in each bvec. Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

[PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
Preparing for supporting multipage bvec. Cc: Chris Mason <c...@fb.com> Cc: Josef Bacik <jba...@fb.com> Cc: David Sterba <dste...@suse.com> Cc: linux-bt...@vger.kernel.org Signed-off-by: Ming Lei <ming@redhat.com> --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_i

[PATCH V5 13/33] block: introduce rq_for_each_segment()

2018-05-24 Thread Ming Lei
There are still cases in which rq_for_each_segment() is required, for example, loop. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/blkdev.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1e8e9b430008..0b15bc

[PATCH V5 11/33] block: implement bio_pages_all() via bio_for_each_page_all()

2018-05-24 Thread Ming Lei
As multipage bvec will be enabled soon, bio->bi_vcnt isn't same with page count in the bio any more, so use bio_for_each_page_all() to compute the number. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion

[PATCH V5 12/33] block: introduce bio_segments()

2018-05-24 Thread Ming Lei
There are still cases in which we need to use bio_segments() for get the number of segment, so introduce it. Signed-off-by: Ming Lei <ming@redhat.com> --- include/linux/bio.h | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/include/linux/b

<    1   2   3   4   5   6   7   8   9   10   >