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 > > may be triggered. So bi

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

2018-06-27 Thread Bart Van Assche
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 may be triggered. So bio_for_each_segment() can't be used here. Has it been considered to use memcpy()

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. Hence remove the switch/case s

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

2018-06-27 Thread Bart Van Assche
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. Hence remove the switch/case statement from bio_clone_bioset(). Signed-off-by: Bart Van Assche Cc: Christoph

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 Hellwig > Cc: Ming Lei

[PATCH] block: Simplify the bio cloning implementation

2018-06-26 Thread Bart Van Assche
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 Hellwig Cc: Ming Lei --- block/bio.c | 15 ++- 1 file changed, 2 insertions(+), 13 dele