new helper: is_root_inode()
replace open-coded instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 00c8e4f..1c12c68 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2789,6 +2789,11 @@
inode->i_flags |= S_NOSEC;
}
+static inline bool is_root_inode(struct inode *inode)
+{
+ return inode == inode->i_sb->s_root->d_inode;
+}
+
static inline bool dir_emit(struct dir_context *ctx,
const char *name, int namelen,
u64 ino, unsigned type)