Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503642pxb; Mon, 24 Jan 2022 10:56:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyl3K2WG1ih5s5C4yOAC6+IqVTts/OyBNlwxxEo5qHjaEHh5S28TKj47dBZWotGW6Qf5fM6 X-Received: by 2002:a65:6e90:: with SMTP id bm16mr9440388pgb.165.1643050576261; Mon, 24 Jan 2022 10:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050576; cv=none; d=google.com; s=arc-20160816; b=UBkRYLKFURDbuSzt7NJubkbK3wle/sjhnMfppvjsdSwdgNqESD22jyLKkpTp/Zemb6 hfNckqBHZu4OWKs+4RVUBIEQzEnv0ZM9K1dNBqOGygyJO6oGJypg5l8TC3rAVYuavKiL aDbR5ak2zMOrSWwoPj6//dJx4XYpzU1/BFXuqit2B6LpGyCJYNgHw/YvPZSPyoCjKncZ p+zbGo+mqf2uhI1hK37Ts9Bo1F6hwlHLDQmNKggODL2T1zbpGuV4WaMglyJubX/G1k7H iWyfJN3Dw2T6h3ZHh9yZTh6DoH9UaK3WuLf+OdnsMVqa0MNxS/NJUH3rd8ZFzWMGlkBj 6j8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mjlg0k+4PavheCjtECQRQWUa0Hx79sA/tX844Pch6ns=; b=otxPrTPwe6HmwOzcDg4x0rqpfC771ENj0A5AdAzF67VhnZ7QSEMGHZW158uE9NcCh7 6bW4tTZicZCZ4fw1dMmhoY7zXbTTkuAV3BxRIq1vWXWy4WN/hN1YLo0mMaISqUL0ZdMp x+RgZW09kc7YuHrDnDQy6NGXzIHiIiZcnNoOJ+c1Lw5se/ZAlEXLv7GDoLxHE6li8Afp 5lb8mv3xA/lzBlv+rj8OpFdGzw1rTjq/Q5UBjtk3GV5M3CNd8DuxgNlAVVTEwA7EahL/ fSRFTWOEM0m3zXGxQ3fBmk2g3B300NjNujg845S463C/aQhvRqHho6d0Zp+Xvn/GJB4a w3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Cq0TPNTk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si13768424pgt.872.2022.01.24.10.56.03; Mon, 24 Jan 2022 10:56:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Cq0TPNTk; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233090AbiAXJLn (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242649AbiAXJLi (ORCPT ); Mon, 24 Jan 2022 04:11:38 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09F58C06173B; Mon, 24 Jan 2022 01:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=Mjlg0k+4PavheCjtECQRQWUa0Hx79sA/tX844Pch6ns=; b=Cq0TPNTknrpMgSPyE0DO6o8Qzt f/iZoR0ubS3Fi0mNYFhpPl8fPbwxg/xP1Xsb9wAVH+J7Xi2rGTgLxSNRU/sh9E8Pausv23uDyD8GM MPk203cd/Z1rnUElKzw1r/Wzqi37FWlZ4t6koT8hF+Sk7/ozar/Vdkeh4G40FH4h4j7SnokgW8dXc a8PQHEniFdLS0v2JKyUDqyV7VP5MGaEeYidHKzzT+aNgHNjiPVUSS9tU+PDOLnMLPzkME51Qb/3uf n61njfRrtW/q1yUlOOM1gMmXqSOJ8tw+YUWV8V80IP6LcwNj92/3FhKy5mGr4hvrynh0ZMAvkwguX MwVYB/7Q==; Received: from [2001:4bb8:184:72a4:a337:a75f:a24e:7e39] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBvNr-002kA4-JE; Mon, 24 Jan 2022 09:11:32 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal " , Jack Wang , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Philipp Reisner , Lars Ellenberg , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, xen-devel@lists.xenproject.org, drbd-dev@lists.linbit.com Subject: [PATCH 08/19] dm-thin: use blkdev_issue_flush instead of open coding it Date: Mon, 24 Jan 2022 10:10:56 +0100 Message-Id: <20220124091107.642561-9-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124091107.642561-1-hch@lst.de> References: <20220124091107.642561-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Use blkdev_issue_flush, which uses an on-stack bio instead of an opencoded version with a bio embedded into struct pool. Signed-off-by: Christoph Hellwig --- drivers/md/dm-thin.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 76a9c2e9aeeea..411a3f56ed90c 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -282,8 +282,6 @@ struct pool { struct dm_bio_prison_cell **cell_sort_array; mempool_t mapping_pool; - - struct bio flush_bio; }; static void metadata_operation_failed(struct pool *pool, const char *op, int r); @@ -2906,7 +2904,6 @@ static void __pool_destroy(struct pool *pool) if (pool->next_mapping) mempool_free(pool->next_mapping, &pool->mapping_pool); mempool_exit(&pool->mapping_pool); - bio_uninit(&pool->flush_bio); dm_deferred_set_destroy(pool->shared_read_ds); dm_deferred_set_destroy(pool->all_io_ds); kfree(pool); @@ -2987,7 +2984,6 @@ static struct pool *pool_create(struct mapped_device *pool_md, pool->low_water_triggered = false; pool->suspended = true; pool->out_of_data_space = false; - bio_init(&pool->flush_bio, NULL, 0); pool->shared_read_ds = dm_deferred_set_create(); if (!pool->shared_read_ds) { @@ -3194,13 +3190,8 @@ static void metadata_low_callback(void *context) static int metadata_pre_commit_callback(void *context) { struct pool *pool = context; - struct bio *flush_bio = &pool->flush_bio; - - bio_reset(flush_bio); - bio_set_dev(flush_bio, pool->data_dev); - flush_bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; - return submit_bio_wait(flush_bio); + return blkdev_issue_flush(pool->data_dev); } static sector_t get_dev_size(struct block_device *bdev) -- 2.30.2