From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [PATCH] block: Simplify the bio cloning implementation To: Ming Lei Cc: Jens Axboe , "linux-block@vger.kernel.org" , Christoph Hellwig References: <20180626222624.11739-1-bart.vanassche@wdc.com> <20180627011259.GC9970@ming.t460p> <5766ea06-4016-6ad1-a18a-b2c9f31788cf@wdc.com> <20180627232039.GA7583@ming.t460p> From: Bart Van Assche Message-ID: <6d9bb0d0-52fd-8f16-6443-dcd8867bdb7c@wdc.com> Date: Wed, 27 Jun 2018 16:55:20 -0700 MIME-Version: 1.0 In-Reply-To: <20180627232039.GA7583@ming.t460p> Content-Type: text/plain; charset=utf-8; format=flowed List-ID: 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() to copy the bi_vcnt bio_vecs instead of using bio_for_each_segment() in bio_clone_bioset()? That will in this context probably be even faster than using bio_for_each_segment(). Bart.