Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503637pxb; Mon, 24 Jan 2022 10:56:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqzu7NihXqejG4lZ253ElyROtTDEw3uRUb9nPKzLhQGBD8qegEk7qHgIS1nOXBl0ZrIT4+ X-Received: by 2002:a05:6a00:1703:b0:4c6:58b8:1e15 with SMTP id h3-20020a056a00170300b004c658b81e15mr15090182pfc.75.1643050575994; Mon, 24 Jan 2022 10:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050575; cv=none; d=google.com; s=arc-20160816; b=mDahMILK04yx9DHYmBbwA+ORJFknLZr2CvjNX0Ek4jB5GCd5HLR8Q6KN8QLHJfKiL1 74Rrcg7iBMgkj93R9ItHQFJIfCIqVhURKCff0LTAb/8HZLJkFYXWbXCQtl81ACYyGpnx NJoc3AFkSUIJ6lJLcpd3q0R9/yy39PjimqAkfVB8viy5drYyIYPYqXEF5d6F6KcFSRc1 DTFW3AzfiNZZyY3U7S0Z59NU83Zkr2QO/M3erf614gm+RvLLbzBSUhOI2fP1PUvaeRhd A5Z9lECrk+OI6pIt+V+gy/q/E3YDRUg34fZBWp/gDQVYcrtd/bvOctwGo7lOOi1qFRhm 4wXA== 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=cyA51tgTzJ0oURPYTTRoUDyOePKkV9xxN4Hqcjy0whE=; b=D/NgzhI3T3ZKDLclPjfzfriVtIukgVUWebUFKYeBUQs+KJp5Q1Mr15XqTXxrQfaX/7 C2mjAQllM6/XbcM9SFNoXHhMwhyX7lO3rbs7dzLJcgt0w5f5j0usINmhZNvKNJquGpzX fb0Q+2gltQYgTPokBpSSoTtOnFofHSZyWGaPD/LbTK3uNqyt8UWMY+y8d3v7W+tvOw6a A+2rXgEcQnZRr1ZuwNg6X/qvFQMVe3g5sq/QTcMwDRuDSP6DKMftOgG+BxfzH8Kng8Th i+9NmLRzKGxmKO94e6ODBrqCx3gfmJ4yDhSiRd8wpimWAeL5doQBePxWbEiUfWPGsHHe Y5+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=24POPMuL; 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 g7si11899886pgi.14.2022.01.24.10.56.02; Mon, 24 Jan 2022 10:56:15 -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=24POPMuL; 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 S242669AbiAXJLk (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242600AbiAXJLf (ORCPT ); Mon, 24 Jan 2022 04:11:35 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59082C06173D; Mon, 24 Jan 2022 01:11:35 -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=cyA51tgTzJ0oURPYTTRoUDyOePKkV9xxN4Hqcjy0whE=; b=24POPMuL96/As8aG9GXRe4flkw PU2voX+TtVVlvvdQoBbajVZWFUX5Dxw0G62WsA11q+Z8rRjH+LEx651hKp3XtfjI7gXtHN4ZzkX/+ zbZ+tlG5Y0PtCwK4dK1YvN9MT7GYMmhUZbx6oA7tclLFQqB/Hk6HGXGms/H0HPQsHLOdwunOcJ2He Z/XTdU7e0f03aHpCO6hyntFD+lSqUwmcuScLWrUHjNVwxSomsOA9gkK7UTP2pkv+Rq271Q+ptnz5u RQQj2WoPvjf4xtnwoz0FDtxL394f4gkw9/czqcZnSk+qNyA0Xz4vOPLIi9B+cPZ8PvyvkOOGVnRjM +yBS+85g==; 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 1nBvNo-002k7w-Qx; Mon, 24 Jan 2022 09:11:29 +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 07/19] dm-snap: use blkdev_issue_flush instead of open coding it Date: Mon, 24 Jan 2022 10:10:55 +0100 Message-Id: <20220124091107.642561-8-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 dm_snapshot. Signed-off-by: Christoph Hellwig --- drivers/md/dm-snap.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index dcf34c6b05ad3..0d336b5ec5714 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -141,11 +141,6 @@ struct dm_snapshot { * for them to be committed. */ struct bio_list bios_queued_during_merge; - - /* - * Flush data after merge. - */ - struct bio flush_bio; }; /* @@ -1127,17 +1122,6 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s) static void error_bios(struct bio *bio); -static int flush_data(struct dm_snapshot *s) -{ - struct bio *flush_bio = &s->flush_bio; - - bio_reset(flush_bio); - bio_set_dev(flush_bio, s->origin->bdev); - flush_bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; - - return submit_bio_wait(flush_bio); -} - static void merge_callback(int read_err, unsigned long write_err, void *context) { struct dm_snapshot *s = context; @@ -1151,7 +1135,7 @@ static void merge_callback(int read_err, unsigned long write_err, void *context) goto shut; } - if (flush_data(s) < 0) { + if (blkdev_issue_flush(s->origin->bdev) < 0) { DMERR("Flush after merge failed: shutting down merge"); goto shut; } @@ -1340,7 +1324,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) s->first_merging_chunk = 0; s->num_merging_chunks = 0; bio_list_init(&s->bios_queued_during_merge); - bio_init(&s->flush_bio, NULL, 0); /* Allocate hash table for COW data */ if (init_hash_tables(s)) { @@ -1528,8 +1511,6 @@ static void snapshot_dtr(struct dm_target *ti) dm_exception_store_destroy(s->store); - bio_uninit(&s->flush_bio); - dm_put_device(ti, s->cow); dm_put_device(ti, s->origin); -- 2.30.2