[Cluster-devel] [PATCH V12 20/20] block: kill BLK_MQ_F_SG_MERGE

2018-11-25 Thread Ming Lei
QUEUE_FLAG_NO_SG_MERGE has been killed, so kill BLK_MQ_F_SG_MERGE too. Reviewed-by: Christoph Hellwig Reviewed-by: Omar Sandoval Signed-off-by: Ming Lei --- block/blk-mq-debugfs.c | 1 - drivers/block/loop.c | 2 +- drivers/block/nbd.c | 2 +- drivers/block/rbd.c

[Cluster-devel] [PATCH V12 18/20] block: document usage of bio iterator helpers

2018-11-25 Thread Ming Lei
Now multi-page bvec is supported, some helpers may return page by page, meantime some may return segment by segment, this patch documents the usage. Signed-off-by: Ming Lei --- Documentation/block/biovecs.txt | 25 + 1 file changed, 25 insertions(+) diff --git

[Cluster-devel] [PATCH V12 19/20] block: kill QUEUE_FLAG_NO_SG_MERGE

2018-11-25 Thread Ming Lei
Since bdced438acd83ad83a6c ("block: setup bi_phys_segments after splitting"), physical segment number is mainly figured out in blk_queue_split() for fast path, and the flag of BIO_SEG_VALID is set there too. Now only blk_recount_segments() and blk_recalc_rq_segments() use this flag. Basically

[Cluster-devel] [PATCH V12 16/20] block: enable multipage bvecs

2018-11-25 Thread Ming Lei
This patch pulls the trigger for multi-page bvecs. Signed-off-by: Ming Lei --- block/bio.c | 22 +++--- fs/iomap.c | 4 ++-- fs/xfs/xfs_aops.c | 4 ++-- include/linux/bio.h | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/block/bio.c

[Cluster-devel] [PATCH V12 12/20] fs/buffer.c: use bvec iterator to truncate the bio

2018-11-25 Thread Ming Lei
Once multi-page bvec is enabled, the last bvec may include more than one page, this patch use bvec_last_segment() to truncate the bio. Reviewed-by: Omar Sandoval Reviewed-by: Christoph Hellwig Signed-off-by: Ming Lei --- fs/buffer.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-)

[Cluster-devel] [PATCH V12 14/20] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages()

2018-11-25 Thread Ming Lei
bch_bio_alloc_pages() is always called on one new bio, so it is safe to access the bvec table directly. Given it is the only kind of this case, open code the bvec table access since bio_for_each_segment_all() will be changed to support for iterating over multipage bvec. Acked-by: Coly Li

[Cluster-devel] [PATCH V12 13/20] block: loop: pass multi-page bvec to iov_iter

2018-11-25 Thread Ming Lei
iov_iter is implemented on bvec itererator helpers, so it is safe to pass multi-page bvec to it, and this way is much more efficient than passing one page in each bvec. Reviewed-by: Christoph Hellwig Signed-off-by: Ming Lei --- drivers/block/loop.c | 20 ++-- 1 file changed, 10

[Cluster-devel] [PATCH V12 15/20] block: allow bio_for_each_segment_all() to iterate over multi-page bvec

2018-11-25 Thread Ming Lei
This patch introduces one extra iterator variable to bio_for_each_segment_all(), then we can allow bio_for_each_segment_all() to iterate over multi-page bvec. Given it is just one mechannical & simple change on all bio_for_each_segment_all() users, this patch does tree-wide change in one single

[Cluster-devel] [PATCH V12 09/20] block: use bio_for_each_bvec() to compute multi-page bvec count

2018-11-25 Thread Ming Lei
First it is more efficient to use bio_for_each_bvec() in both blk_bio_segment_split() and __blk_recalc_rq_segments() to compute how many multi-page bvecs there are in the bio. Secondly once bio_for_each_bvec() is used, the bvec may need to be splitted because its length can be very longer than

[Cluster-devel] [PATCH V12 10/20] block: use bio_for_each_bvec() to map sg

2018-11-25 Thread Ming Lei
It is more efficient to use bio_for_each_bvec() to map sg, meantime we have to consider splitting multipage bvec as done in blk_bio_segment_split(). Reviewed-by: Omar Sandoval Signed-off-by: Ming Lei --- block/blk-merge.c | 70 +++ 1 file

[Cluster-devel] [PATCH V12 11/20] block: introduce bvec_last_segment()

