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 | 3987848c7c2be112e03c82d03821b044f1c0edec (patch) | |
tree | 27fbe9abe5c2f21d1c43880e45522a139998aa40 /fs/xfs/xfs_inode_item.c | |
parent | f8d55aa0523ad0f78979c222ed18b78ea7be793a (diff) | |
download | linux-stable-3987848c7c2be112e03c82d03821b044f1c0edec.tar.gz linux-stable-3987848c7c2be112e03c82d03821b044f1c0edec.tar.bz2 linux-stable-3987848c7c2be112e03c82d03821b044f1c0edec.zip |
xfs: remove timestamps from incore inode
The struct xfs_inode has two copies of the current timestamps in it,
one in the vfs inode and one in the struct xfs_icdinode. Now that we
no longer log the struct xfs_icdinode directly, we don't need to
keep the timestamps in this structure. instead we can copy them
straight out of the VFS inode when formatting the inode log item or
the on-disk inode.
This reduces the struct xfs_inode in size by 24 bytes.
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 | 73 |
1 files changed, 12 insertions, 61 deletions
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 3ad997278869..9dcbf584a336 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -323,10 +323,13 @@ xfs_inode_item_format_attr_fork( } static void -xfs_icdinode_to_log_dinode( - struct xfs_icdinode *from, +xfs_inode_to_log_dinode( + struct xfs_inode *ip, struct xfs_log_dinode *to) { + struct xfs_icdinode *from = &ip->i_d; + struct inode *inode = VFS_I(ip); + to->di_magic = from->di_magic; to->di_mode = from->di_mode; to->di_version = from->di_version; @@ -338,66 +341,14 @@ xfs_icdinode_to_log_dinode( 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)); - to->di_atime.t_sec = from->di_atime.t_sec; - to->di_atime.t_nsec = from->di_atime.t_nsec; - to->di_mtime.t_sec = from->di_mtime.t_sec; - to->di_mtime.t_nsec = from->di_mtime.t_nsec; - to->di_ctime.t_sec = from->di_ctime.t_sec; - to->di_ctime.t_nsec = from->di_ctime.t_nsec; - to->di_size = from->di_size; - to->di_nblocks = from->di_nblocks; - to->di_extsize = from->di_extsize; - to->di_nextents = from->di_nextents; - to->di_anextents = from->di_anextents; - to->di_forkoff = from->di_forkoff; - to->di_aformat = from->di_aformat; - 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; - 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_flushiter = 0; - } else { - to->di_flushiter = from->di_flushiter; - } -} + 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; + to->di_mtime.t_nsec = inode->i_mtime.tv_nsec; + to->di_ctime.t_sec = inode->i_ctime.tv_sec; + to->di_ctime.t_nsec = inode->i_ctime.tv_nsec; -/* - * Recovery needs to be able to convert a log dinode back to a real dinode - * for writeback we do that by converting a log dinode to a icdinode, and - * then passing that to the formatting function. - */ -void -xfs_log_dinode_to_icdinode( - struct xfs_log_dinode *from, - struct xfs_icdinode *to) -{ - to->di_magic = from->di_magic; - to->di_mode = from->di_mode; - to->di_version = from->di_version; - to->di_format = from->di_format; - to->di_onlink = from->di_onlink; - to->di_uid = from->di_uid; - to->di_gid = from->di_gid; - to->di_nlink = from->di_nlink; - to->di_projid_lo = from->di_projid_lo; - to->di_projid_hi = from->di_projid_hi; - memset(to->di_pad, 0, sizeof(to->di_pad)); - to->di_atime.t_sec = from->di_atime.t_sec; - to->di_atime.t_nsec = from->di_atime.t_nsec; - to->di_mtime.t_sec = from->di_mtime.t_sec; - to->di_mtime.t_nsec = from->di_mtime.t_nsec; - to->di_ctime.t_sec = from->di_ctime.t_sec; - to->di_ctime.t_nsec = from->di_ctime.t_nsec; to->di_size = from->di_size; to->di_nblocks = from->di_nblocks; to->di_extsize = from->di_extsize; @@ -439,7 +390,7 @@ xfs_inode_item_format_core( struct xfs_log_dinode *dic; dic = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_ICORE); - xfs_icdinode_to_log_dinode(&ip->i_d, dic); + xfs_inode_to_log_dinode(ip, dic); xlog_finish_iovec(lv, *vecp, xfs_log_dinode_size(ip->i_d.di_version)); } |