From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F2A3C5519F for ; Mon, 30 Nov 2020 07:08:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ADAE4206D8 for ; Mon, 30 Nov 2020 07:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADAE4206D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 23E356B0068; Mon, 30 Nov 2020 02:08:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C8966B006C; Mon, 30 Nov 2020 02:08:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08FF76B006E; Mon, 30 Nov 2020 02:08:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E7A176B0068 for ; Mon, 30 Nov 2020 02:08:38 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AEC0D8249980 for ; Mon, 30 Nov 2020 07:08:38 +0000 (UTC) X-FDA: 77540206716.27.milk87_220e882273a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 941283D668 for ; Mon, 30 Nov 2020 07:08:38 +0000 (UTC) X-HE-Tag: milk87_220e882273a0 X-Filterd-Recvd-Size: 3338 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 07:08:38 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 205A9AC55; Mon, 30 Nov 2020 07:08:37 +0000 (UTC) Subject: Re: [PATCH 08/45] dm: simplify flush_bio initialization in __send_empty_flush To: Christoph Hellwig , Jens Axboe Cc: Tejun Heo , Josef Bacik , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , Johannes Thumshirn , dm-devel@redhat.com, Jan Kara , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20201128161510.347752-1-hch@lst.de> <20201128161510.347752-9-hch@lst.de> From: Hannes Reinecke Message-ID: <8e58e368-5772-6d97-06d0-f58346cc1865@suse.de> Date: Mon, 30 Nov 2020 08:08:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201128161510.347752-9-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/28/20 5:14 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). >=20 > Signed-off-by: Christoph Hellwig > Acked-by: Mike Snitzer > --- > drivers/md/dm.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) >=20 > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 50541d336c719b..ab0a8335f098d9 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 =3D REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC; > + flush_bio.bi_disk =3D ci->io->md->disk; > + bio_associate_blkg(&flush_bio); > + > ci->bio =3D &flush_bio; > ci->sector_count =3D 0; > =20 > - /* > - * 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 =3D dm_table_get_target(ci->map, target_nr++))) > __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); >=20 Reviewed-by: Hannes Reinecke Cheers, Hannes --=20 Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg HRB 36809 (AG N=C3=BCrnberg), Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6= rffer