Skip to content

Commit 5ca1949

Browse files
fdmananakdave
authored andcommitted
btrfs: remove pointless barrier from btrfs_sync_file()
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 a4abeea ("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 <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 0124855 commit 5ca1949

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

fs/btrfs/file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
18891889

18901890
atomic_inc(&root->log_batch);
18911891

1892-
smp_mb();
18931892
if (skip_inode_logging(&ctx)) {
18941893
/*
18951894
* We've had everything committed since the last time we were

0 commit comments

Comments
 (0)