2018-11-25 Thread Ming Lei
BTRFS and guard_bio_eod() need to get the last singlepage segment from one multipage bvec, so introduce this helper to make them happy. Reviewed-by: Omar Sandoval Signed-off-by: Ming Lei --- include/linux/bvec.h | 22 ++ 1 file changed, 22 insertions(+) diff --git

[Cluster-devel] [PATCH V12 17/20] block: always define BIO_MAX_PAGES as 256

2018-11-25 Thread Ming Lei
Now multi-page bvec can cover CONFIG_THP_SWAP, so we don't need to increase BIO_MAX_PAGES for it. CONFIG_THP_SWAP needs to split one THP into normal pages and adds them all to one bio. With multipage-bvec, it just takes one bvec to hold them all. Reviewed-by: Christoph Hellwig Signed-off-by:

[Cluster-devel] [PATCH V12 01/20] btrfs: remove various bio_offset arguments

2018-11-25 Thread Ming Lei
From: Christoph Hellwig The btrfs write path passes a bio_offset argument through some deep callchains including async offloading. In the end this is easily calculatable using page_offset plus the bvec offset for the first page in the bio, and only actually used by by a single function. Just

[Cluster-devel] [PATCH V12 00/20] block: support multi-page bvec

2018-11-25 Thread Ming Lei
Hi, This patchset brings multi-page bvec into block layer: 1) what is multi-page 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 multi-page bvec introduced?

[Cluster-devel] [PATCH V12 05/20] block: remove bvec_iter_rewind()

2018-11-25 Thread Ming Lei
Commit 7759eb23fd980 ("block: remove bio_rewind_iter()") removes bio_rewind_iter(), then no one uses bvec_iter_rewind() any more, so remove it. Signed-off-by: Ming Lei --- include/linux/bvec.h | 24 1 file changed, 24 deletions(-) diff --git a/include/linux/bvec.h

[Cluster-devel] [PATCH V12 07/20] block: introduce multi-page bvec helpers

2018-11-25 Thread Ming Lei
This patch introduces helpers of 'bvec_iter_*' for multi-page bvec support. The introduced helpers treate one bvec as real multi-page segment, which may include more than one pages. The existed helpers of bvec_iter_* are interfaces for supporting current bvec iterator which is thought as

[Cluster-devel] [PATCH V12 02/20] btrfs: look at bi_size for repair decisions

2018-11-25 Thread Ming Lei
From: Christoph Hellwig bio_readpage_error currently uses bi_vcnt to decide if it is worth retrying an I/O. But the vector count is mostly an implementation artifact - it really should figure out if there is more than a single sector worth retrying. Use bi_size for that and shift by

[Cluster-devel] [PATCH V12 06/20] block: rename bvec helpers

2018-11-25 Thread Ming Lei
We will support multi-page bvec soon, and have to deal with single-page vs multi-page bvec. This patch follows Christoph's suggestion to rename all the following helpers: for_each_bvec bvec_iter_bvec bvec_iter_len bvec_iter_page bvec_iter_offset into:

[Cluster-devel] [PATCH V12 03/20] block: remove the "cluster" flag

2018-11-25 Thread Ming Lei
From: Christoph Hellwig The cluster flag implements some very old SCSI behavior. As far as I can tell the original intent was to enable or disable any kind of segment merging. But the actually visible effect to the LLDD is that it limits each segments to be inside a single page, which we can

[Cluster-devel] [PATCH V12 08/20] block: introduce bio_for_each_bvec() and rq_for_each_bvec()

2018-11-25 Thread Ming Lei
bio_for_each_bvec() is used for iterating over multi-page bvec for bio split & merge code. rq_for_each_bvec() can be used for drivers which may handle the multi-page bvec directly, so far loop is one perfect use case. Reviewed-by: Omar Sandoval Signed-off-by: Ming Lei --- include/linux/bio.h

[Cluster-devel] [PATCH V12 04/20] block: don't use bio->bi_vcnt to figure out segment number

2018-11-25 Thread Ming Lei
It is wrong to use bio->bi_vcnt to figure out how many segments there are in the bio even though CLONED flag isn't set on this bio, because this bio may be splitted or advanced. So always use bio_segments() in blk_recount_segments(), and it shouldn't cause any performance loss now because the

Re: [Cluster-devel] [PATCH v1 0/4] fs: fix race between llseek SEEK_END and write

2018-11-25 Thread Eiichi Tsukata
2018年11月22日(木) 16:06 Al Viro : > > Can you show me where does POSIX/SuS/whatever it's called these days promise > that kind of atomicity? No. I couldn't found it. That's why I previously posted RFC Patch: https://marc.info/?t=15423727791=1=2 I wasn't sure this is a bug in the kernel or not.