Skip to contentSkip to conversation

KVM: guest_memfd: Remove redundant kvm_gmem_getattr implementation

PATCH Applied Shivank Garg 4 participants 6 messages Jun 2, 2025 – Jun 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: guest_memfd: Remove redundant kvm_gmem_getattr implementation

Remove the redundant kvm_gmem_getattr() implementation that simply calls generic_fillattr() without any special handling. The VFS layer (vfs_getattr_nosec()) will call generic_fillattr() by default when no custom getattr operation is provided in the inode_operations structure.

This is a cleanup with no functional change.

---
 virt/kvm/guest_memfd.c | 11 -----------
 1 file changed, 11 deletions(-)
virt/kvm/guest_memfd.c +0 -11
index b2aa6bf24d3a..7d85cc33c0bb 100644
@@ -382,23 +382,12 @@ static const struct address_space_operations kvm_gmem_aops = {
 #endif
 };
 
-static int kvm_gmem_getattr(struct mnt_idmap *idmap, const struct path *path,
-			    struct kstat *stat, u32 request_mask,
-			    unsigned int query_flags)
-{
-	struct inode *inode = path->dentry->d_inode;
-
-	generic_fillattr(idmap, request_mask, inode, stat);
-	return 0;
-}
-
 static int kvm_gmem_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 			    struct iattr *attr)
 {
 	return -EINVAL;
 }
 static const struct inode_operations kvm_gmem_iops = {
-	.getattr	= kvm_gmem_getattr,
 	.setattr	= kvm_gmem_setattr,
 };
 
Signature · 1 line
2.34.1
#2 lore raw
Quoted 2 lines · Ackerley Tng

Ackerley,

FYI, your mail doesn't appear to have made it to the lists, e.g. isn't available on lore. I don't see anything obviously wrong (though that means almost nothing). Hopefully it's just a one-off glitch?

Reviewed-by on v1 1/1
#4 lore raw
In reply to Shivank Garg
Quoted 8 lines · Shivank Garg

Remove the redundant kvm_gmem_getattr() implementation that simply calls generic_fillattr() without any special handling. The VFS layer (vfs_getattr_nosec()) will call generic_fillattr() by default when no custom getattr operation is provided in the inode_operations structure.

This is a cleanup with no functional change.

Quoted 32 lines
---
  virt/kvm/guest_memfd.c | 11 -----------
  1 file changed, 11 deletions(-)
virt/kvm/guest_memfd.c +0 -11
index b2aa6bf24d3a..7d85cc33c0bb 100644
@@ -382,23 +382,12 @@ static const struct address_space_operations kvm_gmem_aops = {
  #endif
  };
 
-static int kvm_gmem_getattr(struct mnt_idmap *idmap, const struct path *path,
-			    struct kstat *stat, u32 request_mask,
-			    unsigned int query_flags)
-{
-	struct inode *inode = path->dentry->d_inode;
-
-	generic_fillattr(idmap, request_mask, inode, stat);
-	return 0;
-}
-
  static int kvm_gmem_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
  			    struct iattr *attr)
  {
  	return -EINVAL;
  }
  static const struct inode_operations kvm_gmem_iops = {
-	.getattr	= kvm_gmem_getattr,
  	.setattr	= kvm_gmem_setattr,
  };
 
maintainer Applied
#5 lore raw
In reply to Shivank Garg
Quoted 8 lines · Shivank Garg

Remove the redundant kvm_gmem_getattr() implementation that simply calls generic_fillattr() without any special handling. The VFS layer (vfs_getattr_nosec()) will call generic_fillattr() by default when no custom getattr operation is provided in the inode_operations structure.

This is a cleanup with no functional change.

[...]

Applied to kvm-x86 generic, thanks!

[1/1] KVM: guest_memfd: Remove redundant kvm_gmem_getattr implementation

      https://github.com/kvm-x86/linux/commit/87d4fbf4a387

--
https://github.com/kvm-x86/kvm-unit-tests/tree/next