diff mbox series

[5/5] libfs: kill empty_dir_getattr()

Message ID 20241112202552.3393751-5-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [1/5] io_statx_prep(): use getname_uflags() | expand

Commit Message

Al Viro Nov. 12, 2024, 8:25 p.m. UTC
It's used only to initialize ->getattr in one inode_operations instance
(empty_dir_inode_operations) and its behaviour had always been equivalent
to what we get with NULL ->getattr.

Just remove that initializer, along with empty_dir_getattr() itself.
While we are at it, the same instance has ->permission initialized to
generic_permission, which is what NULL ->permission ends up doing.
Again, no point keeping it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/libfs.c | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Christian Brauner Nov. 13, 2024, 10:22 a.m. UTC | #1
On Tue, Nov 12, 2024 at 08:25:52PM +0000, Al Viro wrote:
> It's used only to initialize ->getattr in one inode_operations instance
> (empty_dir_inode_operations) and its behaviour had always been equivalent
> to what we get with NULL ->getattr.
> 
> Just remove that initializer, along with empty_dir_getattr() itself.
> While we are at it, the same instance has ->permission initialized to
> generic_permission, which is what NULL ->permission ends up doing.
> Again, no point keeping it.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>
diff mbox series

Patch

diff --git a/fs/libfs.c b/fs/libfs.c
index 46966fd8bcf9..12f5185f3fa9 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1711,15 +1711,6 @@  static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry,
 	return ERR_PTR(-ENOENT);
 }
 
-static int empty_dir_getattr(struct mnt_idmap *idmap,
-			     const struct path *path, struct kstat *stat,
-			     u32 request_mask, unsigned int query_flags)
-{
-	struct inode *inode = d_inode(path->dentry);
-	generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
-	return 0;
-}
-
 static int empty_dir_setattr(struct mnt_idmap *idmap,
 			     struct dentry *dentry, struct iattr *attr)
 {
@@ -1733,9 +1724,7 @@  static ssize_t empty_dir_listxattr(struct dentry *dentry, char *list, size_t siz
 
 static const struct inode_operations empty_dir_inode_operations = {
 	.lookup		= empty_dir_lookup,
-	.permission	= generic_permission,
 	.setattr	= empty_dir_setattr,
-	.getattr	= empty_dir_getattr,
 	.listxattr	= empty_dir_listxattr,
 };