diff options
author | Dave Chinner <dchinner@redhat.com> | 2016-02-09 16:54:58 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-02-09 16:54:58 +1100 |
commit | 93f958f9c41f0bfd10627a2279457df64004d957 (patch) | |
tree | d49a7d78779925fa7903aed47c77680746d78318 /fs/xfs/xfs_inode_item.c | |
parent | 3987848c7c2be112e03c82d03821b044f1c0edec (diff) |
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>
Diffstat (limited to 'fs/xfs/xfs_inode_item.c')
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 9dcbf584a336..588d1b4523cb 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -325,12 +325,14 @@ xfs_inode_item_format_attr_fork( static void xfs_inode_to_log_dinode( struct xfs_inode *ip, - struct xfs_log_dinode *to) + struct xfs_log_dinode *to, + xfs_lsn_t lsn) { struct xfs_icdinode *from = &ip->i_d; struct inode *inode = VFS_I(ip); - to->di_magic = from->di_magic; + to->di_magic = XFS_DINODE_MAGIC; + to->di_mode = from->di_mode; to->di_version = from->di_version; to->di_format = from->di_format; @@ -340,8 +342,8 @@ xfs_inode_to_log_dinode( to->di_nlink = from->di_nlink; to->di_projid_lo = from->di_projid_lo; to->di_projid_hi = from->di_projid_hi; - memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); + memset(to->di_pad, 0, sizeof(to->di_pad)); to->di_atime.t_sec = inode->i_atime.tv_sec; to->di_atime.t_nsec = inode->i_atime.tv_nsec; to->di_mtime.t_sec = inode->i_mtime.tv_sec; @@ -366,10 +368,11 @@ xfs_inode_to_log_dinode( to->di_crtime.t_sec = from->di_crtime.t_sec; to->di_crtime.t_nsec = from->di_crtime.t_nsec; to->di_flags2 = from->di_flags2; - to->di_ino = from->di_ino; - to->di_lsn = from->di_lsn; - memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); - uuid_copy(&to->di_uuid, &from->di_uuid); + + to->di_ino = ip->i_ino; + to->di_lsn = lsn; + memset(to->di_pad2, 0, sizeof(to->di_pad2)); + uuid_copy(&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid); to->di_flushiter = 0; } else { to->di_flushiter = from->di_flushiter; @@ -390,7 +393,7 @@ xfs_inode_item_format_core( struct xfs_log_dinode *dic; dic = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_ICORE); - xfs_inode_to_log_dinode(ip, dic); + xfs_inode_to_log_dinode(ip, dic, ip->i_itemp->ili_item.li_lsn); xlog_finish_iovec(lv, *vecp, xfs_log_dinode_size(ip->i_d.di_version)); } |