Commit 83e06f21 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: move di_changecount to VFS inode

We can store the di_changecount in the i_version field of the VFS
inode and remove another 8 bytes from the xfs_icdinode.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 9e9a2674
...@@ -251,7 +251,7 @@ xfs_inode_from_disk( ...@@ -251,7 +251,7 @@ xfs_inode_from_disk(
to->di_flags = be16_to_cpu(from->di_flags); to->di_flags = be16_to_cpu(from->di_flags);
if (to->di_version == 3) { if (to->di_version == 3) {
to->di_changecount = be64_to_cpu(from->di_changecount); inode->i_version = be64_to_cpu(from->di_changecount);
to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec); to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec);
to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec); to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec);
to->di_flags2 = be64_to_cpu(from->di_flags2); to->di_flags2 = be64_to_cpu(from->di_flags2);
...@@ -300,7 +300,7 @@ xfs_inode_to_disk( ...@@ -300,7 +300,7 @@ xfs_inode_to_disk(
to->di_flags = cpu_to_be16(from->di_flags); to->di_flags = cpu_to_be16(from->di_flags);
if (from->di_version == 3) { if (from->di_version == 3) {
to->di_changecount = cpu_to_be64(from->di_changecount); to->di_changecount = cpu_to_be64(inode->i_version);
to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec); to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec);
to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec); to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec);
to->di_flags2 = cpu_to_be64(from->di_flags2); to->di_flags2 = cpu_to_be64(from->di_flags2);
......
...@@ -47,7 +47,6 @@ struct xfs_icdinode { ...@@ -47,7 +47,6 @@ struct xfs_icdinode {
__uint16_t di_dmstate; /* DMIG state info */ __uint16_t di_dmstate; /* DMIG state info */
__uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
__uint64_t di_changecount; /* number of attribute changes */
__uint64_t di_flags2; /* more random flags */ __uint64_t di_flags2; /* more random flags */
xfs_ictimestamp_t di_crtime; /* time created */ xfs_ictimestamp_t di_crtime; /* time created */
......
...@@ -138,9 +138,9 @@ xfs_inode_free( ...@@ -138,9 +138,9 @@ xfs_inode_free(
* When we recycle a reclaimable inode, we need to re-initialise the VFS inode * When we recycle a reclaimable inode, we need to re-initialise the VFS inode
* part of the structure. This is made more complex by the fact we store * part of the structure. This is made more complex by the fact we store
* information about the on-disk values in the VFS inode and so we can't just * information about the on-disk values in the VFS inode and so we can't just
* overwrite it's values unconditionally. Hence we save the parameters we * overwrite the values unconditionally. Hence we save the parameters we
* need to retain across reinitialisation, and rewrite them into the VFS inode * need to retain across reinitialisation, and rewrite them into the VFS inode
* after resetting it's state even if resetting fails. * after reinitialisation even if it fails.
*/ */
static int static int
xfs_reinit_inode( xfs_reinit_inode(
...@@ -150,11 +150,13 @@ xfs_reinit_inode( ...@@ -150,11 +150,13 @@ xfs_reinit_inode(
int error; int error;
uint32_t nlink = inode->i_nlink; uint32_t nlink = inode->i_nlink;
uint32_t generation = inode->i_generation; uint32_t generation = inode->i_generation;
uint64_t version = inode->i_version;
error = inode_init_always(mp->m_super, inode); error = inode_init_always(mp->m_super, inode);
set_nlink(inode, nlink); set_nlink(inode, nlink);
inode->i_generation = generation; inode->i_generation = generation;
inode->i_version = version;
return error; return error;
} }
......
...@@ -841,7 +841,7 @@ xfs_ialloc( ...@@ -841,7 +841,7 @@ xfs_ialloc(
ip->i_d.di_flags = 0; ip->i_d.di_flags = 0;
if (ip->i_d.di_version == 3) { if (ip->i_d.di_version == 3) {
ip->i_d.di_changecount = 1; inode->i_version = 1;
ip->i_d.di_flags2 = 0; ip->i_d.di_flags2 = 0;
ip->i_d.di_crtime.t_sec = (__int32_t)tv.tv_sec; ip->i_d.di_crtime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_crtime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_crtime.t_nsec = (__int32_t)tv.tv_nsec;
......
...@@ -364,7 +364,7 @@ xfs_inode_to_log_dinode( ...@@ -364,7 +364,7 @@ xfs_inode_to_log_dinode(
to->di_flags = from->di_flags; to->di_flags = from->di_flags;
if (from->di_version == 3) { if (from->di_version == 3) {
to->di_changecount = from->di_changecount; to->di_changecount = inode->i_version;
to->di_crtime.t_sec = from->di_crtime.t_sec; to->di_crtime.t_sec = from->di_crtime.t_sec;
to->di_crtime.t_nsec = from->di_crtime.t_nsec; to->di_crtime.t_nsec = from->di_crtime.t_nsec;
to->di_flags2 = from->di_flags2; to->di_flags2 = from->di_flags2;
......
...@@ -117,7 +117,7 @@ xfs_trans_log_inode( ...@@ -117,7 +117,7 @@ xfs_trans_log_inode(
*/ */
if (!(ip->i_itemp->ili_item.li_desc->lid_flags & XFS_LID_DIRTY) && if (!(ip->i_itemp->ili_item.li_desc->lid_flags & XFS_LID_DIRTY) &&
IS_I_VERSION(VFS_I(ip))) { IS_I_VERSION(VFS_I(ip))) {
ip->i_d.di_changecount = ++VFS_I(ip)->i_version; VFS_I(ip)->i_version++;
flags |= XFS_ILOG_CORE; flags |= XFS_ILOG_CORE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment