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

2018-11-26 Thread Ming Lei
On Mon, Nov 26, 2018 at 01:58:42PM +0100, Christoph Hellwig wrote: > > + phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + > > + bv->bv_offset + bv->bv_len; > > The name is a little confusing, as the real end addr would be -1. Maybe > throw the -1 in here, and

Re: [Cluster-devel] [PATCH] gfs2: get rid of potential double free

2018-11-26 Thread PanBian
On Tue, Nov 27, 2018 at 12:19:48AM +0100, Andreas Gruenbacher wrote: > Pan, > > On Mon, 26 Nov 2018 at 09:44, Pan Bian wrote: > > > __gfs2_set_acl will not increase the reference count of acl if it fails. > > In this case, posix_acl_release are called twice, one after > > __gfs2_set_acl and one

Re: [Cluster-devel] [PATCH] gfs2: get rid of potential double free

2018-11-26 Thread Andreas Gruenbacher
Pan, On Mon, 26 Nov 2018 at 09:44, Pan Bian wrote: > __gfs2_set_acl will not increase the reference count of acl if it fails. > In this case, posix_acl_release are called twice, one after > __gfs2_set_acl and one in the error handling block. This patch does not > release acl when __gfs2_set_acl

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:16AM +0800, Ming Lei wrote: > This patch pulls the trigger for multi-page bvecs. Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- > block/bio.c | 22 +++--- > fs/iomap.c | 4 ++-- > fs/xfs/xfs_aops.c | 4 ++-- >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:02AM +0800, Ming Lei wrote: > 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 >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:17AM +0800, Ming Lei wrote: > 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

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:18AM +0800, Ming Lei wrote: > 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. Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:15AM +0800, Ming Lei wrote: > 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 >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:14AM +0800, Ming Lei wrote: > 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

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:09AM +0800, Ming Lei wrote: > 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

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:13AM +0800, Ming Lei wrote: > 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 Reviewed-by: Omar Sandoval

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:01AM +0800, Ming Lei wrote: > 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 >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:06AM +0800, Ming Lei wrote: > 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 >

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:05AM +0800, Ming Lei wrote: > Commit 7759eb23fd980 ("block: remove bio_rewind_iter()") removes > bio_rewind_iter(), then no one uses bvec_iter_rewind() any more, > so remove it. Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- > include/linux/bvec.h |

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:04AM +0800, Ming Lei wrote: > 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

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

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 10:17:03AM +0800, Ming Lei wrote: > 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

[Cluster-devel] [PATCH] gfs2: Get rid of potential double-freeing in gfs2_create_inode

2018-11-26 Thread Andreas Gruenbacher
In gfs2_create_inode, after setting and releasing the acl / default_acl, the acl / default_acl pointers are not set to NULL as they should be. In that state, when the function reaches label fail_free_acls, gfs2_create_inode will try to release the same acls again. Fix that by setting the

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

2018-11-26 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

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

2018-11-26 Thread Christoph Hellwig
Looks fine: Reviewed-by: Christoph Hellwig Nitpick below: > +{ > + unsigned len = bv->bv_len; > + unsigned total_len = 0; > + unsigned new_nsegs = 0, seg_size = 0; > + > + /* > + * Multipage bvec may be too big to hold in one segment, > + * so the current bvec has to

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

2018-11-26 Thread Christoph Hellwig
> + phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + > + bv->bv_offset + bv->bv_len; The name is a little confusing, as the real end addr would be -1. Maybe throw the -1 in here, and adjust for it in the contigous check below?

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

2018-11-26 Thread Christoph Hellwig
On Mon, Nov 26, 2018 at 10:17:18AM +0800, Ming Lei wrote: > 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 Looks fine, Reviewed-by: Christoph Hellwig

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

2018-11-26 Thread Christoph Hellwig
On Mon, Nov 26, 2018 at 10:17:06AM +0800, Ming Lei wrote: > 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 >

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

2018-11-26 Thread Christoph Hellwig
On Mon, Nov 26, 2018 at 10:17:08AM +0800, Ming Lei wrote: > 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. > >

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

2018-11-26 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig

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

2018-11-26 Thread Christoph Hellwig
On Mon, Nov 26, 2018 at 10:17:05AM +0800, Ming Lei wrote: > 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 Looks good, Reviewed-by: Christoph Hellwig

[Cluster-devel] [PATCH] gfs2: get rid of potential double free

2018-11-26 Thread Pan Bian
__gfs2_set_acl will not increase the reference count of acl if it fails. In this case, posix_acl_release are called twice, one after __gfs2_set_acl and one in the error handling block. This patch does not release acl when __gfs2_set_acl fails. Fixes: e01580bf9e4("gfs2: use generic posix ACL

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

2018-11-26 Thread Miguel Ojeda
On Mon, Nov 26, 2018 at 3:20 AM Ming Lei wrote: > > 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 >