From patchwork Tue Oct 19 06:25:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12568703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C4DC433EF for ; Tue, 19 Oct 2021 06:26:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4935610A1 for ; Tue, 19 Oct 2021 06:26:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C4935610A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.212664.370642 (Exim 4.92) (envelope-from ) id 1mciZK-0000xP-TC; Tue, 19 Oct 2021 06:25:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 212664.370642; Tue, 19 Oct 2021 06:25:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mciZK-0000xI-Oo; Tue, 19 Oct 2021 06:25:50 +0000 Received: by outflank-mailman (input) for mailman id 212664; Tue, 19 Oct 2021 06:25:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mciZJ-0000gN-Rd for xen-devel@lists.xenproject.org; Tue, 19 Oct 2021 06:25:49 +0000 Received: from bombadil.infradead.org (unknown [2607:7c80:54:e::133]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 329376dc-21d6-498e-b3be-65ee5089e3df; Tue, 19 Oct 2021 06:25:43 +0000 (UTC) Received: from 089144192247.atnat0001.highway.a1.net ([89.144.192.247] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mciZ6-000HXN-ET; Tue, 19 Oct 2021 06:25:37 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 329376dc-21d6-498e-b3be-65ee5089e3df 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=gFwPkwP9Zjsq1mqO3JahAc353BRcOUUl+PLqpsO72YI=; b=ZJW8aR8ndzAoILXJIyVOCHqhpJ ajMm/Ex3wKHJjPYAwkuWxVnN1ZhdLhRhrXsne7qfmZhPB7qgvjjNYCDO7FZ12EIoWigLug1zframs UBRixzbC81D0BL6MTo57Bq8G5/80zrEGJP7GFMWpKQtxi9CECpBnZJoXTHrn47Bce+ERZbkXLhAyY j5Yhf3yuHwHV/0O2mMEJ/nX6vwinouMvFWYzZ7f+gPpOqrZa5bdHTCDN1w1kF1hYq2uX2liHkPDSv inlHv0JYz9UWiqQw0mjEOiKX6X+poiKU7uiX6FUJ3QwZba9uou3CnATYwJyCONmS0KgeT7kpKCpq2 O49/xozg==; From: Christoph Hellwig To: Jens Axboe Cc: =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Josef Bacik , David Sterba , OGAWA Hirofumi , Konstantin Komarov , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev Subject: [PATCH 1/7] fs: remove __sync_filesystem Date: Tue, 19 Oct 2021 08:25:24 +0200 Message-Id: <20211019062530.2174626-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211019062530.2174626-1-hch@lst.de> References: <20211019062530.2174626-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html There is no clear benefit in having this helper vs just open coding it. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- fs/sync.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/fs/sync.c b/fs/sync.c index 1373a610dc784..0d6cdc507cb98 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -21,25 +21,6 @@ #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ SYNC_FILE_RANGE_WAIT_AFTER) -/* - * Do the filesystem syncing work. For simple filesystems - * writeback_inodes_sb(sb) just dirties buffers with inodes so we have to - * submit IO for these buffers via __sync_blockdev(). This also speeds up the - * wait == 1 case since in that case write_inode() functions do - * sync_dirty_buffer() and thus effectively write one block at a time. - */ -static int __sync_filesystem(struct super_block *sb, int wait) -{ - if (wait) - sync_inodes_sb(sb); - else - writeback_inodes_sb(sb, WB_REASON_SYNC); - - if (sb->s_op->sync_fs) - sb->s_op->sync_fs(sb, wait); - return __sync_blockdev(sb->s_bdev, wait); -} - /* * Write out and wait upon all dirty data associated with this * superblock. Filesystem data as well as the underlying block @@ -61,10 +42,25 @@ int sync_filesystem(struct super_block *sb) if (sb_rdonly(sb)) return 0; - ret = __sync_filesystem(sb, 0); + /* + * 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 + * 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. + */ + 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); if (ret < 0) return ret; - return __sync_filesystem(sb, 1); + + sync_inodes_sb(sb); + if (sb->s_op->sync_fs) + sb->s_op->sync_fs(sb, 1); + return __sync_blockdev(sb->s_bdev, 1); } EXPORT_SYMBOL(sync_filesystem);