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

2018-05-24 Thread Kent Overstreet
On Fri, May 25, 2018 at 11:45:48AM +0800, Ming Lei wrote: > Hi, > > This patchset brings multipage bvec into block layer: patch series looks sane to me. goddamn that's a lot of renaming. Things are going to get interesting when we start sticking compound pages in the page cache, there'll be

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

2018-05-24 Thread Kent Overstreet
On Fri, May 25, 2018 at 11:46:00AM +0800, Ming Lei wrote: > 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 > --- > include/linux/bio.h | 25 - > 1 file

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

2018-05-24 Thread Ming Lei
It is a tree-wide mechanical replacement since both bio_for_each_segment() and bio_for_each_segment_all() never returns real segment at all, and both just return one page per bvec and deceive us for long time, so fix their names. This is a pre-patch for supporting multipage bvec. Once multipage

[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 --- Documentation/block/biodoc.txt | 6 +++--- block/blk-core.c | 2 +- drivers/block/floppy.c | 4 ++--

[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 --- block/bio.c | 56 +++-- include/linux/bio.h | 1 + 2 files changed, 43 insertions(+), 14

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

2018-05-24 Thread Ming Lei
Firstly it is more efficient to use bio_for_each_segment() in both blk_bio_segment_split() and __blk_recalc_rq_segments() to compute how many segments there are in the bio. Secondaly once bio_for_each_segment() is used, the bvec may need to be splitted because its length can be very longer than

[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 --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[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 --- include/linux/blkdev.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1e8e9b430008..0b15bc625bd7

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

2018-05-24 Thread Ming Lei
The incoming bio will become very big after multipage bvec is enabled, so we can't clone bio page by page. This patch uses the introduced bio_clone_seg_bioset(), so the incoming bio can be cloned successfully. This way is safe because device mapping won't modify the bio vector on the cloned

[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 --- include/linux/bvec.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/include/linux/bvec.h

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

2018-05-24 Thread Ming Lei
This patch introduces helpers of 'bvec_iter_segment_*' for multipage bvec(segment) support. The introduced interfaces treate one bvec as real multipage segment, for example, .bv_len is the total length of the multipage segment. The existed helpers of bvec_iter_* are interfaces for supporting

[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 --- include/linux/bio.h | 34 +++--- include/linux/bvec.h | 36

[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
This patch introduces bio_for_each_page_all2(), which is for replacing bio_for_each_page_all() in case that the returned bvec has to be single page bvec. Given the interface type has to be changed for passing one local iterator variable of 'bvec_iter_all', and doing all changes in one single

[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
In bch_bio_alloc_pages(), bio_for_each_segment() is fine because this helper can only be used on a freshly new bio. For other cases, we conver to bio_for_each_page_all2() since they needn't to update bvec table. bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so

[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 --- 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
In bio_check_pages_dirty(), bvec->bv_page is used as flag for marking if the page has been dirtied & released, and if no, it will be dirtied in deferred workqueue. With multipage bvec, we can't do that any more, so change the logic into checking all pages in one mp bvec, and only release all

[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 --- fs/btrfs/compression.c | 3 ++- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/extent_io.c | 9 ++---

[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 --- fs/exofs/ore.c | 3 ++- fs/exofs/ore_raid.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[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 --- fs/f2fs/data.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.c

[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

[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 --- block/bio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c index

[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 --- block/bio.c | 14 +++--- block/blk-zoned.c | 4 ++-- block/bounce.c

[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 --- 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..c5e692d43f23

[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 --- Documentation/block/biovecs.txt | 32

[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 --- include/linux/bio.h | 8 1 file changed, 8 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index

[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 --- fs/ext4/page-io.c | 3 ++- fs/ext4/readpage.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[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 --- include/linux/bio.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[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 Cc: Josef Bacik Cc: David Sterba Cc: linux-bt...@vger.kernel.org Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_io.c | 5 +++-- 2 files

[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 --- block/blk-merge.c | 72 +++ 1 file

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

2018-05-24 Thread Ming Lei
Hi, This patchset brings multipage bvec into block layer: 1) what is multipage bvec? Multipage bvecs means that one 'struct bio_bvec' can hold multiple pages which are physically contiguous instead of one single page used in linux kernel for long time. 2) why is multipage bvec introduced?

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 what are the changes

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

2018-05-24 Thread David Sterba
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 what are the changes between the iterations? I found it in the archives, but a copy to

Re: [PATCH] block drivers/block: Use octal not symbolic permissions

2018-05-24 Thread Jens Axboe
On 5/24/18 7:01 AM, Joe Perches wrote: > On Thu, 2018-05-24 at 06:47 -0600, Jens Axboe wrote: >> On 5/23/18 4:35 PM, Joe Perches wrote: >>> On Wed, 2018-05-23 at 15:27 -0600, Jens Axboe wrote: On 5/23/18 2:05 PM, Joe Perches wrote: > Convert the S_ symbolic permissions to their octal

Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI

2018-05-24 Thread Kees Cook
On Thu, May 24, 2018 at 1:00 AM, Christoph Hellwig wrote: > On Wed, May 23, 2018 at 03:14:19PM -0600, Jens Axboe wrote: >> Ugh, so that would necessitate a change there too. As I said before, >> I don't really care where it lives. I know the SCSI folks seem bothered >> by

Re: [PATCH V4] blk-mq: avoid to starve tag allocation after allocation process migrates

2018-05-24 Thread Jens Axboe
On 5/24/18 10:52 AM, Omar Sandoval wrote: > On Thu, May 24, 2018 at 03:49:10PM +0800, Ming Lei wrote: >> When the allocation process is scheduled back and the mapped hw queue is >> changed, fake one extra wake up on previous queue for compensating wake up >> miss, so other allocations on the

Re: [PATCH V4] blk-mq: avoid to starve tag allocation after allocation process migrates

2018-05-24 Thread Omar Sandoval
On Thu, May 24, 2018 at 03:49:10PM +0800, Ming Lei wrote: > When the allocation process is scheduled back and the mapped hw queue is > changed, fake one extra wake up on previous queue for compensating wake up > miss, so other allocations on the previous queue won't be starved. > > This patch

Re: [PATCH V6 02/11] nvme: pci: cover timeout for admin commands running in EH

2018-05-24 Thread Keith Busch
On Wed, May 16, 2018 at 12:03:04PM +0800, Ming Lei wrote: > +static void nvme_set_host_mem_end_io(struct request *rq, blk_status_t sts) > +{ > + struct completion *waiting = rq->end_io_data; > + > + rq->end_io_data = NULL; > + blk_mq_free_request(rq); > + > + /* > + * complete

[PATCH] lightnvm: pblk: sync RB and RL states during GC

2018-05-24 Thread Igor Konopko
During sequential workloads we can met the case when almost all the lines are fully written with data. In that case rate limiter will significantly reduce the max number of requests for user IOs. Unfortunately in the case when round buffer is flushed to drive and the entries are not yet removed

Re: [PATCH] block drivers/block: Use octal not symbolic permissions

2018-05-24 Thread Joe Perches
On Thu, 2018-05-24 at 06:47 -0600, Jens Axboe wrote: > On 5/23/18 4:35 PM, Joe Perches wrote: > > On Wed, 2018-05-23 at 15:27 -0600, Jens Axboe wrote: > > > On 5/23/18 2:05 PM, Joe Perches wrote: > > > > Convert the S_ symbolic permissions to their octal equivalents as > > > > using octal and not

[GIT PULL] Two block related fixes for 4.17-rc

2018-05-24 Thread Jens Axboe
Hi Linus, Two fixes that should go into this release: - A loop writeback error clearing fix from Jeff. - The sr sense fix from myself. Please pull! git://git.kernel.dk/linux-block.git tags/for-linus-20180524 Jeff Layton (1

[PATCH v2] lightnvm: pblk: add possibility to set write buffer size manually

2018-05-24 Thread Marcin Dziegielewski
In some cases, users can want set write buffer size manually, e.g. to adjust it to specific workload. This patch provides the possibility to set write buffer size via module parameter feature. Signed-off-by: Marcin Dziegielewski Signed-off-by: Igor Konopko

Re: [PATCH] block drivers/block: Use octal not symbolic permissions

2018-05-24 Thread Jens Axboe
On 5/23/18 4:35 PM, Joe Perches wrote: > On Wed, 2018-05-23 at 15:27 -0600, Jens Axboe wrote: >> On 5/23/18 2:05 PM, Joe Perches wrote: >>> Convert the S_ symbolic permissions to their octal equivalents as >>> using octal and not symbolic permissions is preferred by many as more >>> readable. >>>

RE: [PATCH 1/2] lightnvm: pblk: add possibility to set write buffer size manually

2018-05-24 Thread Dziegielewski, Marcin
Thanks for the review, that’s good point. Improved patch is on its way. Marcin Dzięgielewski > -Original Message- > From: Matias Bjørling [mailto:m...@lightnvm.io] > Sent: Thursday, May 24, 2018 10:20 AM > To: Dziegielewski, Marcin > Cc:

[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

[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 --- include/linux/bio.h | 8 1 file changed, 8 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index

[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 --- Documentation/block/biovecs.txt | 32

[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 --- block/bio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c index

[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 --- block/bio.c | 14 +++--- block/blk-zoned.c | 4 ++-- block/bounce.c

[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 --- fs/exofs/ore.c | 3 ++- fs/exofs/ore_raid.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[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 --- 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..c5e692d43f23

[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 --- fs/f2fs/data.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.c

[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 --- fs/btrfs/compression.c | 3 ++- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/extent_io.c | 9 ++---

[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 --- fs/ext4/page-io.c | 3 ++- fs/ext4/readpage.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[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 --- fs/block_dev.c | 6 -- fs/crypto/bio.c | 3 ++- fs/direct-io.c | 4 +++- fs/iomap.c | 3 ++- fs/mpage.c

[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 --- 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
In bch_bio_alloc_pages(), bio_for_each_segment() is fine because this helper can only be used on a freshly new bio. For other cases, we conver to bio_for_each_page_all2() since they needn't to update bvec table. bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so

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

2018-05-24 Thread Ming Lei
The incoming bio will become very big after multipage bvec is enabled, so we can't clone bio page by page. This patch uses the introduced bio_clone_seg_bioset(), so the incoming bio can be cloned successfully. This way is safe because device mapping won't modify the bio vector on the cloned

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

2018-05-24 Thread Ming Lei
This patch introduces bio_for_each_page_all2(), which is for replacing bio_for_each_page_all() in case that the returned bvec has to be single page bvec. Given the interface type has to be changed for passing one local iterator variable of 'bvec_iter_all', and doing all changes in one single

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

2018-05-24 Thread Ming Lei
In bio_check_pages_dirty(), bvec->bv_page is used as flag for marking if the page has been dirtied & released, and if no, it will be dirtied in deferred workqueue. With multipage bvec, we can't do that any more, so change the logic into checking all pages in one mp bvec, and only release all

[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 --- block/bio.c | 56 +++-- include/linux/bio.h | 1 + 2 files changed, 43 insertions(+), 14

[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 --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[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 Cc: Josef Bacik Cc: David Sterba Cc: linux-bt...@vger.kernel.org Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_io.c | 5 +++-- 2 files

[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 --- include/linux/blkdev.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1e8e9b430008..0b15bc625bd7

[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 --- include/linux/bio.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[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 --- include/linux/bio.h | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/include/linux/bio.h

[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 --- block/blk-merge.c | 72 +++ 1 file

[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 --- include/linux/bio.h | 34 +++--- include/linux/bvec.h | 36

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

2018-05-24 Thread Ming Lei
Firstly it is more efficient to use bio_for_each_segment() in both blk_bio_segment_split() and __blk_recalc_rq_segments() to compute how many segments there are in the bio. Secondaly once bio_for_each_segment() is used, the bvec may need to be splitted because its length can be very longer than

[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 --- include/linux/bvec.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/include/linux/bvec.h

[PATCH V5 09/33] fs/buffer.c: use bvec iterator to truncate the bio

2018-05-24 Thread Ming Lei
Once multipage bvec is enabled, the last bvec may include more than one page, this patch use segment_last_page() to truncate the bio. Signed-off-by: Ming Lei --- fs/buffer.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c

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

2018-05-24 Thread Ming Lei
Hi, This patchset brings multipage bvec into block layer: 1) what is multipage bvec? Multipage bvecs means that one 'struct bio_bvec' can hold multiple pages which are physically contiguous instead of one single page used in linux kernel for long time. 2) why is multipage bvec introduced?

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

2018-05-24 Thread Ming Lei
This patch introduces helpers of 'bvec_iter_segment_*' for multipage bvec(segment) support. The introduced interfaces treate one bvec as real multipage segment, for example, .bv_len is the total length of the multipage segment. The existed helpers of bvec_iter_* are interfaces for supporting

[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 --- Documentation/block/biodoc.txt | 6 +++--- block/blk-core.c | 2 +- drivers/block/floppy.c | 4 ++--

[PATCH V5 03/33] block: rename bio_segments() with bio_pages()

2018-05-24 Thread Ming Lei
bio_segments() never returns count of actual segment, just like original bio_for_each_segment(), so rename it as bio_pages(). Signed-off-by: Ming Lei --- block/bio.c| 2 +- block/blk-merge.c | 2 +- drivers/block/loop.c

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

2018-05-24 Thread Ming Lei
It is a tree-wide mechanical replacement since both bio_for_each_segment() and bio_for_each_segment_all() never returns real segment at all, and both just return one page per bvec and deceive us for long time, so fix their names. This is a pre-patch for supporting multipage bvec. Once multipage

Re: [PATCH 1/2] lightnvm: pblk: add possibility to set write buffer size manually

2018-05-24 Thread Matias Bjørling
On 05/23/2018 05:17 PM, Marcin Dziegielewski wrote: In some cases, users can want set write buffer size manually, e.g. to adjust it to specific workload. This patch provides the possibility to set write buffer size via module parameter feature. Signed-off-by: Marcin Dziegielewski

Re: [PATCH 0/3] lightnvm: Error paths handling

2018-05-24 Thread Matias Bjørling
On 05/23/2018 02:29 PM, Igor Konopko wrote: This patchset provides a proper handling for some of the errors which are not gracefully handled right now. Igor Konopko (3): lightnvm: Proper error handling for pblk_bio_add_pages lightnvm: Handling when whole line is bad lightnvm: Fix

Re: [PATCH 2/2] lightnvm: pblk: handle case when device expose mw_cunits equal to 0

2018-05-24 Thread Matias Bjørling
On 05/23/2018 05:17 PM, Marcin Dziegielewski wrote: Some devices can expose mw_cunits equal to 0, it can cause creation of too small write buffer and in consecuence performance drop on write workloads. To handle that, in such case we are using default value for MLC and beacause it covers both

Re: [PATCH 0/3] lightnvm: Error paths handling

2018-05-24 Thread Matias Bjørling
On 05/23/2018 02:29 PM, Igor Konopko wrote: This patchset provides a proper handling for some of the errors which are not gracefully handled right now. Igor Konopko (3): lightnvm: Proper error handling for pblk_bio_add_pages lightnvm: Handling when whole line is bad lightnvm: Fix

Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI

2018-05-24 Thread Christoph Hellwig
On Wed, May 23, 2018 at 03:14:19PM -0600, Jens Axboe wrote: > Ugh, so that would necessitate a change there too. As I said before, > I don't really care where it lives. I know the SCSI folks seem bothered > by moving it, but in reality, it's not like this stuff will likely ever > really change. Of

[PATCH V4] blk-mq: avoid to starve tag allocation after allocation process migrates

2018-05-24 Thread Ming Lei
When the allocation process is scheduled back and the mapped hw queue is changed, fake one extra wake up on previous queue for compensating wake up miss, so other allocations on the previous queue won't be starved. This patch fixes one request allocation hang issue, which can be triggered easily

Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI

2018-05-24 Thread Christoph Hellwig
On Wed, May 23, 2018 at 02:17:14PM -0700, Kees Cook wrote: > > True, though I'm finding other robustness issues in the CDROM code. > They're probably all insane corner cases, but it seems like it'd be > nice to just fix them: > > diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c > index