Skip to contentSkip to conversation

vfs: Rename __is_local_mountpoint to is_local_mountpoint

PATCH In review Nikolay Borisov 2 participants 3 messages Feb 24, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: Rename __is_local_mountpoint to is_local_mountpoint

Current is_local_mountpoint is a simple wrapper with added d_mountpoint check. However, the same check is the first thing which __is_local_mountpoint performs. So remove the wrapper and promote the private helper to is_local_mountpoint. No semantics changes.

---
 fs/mount.h     | 9 +--------
 fs/namespace.c | 4 ++--
 2 files changed, 3 insertions(+), 10 deletions(-)
fs/mount.h +1 -8
index 711a4093e475..bdbd2ad79209 100644
@@ -140,14 +140,7 @@ struct proc_mounts {
 
 extern const struct seq_operations mounts_op;
 
-extern bool __is_local_mountpoint(struct dentry *dentry);
-static inline bool is_local_mountpoint(struct dentry *dentry)
-{
-	if (!d_mountpoint(dentry))
-		return false;
-
-	return __is_local_mountpoint(dentry);
-}
+extern bool is_local_mountpoint(struct dentry *dentry);
 
 static inline bool is_anon_ns(struct mnt_namespace *ns)
 {
fs/namespace.c +2 -2
index 85b5f7bea82e..6d1f00849ac6 100644
@@ -649,7 +649,7 @@ struct vfsmount *lookup_mnt(const struct path *path)
 }
 
 /*
- * __is_local_mountpoint - Test to see if dentry is a mountpoint in the
+ * is_local_mountpoint - Test to see if dentry is a mountpoint in the
  *                         current mount namespace.
  *
  * The common case is dentries are not mountpoints at all and that
@@ -663,7 +663,7 @@ struct vfsmount *lookup_mnt(const struct path *path)
  * namespace not just a mount that happens to have some specified
  * parent mount.
  */
-bool __is_local_mountpoint(struct dentry *dentry)
+bool is_local_mountpoint(struct dentry *dentry)
 {
 	struct mnt_namespace *ns = current->nsproxy->mnt_ns;
 	struct mount *mnt;
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Nikolay Borisov

Current is_local_mountpoint is a simple wrapper with added d_mountpoint check. However, the same check is the first thing which __is_local_mountpoint performs. So remove the wrapper and promote the private helper to is_local_mountpoint. No semantics changes.

NAK. "No semantics changes" does not cut it - inline helper that checks some unlikely condition and calls an out-of-line version is a fairly common pattern, with legitimate uses. It *may* be unwarranted here, but you need more serious analysis than that. I'm not saying that the patch is wrong, but you'll also need to explain why removing the check from __is_local_mountpoint() (and marking the condition unlikely in the wrapper) would be worse than what you propose.

#2 lore raw
Quoted 6 lines · Al Viro
Quoted 4 lines · Nikolay Borisov

Current is_local_mountpoint is a simple wrapper with added d_mountpoint check. However, the same check is the first thing which __is_local_mountpoint performs. So remove the wrapper and promote the private helper to is_local_mountpoint. No semantics changes.

Quoted 8 lines

NAK. "No semantics changes" does not cut it - inline helper that checks some unlikely condition and calls an out-of-line version is a fairly common pattern, with legitimate uses. It *may* be unwarranted here, but you need more serious analysis than that. I'm not saying that the patch is wrong, but you'll also need to explain why removing the check from __is_local_mountpoint() (and marking the condition unlikely in the wrapper) would be worse than what you propose.

My main motivation was to collapse the number of functions so it's easier to see what's going on and removing duplicate check. If you are going to accept the alternative version you proposed I'm fine sending it.