Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3551484ioa; Tue, 26 Apr 2022 05:59:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+m0kSDZsqH/Da/SSGpFqaJ6JxOlOn9on9Su8Yx+Zf80jOqTScYcoT4QI60nq8USiY8ohi X-Received: by 2002:a17:906:2319:b0:6f3:ad55:8fee with SMTP id l25-20020a170906231900b006f3ad558feemr3749162eja.26.1650977960283; Tue, 26 Apr 2022 05:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650977960; cv=none; d=google.com; s=arc-20160816; b=Zo/x4TLRSepzbRtsd+oq4iEVSWllNCbq5FVFa0+LkjtcgZlTpm6QJLlqVUys3FiW/7 xosr1XIPHjFuHQe7FNS4p40IOeeBYk03Uubihr0ZCoFwbvyvqnei9rdxW8sYT/bLhdCf tU/7EphptBpusX72DQWWha7f7TkR2T3E2wXs6XArMzHkgtDQpPU3voiUyEg9WsigfDUQ CtV0teJ2o+m2MGSQ/7Y87s/cvEwScmqU0DsDx9R52+SZSoPaGKUAfTXW8BdcD5SDiJrw wd3ht48jwkMUIyyeQXcHAHgIc7OqfTXXRqwhBQF00XUunjujgwIRW6vFgZ+QaqZcrr+n ddLA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SL1vZBz8lX+NrHHX2ggPvQ7y0oxzbYFOVaPA5pf/jqk=; b=yZixxzGI0gTAXegXkvjWHNz4Sfj43bmAauezXX2Dw6SDB6cqut8lqN/gnH1TUifj7o E7Iuyd+iaJ1bEW7eJMLFnABC1RhV+g0gzgIGPvAv2cjklHsOuq1p7r2lTjzR0GMdd8iy zFuhssnBet2G3sfq7Klm2kAzsSJUFbYKTxYzgHxBeO575qAvndKEgTIyfTdSfhN+lrFX zI2DJT6jNirVwNcGbNeLWeVhtO4OF7SXDvB83mKayu9E6jvG8h85Qp3LorqCL6fYqdRk Pj8foGxX+IA6CTNoYoCVov4vryUi1rGUpM2iQGFoL83eXNKWETTUVgBhec07d8zNyLWE aR3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i/RnP+6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020aa7cfcf000000b00425df4b9895si5124157edy.313.2022.04.26.05.58.54; Tue, 26 Apr 2022 05:59:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i/RnP+6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343490AbiDZJDL (ORCPT + 99 others); Tue, 26 Apr 2022 05:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346915AbiDZIpa (ORCPT ); Tue, 26 Apr 2022 04:45:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE7F13F73; Tue, 26 Apr 2022 01:36:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DE7DB81CFE; Tue, 26 Apr 2022 08:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0497C385A4; Tue, 26 Apr 2022 08:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962202; bh=HmfFJivqIOqkgG4jXS9YrYHWjOYRZEUNs3qyybS+uNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/RnP+6/gaw56bxAKA22B2+buSwmsmLHmCrr+18fH+BYh2gqh0qyLgOd+X9hNCMPp M+mCGOIjvyMRb3NCqNFM+WisIt2ungKfRnLeb22grBCCnT82IHWSMQBKgqjdfrvdUq dMH4t20BUQJKopLlpCzoq+/TEkNZ3ytJFY5YZn0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 002/124] block: remove __sync_blockdev Date: Tue, 26 Apr 2022 10:20:03 +0200 Message-Id: <20220426081747.360900178@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 70164eb6ccb76ab679b016b4b60123bf4ec6c162 ] Instead offer a new sync_blockdev_nowait helper for the !wait case. This new helper is exported as it will grow modular callers in a bit. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211019062530.2174626-3-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bdev.c | 11 ++++++----- fs/internal.h | 5 ----- fs/sync.c | 7 ++++--- include/linux/blkdev.h | 5 +++++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index 485a258b0ab3..33cac289302e 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -184,14 +184,13 @@ int sb_min_blocksize(struct super_block *sb, int size) EXPORT_SYMBOL(sb_min_blocksize); -int __sync_blockdev(struct block_device *bdev, int wait) +int sync_blockdev_nowait(struct block_device *bdev) { if (!bdev) return 0; - if (!wait) - return filemap_flush(bdev->bd_inode->i_mapping); - return filemap_write_and_wait(bdev->bd_inode->i_mapping); + return filemap_flush(bdev->bd_inode->i_mapping); } +EXPORT_SYMBOL_GPL(sync_blockdev_nowait); /* * Write out and wait upon all the dirty data associated with a block @@ -199,7 +198,9 @@ int __sync_blockdev(struct block_device *bdev, int wait) */ int sync_blockdev(struct block_device *bdev) { - return __sync_blockdev(bdev, 1); + if (!bdev) + return 0; + return filemap_write_and_wait(bdev->bd_inode->i_mapping); } EXPORT_SYMBOL(sync_blockdev); diff --git a/fs/internal.h b/fs/internal.h index 3cd065c8a66b..b5caa16f4645 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -23,7 +23,6 @@ struct pipe_inode_info; #ifdef CONFIG_BLOCK extern void __init bdev_cache_init(void); -extern int __sync_blockdev(struct block_device *bdev, int wait); void iterate_bdevs(void (*)(struct block_device *, void *), void *); void emergency_thaw_bdev(struct super_block *sb); #else @@ -31,10 +30,6 @@ static inline void bdev_cache_init(void) { } -static inline int __sync_blockdev(struct block_device *bdev, int wait) -{ - return 0; -} static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg) { diff --git a/fs/sync.c b/fs/sync.c index 0d6cdc507cb9..a621089eb07e 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -3,6 +3,7 @@ * High-level sync()-related operations */ +#include #include #include #include @@ -45,7 +46,7 @@ int sync_filesystem(struct super_block *sb) /* * Do the filesystem syncing work. For simple filesystems * writeback_inodes_sb(sb) just dirties buffers with inodes so we have - * to submit I/O for these buffers via __sync_blockdev(). This also + * to submit I/O for these buffers via sync_blockdev(). This also * speeds up the wait == 1 case since in that case write_inode() * methods call sync_dirty_buffer() and thus effectively write one block * at a time. @@ -53,14 +54,14 @@ int sync_filesystem(struct super_block *sb) writeback_inodes_sb(sb, WB_REASON_SYNC); if (sb->s_op->sync_fs) sb->s_op->sync_fs(sb, 0); - ret = __sync_blockdev(sb->s_bdev, 0); + ret = sync_blockdev_nowait(sb->s_bdev); if (ret < 0) return ret; sync_inodes_sb(sb); if (sb->s_op->sync_fs) sb->s_op->sync_fs(sb, 1); - return __sync_blockdev(sb->s_bdev, 1); + return sync_blockdev(sb->s_bdev); } EXPORT_SYMBOL(sync_filesystem); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 413c0148c0ce..6bbd393e6bcc 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1999,6 +1999,7 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart, #ifdef CONFIG_BLOCK void invalidate_bdev(struct block_device *bdev); int sync_blockdev(struct block_device *bdev); +int sync_blockdev_nowait(struct block_device *bdev); #else static inline void invalidate_bdev(struct block_device *bdev) { @@ -2007,6 +2008,10 @@ static inline int sync_blockdev(struct block_device *bdev) { return 0; } +static inline int sync_blockdev_nowait(struct block_device *bdev) +{ + return 0; +} #endif int fsync_bdev(struct block_device *bdev); -- 2.35.1