Skip to content

Commit f4d3cde

Browse files
GoodLuck612brauner
authored andcommitted
netfs: Remove redundant use of smp_rmb()
The function netfs_unbuffered_write_iter_locked() in fs/netfs/direct_write.c contains an unnecessary smp_rmb() call after wait_on_bit(). Since wait_on_bit() already incorporates a memory barrier that ensures the flag update is visible before the function returns, the smp_rmb() provides no additional benefit and incurs unnecessary overhead. This patch removes the redundant barrier to simplify and optimize the code. Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Signed-off-by: David Howells <dhowells@redhat.com> Link: https://lore.kernel.org/r/20241207021952.2978530-1-zilin@seu.edu.cn/ Link: https://lore.kernel.org/r/20241213135013.2964079-7-dhowells@redhat.com Reviewed-by: Akira Yokosawa <akiyks@gmail.com> cc: Akira Yokosawa <akiyks@gmail.com> cc: Jeff Layton <jlayton@kernel.org> cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent e5a8b64 commit f4d3cde

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

fs/netfs/direct_write.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *
104104
trace_netfs_rreq(wreq, netfs_rreq_trace_wait_ip);
105105
wait_on_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS,
106106
TASK_UNINTERRUPTIBLE);
107-
smp_rmb(); /* Read error/transferred after RIP flag */
108107
ret = wreq->error;
109108
if (ret == 0) {
110109
ret = wreq->transferred;

0 commit comments

Comments
 (0)