From patchwork Wed Oct 4 10:38:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13408613 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94B7BE7B5E9 for ; Wed, 4 Oct 2023 10:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242194AbjJDKjN (ORCPT ); Wed, 4 Oct 2023 06:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242151AbjJDKjF (ORCPT ); Wed, 4 Oct 2023 06:39:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E95B0 for ; Wed, 4 Oct 2023 03:39:01 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16492C433C9 for ; Wed, 4 Oct 2023 10:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696415941; bh=SxTagRU+N0LdKkxGyXvivIdXGe0ejMA71/KTArUrXZM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nt57JxKupwOcPEAp0S60RT4EbgpSxiaz21FatcLwP2LlDDj4MoCbysSHFcC+xwqqh 1VOpRJA5C8fSGuWIYLDJij6iy2YxijUPmt3efAwH1pwJgm0yrpr3Z2untRRjLsRJxW yV/T8lv/JeHzGR8t+F0npC79d3qAST44FN7oDWhXYVpHtYxvDeBQZg5FD27Wl1fpyJ OfnKlT2Vwx/tuRNFOohuAeQIQGGranzwIKpTWW3UTdNkj6LeDxLwPXGMR7gOIUgDHY 6Bxy8E43OToTetVrzJhTY2GITbwqQdm+7uFGh/Vo5/eXl1nIfj6II4f1GZt8U7dM1v LkMA3cCM5y0RQ== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 5/6] btrfs: remove pointless barrier from btrfs_sync_file() Date: Wed, 4 Oct 2023 11:38:52 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana The memory barrier (smp_mb()) at btrfs_sync_file() is completely redundant now that fs_info->last_trans_committed is read using READ_ONCE(), with the helper btrfs_get_last_trans_committed(), and written using WRITE_ONCE() with the helper btrfs_set_last_trans_committed(). This barrier was introduced in 2011, by commit a4abeea41adf ("Btrfs: kill trans_mutex"), but even back then it was not correct since the writer side (in btrfs_commit_transaction()), did not issue a pairing memory barrier after it updated fs_info->last_trans_committed. So remove this barrier. Signed-off-by: Filipe Manana --- fs/btrfs/file.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 92e6f224bff9..92419cb8508a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1889,7 +1889,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) atomic_inc(&root->log_batch); - smp_mb(); if (skip_inode_logging(&ctx)) { /* * We've had everything committed since the last time we were