Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id 4AB554207B0 for ; Fri, 20 Nov 2020 08:41:19 +0100 (CET) To: Christoph Hellwig , Jens Axboe References: <20201116145809.410558-1-hch@lst.de> <20201116145809.410558-65-hch@lst.de> From: Hannes Reinecke Message-ID: <38ac9782-a563-b7ea-595a-124159fb755d@suse.de> Date: Fri, 20 Nov 2020 08:41:17 +0100 MIME-Version: 1.0 In-Reply-To: <20201116145809.410558-65-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Cc: Justin Sanders , Mike Snitzer , "Michael S. Tsirkin" , Jason Wang , linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-scsi@vger.kernel.org, xen-devel@lists.xenproject.org, Ilya Dryomov , Jack Wang , Konrad Rzeszutek Wilk , Josef Bacik , nbd@other.debian.org, linux-raid@vger.kernel.org, Stefan Hajnoczi , ceph-devel@vger.kernel.org, linux-block@vger.kernel.org, "Martin K. Petersen" , Minchan Kim , linux-fsdevel@vger.kernel.org, Paolo Bonzini , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Subject: Re: [Drbd-dev] [PATCH 64/78] dm: simplify flush_bio initialization in __send_empty_flush List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 11/16/20 3:57 PM, Christoph Hellwig wrote: > We don't really need the struct block_device to initialize a bio. So > switch from using bio_set_dev to manually setting up bi_disk (bi_partno > will always be zero and has been cleared by bio_init already). > > Signed-off-by: Christoph Hellwig > --- > drivers/md/dm.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 54739f1b579bc8..6d7eb72d41f9ea 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -1422,18 +1422,12 @@ static int __send_empty_flush(struct clone_info *ci) > */ > bio_init(&flush_bio, NULL, 0); > flush_bio.bi_opf = REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC; > + flush_bio.bi_disk = ci->io->md->disk; > + bio_associate_blkg(&flush_bio); > + > ci->bio = &flush_bio; > ci->sector_count = 0; > > - /* > - * Empty flush uses a statically initialized bio, as the base for > - * cloning. However, blkg association requires that a bdev is > - * associated with a gendisk, which doesn't happen until the bdev is > - * opened. So, blkg association is done at issue time of the flush > - * rather than when the device is created in alloc_dev(). > - */ > - bio_set_dev(ci->bio, ci->io->md->bdev); > - > BUG_ON(bio_has_data(ci->bio)); > while ((ti = dm_table_get_target(ci->map, target_nr++))) > __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); > Ah, thought as much. I've stumbled across this while debugging blk-interposer. Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer