netfs.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/netfs: Remove redundant use of smp_rmb()
@ 2024-12-07  2:19 Zilin Guan
  2024-12-07  5:20 ` Akira Yokosawa
  2024-12-07  8:04 ` David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: Zilin Guan @ 2024-12-07  2:19 UTC (permalink / raw)
  To: dhowells; +Cc: jlayton, linux-fsdevel, linux-kernel, netfs, jianhao.xu, zilin

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>
---
 fs/netfs/direct_write.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c
index 88f2adfab75e..173e8b5e6a93 100644
--- a/fs/netfs/direct_write.c
+++ b/fs/netfs/direct_write.c
@@ -104,7 +104,6 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *
 		trace_netfs_rreq(wreq, netfs_rreq_trace_wait_ip);
 		wait_on_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS,
 			    TASK_UNINTERRUPTIBLE);
-		smp_rmb(); /* Read error/transferred after RIP flag */
 		ret = wreq->error;
 		if (ret == 0) {
 			ret = wreq->transferred;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-07 10:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-07  2:19 [PATCH] fs/netfs: Remove redundant use of smp_rmb() Zilin Guan
2024-12-07  5:20 ` Akira Yokosawa
2024-12-07  8:04 ` David Howells
2024-12-07 10:09   ` Akira Yokosawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).