[PATCH V5 13/16] xfs: Conditionally upgrade existing inodes to use 64-bit extent counters

Chandan Babu R
2022-01-21T05:20:04Z

This commit upgrades inodes to use 64-bit extent counters when they are read
from disk. Inodes are upgraded only when the filesystem instance has
XFS_SB_FEAT_INCOMPAT_NREXT64 incompat flag set.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
---
fs/xfs/libxfs/xfs_inode_buf.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index 2200526bcee0..767189c7c887 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -253,6 +253,12 @@ xfs_inode_from_disk(
}
if (xfs_is_reflink_inode(ip))
xfs_ifork_init_cow(ip);
+
+ if ((from->di_version == 3) &&
+ xfs_has_nrext64(ip->i_mount) &&
+ !xfs_dinode_has_nrext64(from))
+ ip->i_diflags2 |= XFS_DIFLAG2_NREXT64;
+
return 0;

out_destroy_data_fork:
--
2.30.2