xfs: cull unnecessary icdinode fields
Now that the struct xfs_icdinode is not directly related to the on-disk format, we can cull things in it we really don't need to store: - magic number never changes - padding is not necessary - next_unlinked is never used - inode number is redundant - uuid is redundant - lsn is accessed directly from dinode - inode CRC is only accessed directly from dinode Hence we can remove these from the struct xfs_icdinode and redirect the code that uses them to the xfs_dinode appripriately. This reduces the size of the struct icdinode from 152 bytes to 88 bytes, and removes a fair chunk of unnecessary code, too. 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>
This commit is contained in:

committed by
Dave Chinner

parent
3987848c7c
commit
93f958f9c4
@@ -809,7 +809,6 @@ xfs_ialloc(
|
||||
ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid());
|
||||
ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid());
|
||||
xfs_set_projid(ip, prid);
|
||||
memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
|
||||
|
||||
if (pip && XFS_INHERIT_GID(pip)) {
|
||||
ip->i_d.di_gid = pip->i_d.di_gid;
|
||||
@@ -847,13 +846,8 @@ xfs_ialloc(
|
||||
ip->i_d.di_flags = 0;
|
||||
|
||||
if (ip->i_d.di_version == 3) {
|
||||
ASSERT(ip->i_d.di_ino == ino);
|
||||
ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid));
|
||||
ip->i_d.di_crc = 0;
|
||||
ip->i_d.di_changecount = 1;
|
||||
ip->i_d.di_lsn = 0;
|
||||
ip->i_d.di_flags2 = 0;
|
||||
memset(&(ip->i_d.di_pad2[0]), 0, sizeof(ip->i_d.di_pad2));
|
||||
ip->i_d.di_crtime.t_sec = (__int32_t)tv.tv_sec;
|
||||
ip->i_d.di_crtime.t_nsec = (__int32_t)tv.tv_nsec;
|
||||
}
|
||||
@@ -3464,13 +3458,6 @@ xfs_iflush_int(
|
||||
__func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
|
||||
goto corrupt_out;
|
||||
}
|
||||
if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
|
||||
mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
|
||||
__func__, ip->i_ino, ip, ip->i_d.di_magic);
|
||||
goto corrupt_out;
|
||||
}
|
||||
if (S_ISREG(ip->i_d.di_mode)) {
|
||||
if (XFS_TEST_ERROR(
|
||||
(ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
|
||||
@@ -3529,7 +3516,7 @@ xfs_iflush_int(
|
||||
* copy out the core of the inode, because if the inode is dirty at all
|
||||
* the core must be.
|
||||
*/
|
||||
xfs_inode_to_disk(ip, dip);
|
||||
xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
|
||||
|
||||
/* Wrap, we never let the log put out DI_MAX_FLUSH */
|
||||
if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
|
||||
@@ -3581,10 +3568,6 @@ xfs_iflush_int(
|
||||
*/
|
||||
xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item);
|
||||
|
||||
/* update the lsn in the on disk inode if required */
|
||||
if (ip->i_d.di_version == 3)
|
||||
dip->di_lsn = cpu_to_be64(iip->ili_item.li_lsn);
|
||||
|
||||
/* generate the checksum. */
|
||||
xfs_dinode_calc_crc(mp, dip);
|
||||
|
||||
|
Reference in New Issue
Block a user