From fd535ea4ee4fcaed9e6cb59f55e4263b431688c9 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 30 Jun 2021 18:33:44 -0400 Subject: [PATCH] xfs: move the di_cowextsize field to struct xfs_inode Source kernel commit: b33ce57d3e61020328582ce6d7dbae1d694ac496 In preparation of removing the historic icinode struct, move the cowextsize field into the containing xfs_inode structure. Also switch to use the xfs_extlen_t instead of a uint32_t. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- include/xfs_inode.h | 1 + libxfs/util.c | 2 +- libxfs/xfs_inode_buf.c | 4 ++-- libxfs/xfs_inode_buf.h | 1 - repair/phase6.c | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 0281f66c6..056ac104f 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -82,6 +82,7 @@ typedef struct xfs_inode { xfs_rfsblock_t i_nblocks; /* # of direct & btree blocks */ prid_t i_projid; /* owner's project id */ xfs_extlen_t i_extsize; /* basic/minimum extent size */ + xfs_extlen_t i_cowextsize; /* basic cow extent size */ struct xfs_icdinode i_d; /* most of ondisk inode */ xfs_extnum_t i_cnextents; /* # of extents in cow fork */ diff --git a/libxfs/util.c b/libxfs/util.c index b90f227cd..e401a1a54 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -289,7 +289,7 @@ libxfs_init_new_inode( ip->i_d.di_flags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 : xfs_flags2diflags2(ip, fsx->fsx_xflags); ip->i_d.di_crtime = VFS_I(ip)->i_mtime; /* struct copy */ - ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize; + ip->i_cowextsize = pip ? 0 : fsx->fsx_cowextsize; } flags = XFS_ILOG_CORE; diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 39dd4ef9e..3ab254208 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -237,7 +237,7 @@ xfs_inode_from_disk( be64_to_cpu(from->di_changecount)); to->di_crtime = xfs_inode_from_disk_ts(from, from->di_crtime); to->di_flags2 = be64_to_cpu(from->di_flags2); - to->di_cowextsize = be32_to_cpu(from->di_cowextsize); + ip->i_cowextsize = be32_to_cpu(from->di_cowextsize); } error = xfs_iformat_data_fork(ip, from); @@ -316,7 +316,7 @@ xfs_inode_to_disk( to->di_changecount = cpu_to_be64(inode_peek_iversion(inode)); to->di_crtime = xfs_inode_to_disk_ts(ip, from->di_crtime); to->di_flags2 = cpu_to_be64(from->di_flags2); - to->di_cowextsize = cpu_to_be32(from->di_cowextsize); + to->di_cowextsize = cpu_to_be32(ip->i_cowextsize); to->di_ino = cpu_to_be64(ip->i_ino); to->di_lsn = cpu_to_be64(lsn); memset(to->di_pad2, 0, sizeof(to->di_pad2)); diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 6bc788563..77d250dbe 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -21,7 +21,6 @@ struct xfs_icdinode { uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ uint64_t di_flags2; /* more random flags */ - uint32_t di_cowextsize; /* basic cow extent size for file */ struct timespec64 di_crtime; /* time created */ }; diff --git a/repair/phase6.c b/repair/phase6.c index 0c10b6fed..29606b029 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -445,6 +445,7 @@ reset_inode_fields(struct xfs_inode *ip) ip->i_disk_size = 0; ip->i_nblocks = 0; ip->i_extsize = 0; + ip->i_cowextsize = 0; } static void -- 2.47.2