• Filipe Manana's avatar
    btrfs: remove pointless barrier from btrfs_sync_file() · 5ca1949b
    Filipe Manana authored
    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 a4abeea4 ("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: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    5ca1949b
file.c 108 KB