Skip to contentSkip to conversation

2 cosmetic changes

PATCH Applied Mateusz Guzik 2 participants 4 messages Oct 4, 2023 – Oct 9, 2023 VFS

lore
Share & tools
lore
#0 lore raw

cover 2 cosmetic changes

both were annoying me for some time, so I'm pushing them out

These patches don't warrant arguing nor pinging in case of no response, so if you don't like them that's it for the patchset. :)

cheers

Mateusz Guzik (2):
vfs: predict the error in retry_estale as unlikely
vfs: stop counting on gcc not messing with mnt_expiry_mark if not
asked

 fs/namespace.c        | 4 ++--
 include/linux/namei.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 vfs: predict the error in retry_estale as unlikely

---
 include/linux/namei.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/namei.h +1 -1
index 1463cbda4888..689b16f3031b 100644
@@ -112,7 +112,7 @@ static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
 static inline bool
 retry_estale(const long error, const unsigned int flags)
 {
-	return error == -ESTALE && !(flags & LOOKUP_REVAL);
+	return unlikely(error == -ESTALE && !(flags & LOOKUP_REVAL));
 }
 
 #endif /* _LINUX_NAMEI_H */
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/2 vfs: stop counting on gcc not messing with mnt_expiry_mark if not asked

In reply to Mateusz Guzik

So happens it already was not doing it, but there is no need to "hope" as indicated in the comment.

No changes in generated assembly.

---
 fs/namespace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namespace.c +2 -2
index e157efc54023..d785bcb75111 100644
@@ -1344,9 +1344,9 @@ void mntput(struct vfsmount *mnt)
 {
 	if (mnt) {
 		struct mount *m = real_mount(mnt);
-		/* avoid cacheline pingpong, hope gcc doesn't get "smart" */
+		/* avoid cacheline pingpong */
 		if (unlikely(m->mnt_expiry_mark))
-			m->mnt_expiry_mark = 0;
+			WRITE_ONCE(m->mnt_expiry_mark, 0);
 		mntput_no_expire(m);
 	}
 }
Signature · 1 line
2.39.2
maintainer Applied
#3 lore raw
In reply to Mateusz Guzik
Quoted 8 lines · Mateusz Guzik

both were annoying me for some time, so I'm pushing them out

These patches don't warrant arguing nor pinging in case of no response, so if you don't like them that's it for the patchset. :)

cheers

[...]

Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/2] vfs: predict the error in retry_estale as unlikely

      https://git.kernel.org/vfs/vfs/c/c9f39d6a1486
[2/2] vfs: stop counting on gcc not messing with mnt_expiry_mark if not asked
      https://git.kernel.org/vfs/vfs/c/5cafd8fed85c