Skip to contentSkip to conversation

libxfs: remove xfs_inode.i_size

PATCH In review Christoph Hellwig 2 participants 2 messages Sep 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxfs: remove xfs_inode.i_size

This is never actually initialized, and leaves a landmine if anything tries to read from it. Redirect all i_size read macros to i_disk_size instead.

---
 include/xfs_inode.h | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
include/xfs_inode.h +1 -9
index f07a34ec5d46..0292beecf903 100644
@@ -252,7 +252,6 @@ typedef struct xfs_inode {
 	xfs_agino_t		i_next_unlinked;
 	xfs_agino_t		i_prev_unlinked;
 
-	xfs_fsize_t		i_size;		/* in-memory size */
 	struct inode		i_vnode;
 } xfs_inode_t;
 
@@ -337,7 +336,7 @@ static inline const struct inode *VFS_IC(const struct xfs_inode *ip)
 /* We only have i_size in the xfs inode in userspace */
 static inline loff_t i_size_read(struct inode *inode)
 {
-	return XFS_I(inode)->i_size;
+	return XFS_I(inode)->i_disk_size;
 }
 
 /*
@@ -353,15 +352,8 @@ static inline bool XFS_ISDIR(struct xfs_inode *ip)
 	return S_ISDIR(VFS_I(ip)->i_mode);
 }
 
-/*
- * For regular files we only update the on-disk filesize when actually
- * writing data back to disk.  Until then only the copy in the VFS inode
- * is uptodate.
- */
 static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
 {
-	if (XFS_ISREG(ip))
-		return ip->i_size;
 	return ip->i_disk_size;
 }
 #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_diflags & XFS_DIFLAG_REALTIME)
Signature · 1 line
2.53.0