xfs: move inode generation count to VFS inode
authorDave Chinner <dchinner@redhat.com>
Tue, 9 Feb 2016 05:54:58 +0000 (16:54 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 9 Feb 2016 05:54:58 +0000 (16:54 +1100)
Pull another 4 bytes out of the xfs_icdinode.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/libxfs/xfs_inode_buf.h
fs/xfs/xfs_export.c
fs/xfs/xfs_icache.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_itable.c

index cc509c1af75ecdbfff1323b26f8efac69161fa14..9113a8d0f1482f3fd8b2b01b314603deb3c7c1f5 100644 (file)
@@ -237,6 +237,7 @@ xfs_inode_from_disk(
        inode->i_mtime.tv_nsec = (int)be32_to_cpu(from->di_mtime.t_nsec);
        inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec);
        inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec);
+       inode->i_generation = be32_to_cpu(from->di_gen);
 
        to->di_size = be64_to_cpu(from->di_size);
        to->di_nblocks = be64_to_cpu(from->di_nblocks);
@@ -248,7 +249,6 @@ xfs_inode_from_disk(
        to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
        to->di_dmstate  = be16_to_cpu(from->di_dmstate);
        to->di_flags    = be16_to_cpu(from->di_flags);
-       to->di_gen      = be32_to_cpu(from->di_gen);
 
        if (to->di_version == 3) {
                to->di_changecount = be64_to_cpu(from->di_changecount);
@@ -286,6 +286,7 @@ xfs_inode_to_disk(
        to->di_ctime.t_sec = cpu_to_be32(inode->i_ctime.tv_sec);
        to->di_ctime.t_nsec = cpu_to_be32(inode->i_ctime.tv_nsec);
        to->di_nlink = cpu_to_be32(inode->i_nlink);
+       to->di_gen = cpu_to_be32(inode->i_generation);
 
        to->di_size = cpu_to_be64(from->di_size);
        to->di_nblocks = cpu_to_be64(from->di_nblocks);
@@ -297,7 +298,6 @@ xfs_inode_to_disk(
        to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
        to->di_dmstate = cpu_to_be16(from->di_dmstate);
        to->di_flags = cpu_to_be16(from->di_flags);
-       to->di_gen = cpu_to_be32(from->di_gen);
 
        if (from->di_version == 3) {
                to->di_changecount = cpu_to_be64(from->di_changecount);
@@ -443,7 +443,7 @@ xfs_iread(
            !(mp->m_flags & XFS_MOUNT_IKEEP)) {
                /* initialise the on-disk inode core */
                memset(&ip->i_d, 0, sizeof(ip->i_d));
-               ip->i_d.di_gen = prandom_u32();
+               VFS_I(ip)->i_generation = prandom_u32();
                if (xfs_sb_version_hascrc(&mp->m_sb))
                        ip->i_d.di_version = 3;
                else
@@ -491,7 +491,7 @@ xfs_iread(
                 * that xfs_ialloc won't overwrite or relies on being correct.
                 */
                ip->i_d.di_version = dip->di_version;
-               ip->i_d.di_gen = be32_to_cpu(dip->di_gen);
+               VFS_I(ip)->i_generation = be32_to_cpu(dip->di_gen);
                ip->i_d.di_flushiter = be16_to_cpu(dip->di_flushiter);
 
                /*
index 320b72344270d0732e9d232f29f6fdb5025f3856..29fd9f1cf54b70a1fe71ac006ee3a8c197bf2907 100644 (file)
@@ -46,7 +46,6 @@ struct xfs_icdinode {
        __uint32_t      di_dmevmask;    /* DMIG event mask */
        __uint16_t      di_dmstate;     /* DMIG state info */
        __uint16_t      di_flags;       /* random flags, XFS_DIFLAG_... */
-       __uint32_t      di_gen;         /* generation number */
 
        __uint64_t      di_changecount; /* number of attribute changes */
        __uint64_t      di_flags2;      /* more random flags */
index 652cd3c5b58c1cac1562239c9c644a19dbe588b7..2816d42507bc8ab7cf00fecb775b11e19dfb6088 100644 (file)
@@ -152,7 +152,7 @@ xfs_nfs_get_inode(
                return ERR_PTR(error);
        }
 
-       if (ip->i_d.di_gen != generation) {
+       if (VFS_I(ip)->i_generation != generation) {
                IRELE(ip);
                return ERR_PTR(-ESTALE);
        }
index 4c184f70d43ca010ffc8238bb7a963d2718f4243..6401e3c07d3a178a6778e6439d03da0065b26f3d 100644 (file)
@@ -149,10 +149,12 @@ xfs_reinit_inode(
 {
        int             error;
        uint32_t        nlink = inode->i_nlink;
+       uint32_t        generation = inode->i_generation;
 
        error = inode_init_always(mp->m_super, inode);
 
        set_nlink(inode, nlink);
+       inode->i_generation = generation;
        return error;
 }
 
index 18b3bc0c211a4d5b69db456bd653608b376f62f3..dfc5b18c8cc28ad7f1d7f4e6f1c03b3740d05367 100644 (file)
@@ -835,9 +835,6 @@ xfs_ialloc(
        inode->i_atime = tv;
        inode->i_ctime = tv;
 
-       /*
-        * di_gen will have been taken care of in xfs_iread.
-        */
        ip->i_d.di_extsize = 0;
        ip->i_d.di_dmevmask = 0;
        ip->i_d.di_dmstate = 0;
@@ -2424,7 +2421,7 @@ xfs_ifree(
         * Bump the generation count so no one will be confused
         * by reincarnations of this inode.
         */
-       ip->i_d.di_gen++;
+       VFS_I(ip)->i_generation++;
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
        if (xic.deleted)
index 193e0bdec34065b5232639637fd18ec11e9c4b63..6367780b8abbba39b9cd24de30a85feb25035eef 100644 (file)
@@ -350,6 +350,7 @@ xfs_inode_to_log_dinode(
        to->di_ctime.t_sec = inode->i_ctime.tv_sec;
        to->di_ctime.t_nsec = inode->i_ctime.tv_nsec;
        to->di_nlink = inode->i_nlink;
+       to->di_gen = inode->i_generation;
 
        to->di_size = from->di_size;
        to->di_nblocks = from->di_nblocks;
@@ -361,7 +362,6 @@ xfs_inode_to_log_dinode(
        to->di_dmevmask = from->di_dmevmask;
        to->di_dmstate = from->di_dmstate;
        to->di_flags = from->di_flags;
-       to->di_gen = from->di_gen;
 
        if (from->di_version == 3) {
                to->di_changecount = from->di_changecount;
index 478d04e07f9500d6ceed20231deb6b474161c708..cdd6c3156d530d550502c09ff59e982606747914 100644 (file)
@@ -114,7 +114,7 @@ xfs_find_handle(
                handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
                                        sizeof(handle.ha_fid.fid_len);
                handle.ha_fid.fid_pad = 0;
-               handle.ha_fid.fid_gen = ip->i_d.di_gen;
+               handle.ha_fid.fid_gen = inode->i_generation;
                handle.ha_fid.fid_ino = ip->i_ino;
 
                hsize = XFS_HSIZE(handle);
index 8982e56e07c4bfce44ce36040d679c1b5be53e11..a4daa3fd3ae95cacb5e0c63c7b0ec8d11a6f71d9 100644 (file)
@@ -1231,7 +1231,6 @@ xfs_setup_inode(
                break;
        }
 
-       inode->i_generation = ip->i_d.di_gen;
        i_size_write(inode, ip->i_d.di_size);
        xfs_diflags_to_iflags(inode, ip);
 
index cfb65273d361c867bac39bab838d5c60ea1b6f18..6162e65f10b6382e80916654be277184fe4a5278 100644 (file)
@@ -100,11 +100,11 @@ xfs_bulkstat_one_int(
        buf->bs_mtime.tv_nsec = inode->i_mtime.tv_nsec;
        buf->bs_ctime.tv_sec = inode->i_ctime.tv_sec;
        buf->bs_ctime.tv_nsec = inode->i_ctime.tv_nsec;
+       buf->bs_gen = inode->i_generation;
 
        buf->bs_xflags = xfs_ip2xflags(ip);
        buf->bs_extsize = dic->di_extsize << mp->m_sb.sb_blocklog;
        buf->bs_extents = dic->di_nextents;
-       buf->bs_gen = dic->di_gen;
        memset(buf->bs_pad, 0, sizeof(buf->bs_pad));
        buf->bs_dmevmask = dic->di_dmevmask;
        buf->bs_dmstate = dic->di_dmstate;