Skip to content

Commit

Permalink
xfs: move the di_extsize field to struct xfs_inode
Browse files Browse the repository at this point in the history
In preparation of removing the historic icinode struct, move the extsize
field into the containing xfs_inode structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
  • Loading branch information
Christoph Hellwig authored and Darrick J. Wong committed Apr 7, 2021
1 parent 6e73a54 commit 031474c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ xfs_bmap_add_extent_hole_real(
*/

/*
* Adjust the size of the new extent based on di_extsize and rt extsize.
* Adjust the size of the new extent based on i_extsize and rt extsize.
*/
int
xfs_bmap_extsize_align(
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/libxfs/xfs_inode_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ xfs_inode_from_disk(

ip->i_disk_size = be64_to_cpu(from->di_size);
ip->i_nblocks = be64_to_cpu(from->di_nblocks);
to->di_extsize = be32_to_cpu(from->di_extsize);
ip->i_extsize = be32_to_cpu(from->di_extsize);
to->di_forkoff = from->di_forkoff;
to->di_flags = be16_to_cpu(from->di_flags);

Expand Down Expand Up @@ -307,7 +307,7 @@ xfs_inode_to_disk(

to->di_size = cpu_to_be64(ip->i_disk_size);
to->di_nblocks = cpu_to_be64(ip->i_nblocks);
to->di_extsize = cpu_to_be32(from->di_extsize);
to->di_extsize = cpu_to_be32(ip->i_extsize);
to->di_nextents = cpu_to_be32(xfs_ifork_nextents(&ip->i_df));
to->di_anextents = cpu_to_be16(xfs_ifork_nextents(ip->i_afp));
to->di_forkoff = from->di_forkoff;
Expand Down
1 change: 0 additions & 1 deletion fs/xfs/libxfs/xfs_inode_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ struct xfs_dinode;
*/
struct xfs_icdinode {
uint16_t di_flushiter; /* incremented on flush */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
uint16_t di_flags; /* random flags, XFS_DIFLAG_... */

Expand Down
10 changes: 5 additions & 5 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ xfs_get_extsz_hint(
*/
if (xfs_is_always_cow_inode(ip))
return 0;
if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize)
return ip->i_d.di_extsize;
if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize)
return ip->i_extsize;
if (XFS_IS_REALTIME_INODE(ip))
return ip->i_mount->m_sb.sb_rextsize;
return 0;
Expand Down Expand Up @@ -712,7 +712,7 @@ xfs_inode_inherit_flags(
di_flags |= XFS_DIFLAG_RTINHERIT;
if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
di_flags |= XFS_DIFLAG_EXTSZINHERIT;
ip->i_d.di_extsize = pip->i_d.di_extsize;
ip->i_extsize = pip->i_extsize;
}
if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
di_flags |= XFS_DIFLAG_PROJINHERIT;
Expand All @@ -722,7 +722,7 @@ xfs_inode_inherit_flags(
di_flags |= XFS_DIFLAG_REALTIME;
if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
di_flags |= XFS_DIFLAG_EXTSIZE;
ip->i_d.di_extsize = pip->i_d.di_extsize;
ip->i_extsize = pip->i_extsize;
}
}
if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) &&
Expand Down Expand Up @@ -839,7 +839,7 @@ xfs_init_new_inode(
inode->i_atime = tv;
inode->i_ctime = tv;

ip->i_d.di_extsize = 0;
ip->i_extsize = 0;
ip->i_d.di_flags = 0;

if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
Expand Down
1 change: 1 addition & 0 deletions fs/xfs/xfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ typedef struct xfs_inode {
xfs_fsize_t i_disk_size; /* number of bytes in file */
xfs_rfsblock_t i_nblocks; /* # of direct & btree blocks */
prid_t i_projid; /* owner's project id */
xfs_extlen_t i_extsize; /* basic/minimum extent size */

struct xfs_icdinode i_d; /* most of ondisk inode */

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_inode_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ xfs_inode_to_log_dinode(

to->di_size = ip->i_disk_size;
to->di_nblocks = ip->i_nblocks;
to->di_extsize = from->di_extsize;
to->di_extsize = ip->i_extsize;
to->di_nextents = xfs_ifork_nextents(&ip->i_df);
to->di_anextents = xfs_ifork_nextents(ip->i_afp);
to->di_forkoff = from->di_forkoff;
Expand Down
10 changes: 5 additions & 5 deletions fs/xfs/xfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ xfs_fill_fsxattr(
struct xfs_ifork *ifp = attr ? ip->i_afp : &ip->i_df;

simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
fa->fsx_extsize = ip->i_extsize << ip->i_mount->m_sb.sb_blocklog;
fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
ip->i_mount->m_sb.sb_blocklog;
fa->fsx_projid = ip->i_projid;
Expand Down Expand Up @@ -1223,7 +1223,7 @@ xfs_ioctl_setattr_xflags(
/* If realtime flag is set then must have realtime device */
if (fa->fsx_xflags & FS_XFLAG_REALTIME) {
if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 ||
(ip->i_d.di_extsize % mp->m_sb.sb_rextsize))
(ip->i_extsize % mp->m_sb.sb_rextsize))
return -EINVAL;
}

Expand Down Expand Up @@ -1347,7 +1347,7 @@ xfs_ioctl_setattr_check_extsize(
xfs_fsblock_t extsize_fsb;

if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
((ip->i_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
return -EINVAL;

if (fa->fsx_extsize == 0)
Expand Down Expand Up @@ -1519,9 +1519,9 @@ xfs_ioctl_setattr(
* are set on the inode then unconditionally clear the extent size hint.
*/
if (ip->i_d.di_flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
ip->i_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
else
ip->i_d.di_extsize = 0;
ip->i_extsize = 0;
if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
(ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_itable.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ xfs_bulkstat_one_int(
buf->bs_mode = inode->i_mode;

buf->bs_xflags = xfs_ip2xflags(ip);
buf->bs_extsize_blks = dic->di_extsize;
buf->bs_extsize_blks = ip->i_extsize;
buf->bs_extents = xfs_ifork_nextents(&ip->i_df);
xfs_bulkstat_health(ip, buf);
buf->bs_aextents = xfs_ifork_nextents(ip->i_afp);
Expand Down

0 comments on commit 031474c

Please sign in to comment.