From patchwork Sat Nov 28 16:14:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11937621 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 54A82C63697 for ; Sat, 28 Nov 2020 16:15:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F346A246C0 for ; Sat, 28 Nov 2020 16:15:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IRB8hjpF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F346A246C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B08B58D0012; Sat, 28 Nov 2020 11:15:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A8E728D0010; Sat, 28 Nov 2020 11:15:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97FEC8D0012; Sat, 28 Nov 2020 11:15:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 753BD8D0010 for ; Sat, 28 Nov 2020 11:15:42 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3E42C8249980 for ; Sat, 28 Nov 2020 16:15:42 +0000 (UTC) X-FDA: 77534327724.12.park11_2b0586627392 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 203911801752A for ; Sat, 28 Nov 2020 16:15:42 +0000 (UTC) X-HE-Tag: park11_2b0586627392 X-Filterd-Recvd-Size: 3519 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Sat, 28 Nov 2020 16:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=qOmzpRMb4vEzGwba4P3m5gENBKcm1ZKj8N5Pylgvbms=; b=IRB8hjpF/ywVtkPyjbqecQa7lq RssKcyx2Ok0vmgR1h3eaUGnGWMBY3poXzElQI/dHQOwjcnJrS3u4SJECUZJ+IQ7AhTmWuRnzHDIh0 xnqQmSjjOdj7zKjMMmLGkvdhJLKymWsD3UOCxFnSw2Bv4VRAybQPIXVR+GZMs3dGc1+tlIWSlaj2e CpygcyrJP06LduiqjIS76IiB7B52RCce8WijP8xmYk0pcNCvs5viJUD4Dban0JeHr25yImXluOmVq 4AqbV9WpcTe0tO3jNOuocp5V3JlkJIA2hTFOctikEisfiaM37Vw8g3P1KJR0KzhbJ+gjMX/TDtJnZ JnmKOF1w==; Received: from [2001:4bb8:18c:1dd6:48f3:741a:602e:7fdd] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kj2se-0000Dq-Ja; Sat, 28 Nov 2020 16:15:24 +0000 From: Christoph Hellwig To: 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 Subject: [PATCH 08/45] dm: simplify flush_bio initialization in __send_empty_flush Date: Sat, 28 Nov 2020 17:14:33 +0100 Message-Id: <20201128161510.347752-9-hch@lst.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201128161510.347752-1-hch@lst.de> References: <20201128161510.347752-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: 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 Acked-by: Mike Snitzer Reviewed-by: Hannes Reinecke --- 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 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 = 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);