xfs inode structure cleanups
Hi all,
This series cleans up how we define struct xfs_inode. Most importantly it removes the pointles xfs_icdinode sub-structure.
PATCH 1/4 xfs: use a struct timespec64 for the in-core crtime
struct xfs_icdinode is purely an in-memory data structure, so don't use a log on-disk structure for it. This simplifies the code a bit, and also reduces our include hell slightly.
--- fs/xfs/libxfs/xfs_inode_buf.c | 8 ++++---- fs/xfs/libxfs/xfs_inode_buf.h | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 6 ++---- fs/xfs/xfs_inode.c | 3 +-- fs/xfs/xfs_inode_item.c | 4 ++-- fs/xfs/xfs_iops.c | 3 +-- fs/xfs/xfs_itable.c | 4 ++-- 7 files changed, 13 insertions(+), 17 deletions(-)
fs/xfs/libxfs/xfs_inode_buf.c +4 -4
@@ -256,8 +256,8 @@ xfs_inode_from_disk(if (to->di_version ==3 ) {inode_set_iversion_queried (inode,be64_to_cpu (from->di_changecount)); - to->di_crtime.t_sec =be32_to_cpu (from->di_crtime.t_sec); - to->di_crtime.t_nsec =be32_to_cpu (from->di_crtime.t_nsec); + to->di_crtime.tv_sec =be32_to_cpu (from->di_crtime.t_sec); + to->di_crtime.tv_nsec =be32_to_cpu (from->di_crtime.t_nsec); to->di_flags2 =be64_to_cpu (from->di_flags2); to->di_cowextsize =be32_to_cpu (from->di_cowextsize); }
@@ -306,8 +306,8 @@ xfs_inode_to_disk(if (from->di_version ==3 ) { to->di_changecount =cpu_to_be64 (inode_peek_iversion (inode)); - to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.t_sec); - to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.t_nsec); + to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.tv_sec); + to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.tv_nsec); to->di_flags2 =cpu_to_be64 (from->di_flags2); to->di_cowextsize =cpu_to_be32 (from->di_cowextsize); to->di_ino =cpu_to_be64 (ip->i_ino);
fs/xfs/libxfs/xfs_inode_buf.h +1 -1
@@ -37,7 +37,7 @@ struct xfs_icdinode {uint64_t di_flags2;/* more random flags */ uint32_t di_cowextsize;/* basic cow extent size for file */ -xfs_ictimestamp_t di_crtime;/* time created */ +struct timespec64 di_crtime;/* time created */ };/*
fs/xfs/libxfs/xfs_trans_inode.c +2 -4
@@ -66,10 +66,8 @@ xfs_trans_ichgtime( inode->i_mtime = tv;if (flags &XFS_ICHGTIME_CHG ) inode->i_ctime = tv; -if (flags &XFS_ICHGTIME_CREATE ) { - ip->i_d.di_crtime.t_sec = (int32_t )tv.tv_sec; - ip->i_d.di_crtime.t_nsec = (int32_t )tv.tv_nsec; - } +if (flags &XFS_ICHGTIME_CREATE ) + ip->i_d.di_crtime = tv; }/*
fs/xfs/xfs_inode.c +1 -2
@@ -845,8 +845,7 @@ xfs_ialloc(inode_set_iversion (inode,1 ); ip->i_d.di_flags2 =0 ; ip->i_d.di_cowextsize =0 ; - ip->i_d.di_crtime.t_sec = (int32_t )tv.tv_sec; - ip->i_d.di_crtime.t_nsec = (int32_t )tv.tv_nsec; + ip->i_d.di_crtime = tv; }
fs/xfs/xfs_inode_item.c +2 -2
@@ -340,8 +340,8 @@ xfs_inode_to_log_dinode(if (from->di_version ==3 ) { to->di_changecount =inode_peek_iversion (inode); - to->di_crtime.t_sec = from->di_crtime.t_sec; - to->di_crtime.t_nsec = from->di_crtime.t_nsec; + to->di_crtime.t_sec = from->di_crtime.tv_sec; + to->di_crtime.t_nsec = from->di_crtime.tv_nsec; to->di_flags2 = from->di_flags2; to->di_cowextsize = from->di_cowextsize; to->di_ino = ip->i_ino;
fs/xfs/xfs_iops.c +1 -2
@@ -516,8 +516,7 @@ xfs_vn_getattr(if (ip->i_d.di_version ==3 ) {if (request_mask &STATX_BTIME ) { stat->result_mask |=STATX_BTIME ; - stat->btime.tv_sec = ip->i_d.di_crtime.t_sec; - stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec; + stat->btime = ip->i_d.di_crtime; } }
fs/xfs/xfs_itable.c +2 -2
@@ -97,8 +97,8 @@ xfs_bulkstat_one_int( buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; buf->bs_ctime = inode->i_ctime.tv_sec; buf->bs_ctime_nsec = inode->i_ctime.tv_nsec; - buf->bs_btime = dic->di_crtime.t_sec; - buf->bs_btime_nsec = dic->di_crtime.t_nsec; + buf->bs_btime = dic->di_crtime.tv_sec; + buf->bs_btime_nsec = dic->di_crtime.tv_nsec; buf->bs_gen = inode->i_generation; buf->bs_mode = inode->i_mode;
Signature · 1 line
2.20.1
Re: [PATCH 1/4] xfs: use a struct timespec64 for the in-core crtime
fs/xfs/libxfs/xfs_trans_inode.c xfs_trans_ichgtime(
Quoted 59 lines · Christoph Hellwig
struct
xfs_icdinodeis purely an in-memory data structure, so don't use a log on-disk structure for it. This simplifies the code a bit, and also reduces our include hell slightly.Signed-off-by Christoph Hellwig <[email protected]>--- fs/xfs/libxfs/xfs_inode_buf.c | 8 ++++---- fs/xfs/libxfs/xfs_inode_buf.h | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 6 ++---- fs/xfs/xfs_inode.c | 3 +-- fs/xfs/xfs_inode_item.c | 4 ++-- fs/xfs/xfs_iops.c | 3 +-- fs/xfs/xfs_itable.c | 4 ++-- 7 files changed, 13 insertions(+), 17 deletions(-)fs/xfs/libxfs/xfs_inode_buf.c +4
-4@@ -256,8 +256,8 @@ xfs_inode_from_disk(if (to->di_version ==3 ) {inode_set_iversion_queried (inode,be64_to_cpu (from->di_changecount)); - to->di_crtime.t_sec =be32_to_cpu (from->di_crtime.t_sec); - to->di_crtime.t_nsec =be32_to_cpu (from->di_crtime.t_nsec); + to->di_crtime.tv_sec =be32_to_cpu (from->di_crtime.t_sec); + to->di_crtime.tv_nsec =be32_to_cpu (from->di_crtime.t_nsec); to->di_flags2 =be64_to_cpu (from->di_flags2); to->di_cowextsize =be32_to_cpu (from->di_cowextsize); }@@ -306,8 +306,8 @@ xfs_inode_to_disk(if (from->di_version ==3 ) { to->di_changecount =cpu_to_be64 (inode_peek_iversion (inode)); - to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.t_sec); - to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.t_nsec); + to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.tv_sec); + to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.tv_nsec); to->di_flags2 =cpu_to_be64 (from->di_flags2); to->di_cowextsize =cpu_to_be32 (from->di_cowextsize); to->di_ino =cpu_to_be64 (ip->i_ino);fs/xfs/libxfs/xfs_inode_buf.h +1
-1@@ -37,7 +37,7 @@ struct xfs_icdinode {uint64_t di_flags2;/* more random flags */ uint32_t di_cowextsize;/* basic cow extent size for file */ -xfs_ictimestamp_t di_crtime;/* time created */ +struct timespec64 di_crtime;/* time created */ };/* fs/xfs/libxfs/xfs_trans_inode.c +0
-0@@ -66,10 +66,8 @@ xfs_trans_ichgtime(
I spotted a misaligned variable declaration for @tv in this function and will fold that into this patch on commit.
@@ -55,7 +55,7 @@ xfs_trans_ichgtime(
int flags)
{
struct inode *inode = VFS_I(ip);
- struct timespec64 tv;
+ struct timespec64 tv;
ASSERT(tp); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
Looks ok otherwise,
--D
Quoted 73 lines
fs/xfs/libxfs/xfs_trans_inode.c +2
-4inode->i_mtime = tv;if (flags &XFS_ICHGTIME_CHG ) inode->i_ctime = tv; -if (flags &XFS_ICHGTIME_CREATE ) { - ip->i_d.di_crtime.t_sec = (int32_t )tv.tv_sec; - ip->i_d.di_crtime.t_nsec = (int32_t )tv.tv_nsec; - } +if (flags &XFS_ICHGTIME_CREATE ) + ip->i_d.di_crtime = tv; }/* fs/xfs/xfs_inode.c +1
-2@@ -845,8 +845,7 @@ xfs_ialloc(inode_set_iversion (inode,1 ); ip->i_d.di_flags2 =0 ; ip->i_d.di_cowextsize =0 ; - ip->i_d.di_crtime.t_sec = (int32_t )tv.tv_sec; - ip->i_d.di_crtime.t_nsec = (int32_t )tv.tv_nsec; + ip->i_d.di_crtime = tv; }fs/xfs/xfs_inode_item.c +2
-2@@ -340,8 +340,8 @@ xfs_inode_to_log_dinode(if (from->di_version ==3 ) { to->di_changecount =inode_peek_iversion (inode); - to->di_crtime.t_sec = from->di_crtime.t_sec; - to->di_crtime.t_nsec = from->di_crtime.t_nsec; + to->di_crtime.t_sec = from->di_crtime.tv_sec; + to->di_crtime.t_nsec = from->di_crtime.tv_nsec; to->di_flags2 = from->di_flags2; to->di_cowextsize = from->di_cowextsize; to->di_ino = ip->i_ino;fs/xfs/xfs_iops.c +1
-2@@ -516,8 +516,7 @@ xfs_vn_getattr(if (ip->i_d.di_version ==3 ) {if (request_mask &STATX_BTIME ) { stat->result_mask |=STATX_BTIME ; - stat->btime.tv_sec = ip->i_d.di_crtime.t_sec; - stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec; + stat->btime = ip->i_d.di_crtime; } }fs/xfs/xfs_itable.c +2
-2@@ -97,8 +97,8 @@ xfs_bulkstat_one_int( buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; buf->bs_ctime = inode->i_ctime.tv_sec; buf->bs_ctime_nsec = inode->i_ctime.tv_nsec; - buf->bs_btime = dic->di_crtime.t_sec; - buf->bs_btime_nsec = dic->di_crtime.t_nsec; + buf->bs_btime = dic->di_crtime.tv_sec; + buf->bs_btime_nsec = dic->di_crtime.tv_nsec; buf->bs_gen = inode->i_generation; buf->bs_mode = inode->i_mode;Signature · 1 line
2.20.1
PATCH 2/4 xfs: merge the projid fields in struct xfs_icdinode
In reply to Christoph HellwigThere is no point in splitting the fields like this in an purely in-memory structure.
--- fs/xfs/libxfs/xfs_inode_buf.c | 11 +++++------ fs/xfs/libxfs/xfs_inode_buf.h | 3 +-- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_icache.c | 4 ++-- fs/xfs/xfs_inode.c | 6 +++--- fs/xfs/xfs_inode.h | 21 +-------------------- fs/xfs/xfs_inode_item.c | 4 ++-- fs/xfs/xfs_ioctl.c | 8 ++++---- fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_itable.c | 2 +- fs/xfs/xfs_qm.c | 8 ++++---- fs/xfs/xfs_qm_bhv.c | 2 +- 12 files changed, 26 insertions(+), 47 deletions(-)
fs/xfs/libxfs/xfs_inode_buf.c +5 -6
@@ -213,13 +213,12 @@ xfs_inode_from_disk( to->di_version = from->di_version;if (to->di_version ==1 ) {set_nlink (inode,be16_to_cpu (from->di_onlink)); - to->di_projid_lo =0 ; - to->di_projid_hi =0 ; + to->di_projid =0 ; to->di_version =2 ; }else {set_nlink (inode,be32_to_cpu (from->di_nlink)); - to->di_projid_lo =be16_to_cpu (from->di_projid_lo); - to->di_projid_hi =be16_to_cpu (from->di_projid_hi); + to->di_projid = (prid_t )be16_to_cpu (from->di_projid_hi) <<16 | +be16_to_cpu (from->di_projid_lo); } to->di_format = from->di_format;
@@ -279,8 +278,8 @@ xfs_inode_to_disk( to->di_format = from->di_format; to->di_uid =cpu_to_be32 (from->di_uid); to->di_gid =cpu_to_be32 (from->di_gid); - to->di_projid_lo =cpu_to_be16 (from->di_projid_lo); - to->di_projid_hi =cpu_to_be16 (from->di_projid_hi); + to->di_projid_lo =cpu_to_be16 (from->di_projid &0xffff ); + to->di_projid_hi =cpu_to_be16 (from->di_projid >>16 );memset (to->di_pad,0 ,sizeof (to->di_pad)); to->di_atime.t_sec =cpu_to_be32 (inode->i_atime.tv_sec);
fs/xfs/libxfs/xfs_inode_buf.h +1 -2
@@ -21,8 +21,7 @@ struct xfs_icdinode {uint16_t di_flushiter;/* incremented on flush */ uint32_t di_uid;/* owner's user id */ uint32_t di_gid;/* owner's group id */ -uint16_t di_projid_lo;/* lower part of owner's project id */ -uint16_t di_projid_hi;/* higher part of owner's project id */ +uint32_t di_projid;/* owner's project id */ xfs_fsize_t di_size;/* number of bytes in file */ xfs_rfsblock_t di_nblocks;/* # of direct & btree blocks used */ xfs_extlen_t di_extsize;/* basic/minimum extent size for file */
fs/xfs/xfs_dquot.c +1 -1
@@ -833,7 +833,7 @@ xfs_qm_id_for_quotatype(case XFS_DQ_GROUP :return ip->i_d.di_gid;case XFS_DQ_PROJ : -return xfs_get_projid (ip); +return ip->i_d.di_projid; }ASSERT (0 );return 0 ;
fs/xfs/xfs_icache.c +2 -2
@@ -1419,7 +1419,7 @@ xfs_inode_match_id(return 0 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && -xfs_get_projid (ip) != eofb->eof_prid) + ip->i_d.di_projid != eofb->eof_prid)return 0 ;return 1 ;
@@ -1443,7 +1443,7 @@ xfs_inode_match_id_union(return 1 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && -xfs_get_projid (ip) == eofb->eof_prid) + ip->i_d.di_projid == eofb->eof_prid)return 1 ;return 0 ;
fs/xfs/xfs_inode.c +3 -3
@@ -809,7 +809,7 @@ xfs_ialloc( ip->i_d.di_uid =xfs_kuid_to_uid (current_fsuid ()); ip->i_d.di_gid =xfs_kgid_to_gid (current_fsgid ()); inode->i_rdev = rdev; -xfs_set_projid (ip, prid); + ip->i_d.di_projid = prid;if (pip &&XFS_INHERIT_GID (pip)) { ip->i_d.di_gid = pip->i_d.di_gid;
@@ -1417,7 +1417,7 @@ xfs_link(* the tree quota mechanism could be circumvented. */ if (unlikely ((tdp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && - (xfs_get_projid (tdp) !=xfs_get_projid (sip)))) { + tdp->i_d.di_projid != sip->i_d.di_projid)) { error = -EXDEV ; goto error_return; }
@@ -3269,7 +3269,7 @@ xfs_rename(* tree quota mechanism would be circumvented. */ if (unlikely ((target_dp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && - (xfs_get_projid (target_dp) !=xfs_get_projid (src_ip)))) { + target_dp->i_d.di_projid != src_ip->i_d.di_projid)) { error = -EXDEV ; goto out_trans_cancel; }
fs/xfs/xfs_inode.h +1 -20
@@ -177,30 +177,11 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)return ret; } -/* -* Project quota id helpers (previously projid was 16bit only -* and using two 16bit values to hold new 32bit projid was chosen -* to retain compatibility with "old" filesystems). -*/ -static inline prid_t -xfs_get_projid (struct xfs_inode *ip) -{ -return (prid_t )ip->i_d.di_projid_hi <<16 | ip->i_d.di_projid_lo; -} - -static inline void -xfs_set_projid (struct xfs_inode *ip, -prid_t projid) -{ - ip->i_d.di_projid_hi = (uint16_t ) (projid >>16 ); - ip->i_d.di_projid_lo = (uint16_t ) (projid &0xffff ); -} -static inline prid_t xfs_get_initial_prid (struct xfs_inode *dp) {if (dp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) -return xfs_get_projid (dp); +return dp->i_d.di_projid;return XFS_PROJID_DEFAULT ; }
fs/xfs/xfs_inode_item.c +2 -2
@@ -309,8 +309,8 @@ xfs_inode_to_log_dinode( to->di_format = from->di_format; to->di_uid = from->di_uid; to->di_gid = from->di_gid; - to->di_projid_lo = from->di_projid_lo; - to->di_projid_hi = from->di_projid_hi; + to->di_projid_lo = from->di_projid &0xffff ; + to->di_projid_hi = from->di_projid >>16 ;memset (to->di_pad,0 ,sizeof (to->di_pad));memset (to->di_pad3,0 ,sizeof (to->di_pad3));
fs/xfs/xfs_ioctl.c +4 -4
@@ -1116,7 +1116,7 @@ xfs_fill_fsxattr( fa->fsx_extsize = ip->i_d.di_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 =xfs_get_projid (ip); + fa->fsx_projid = ip->i_d.di_projid;if (attr) {if (ip->i_afp) {
@@ -1569,7 +1569,7 @@ xfs_ioctl_setattr( }if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp) && -xfs_get_projid (ip) != fa->fsx_projid) { + ip->i_d.di_projid != fa->fsx_projid) { code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */
@@ -1606,13 +1606,13 @@ xfs_ioctl_setattr(VFS_I (ip)->i_mode &= ~(S_ISUID |S_ISGID );/* Change the ownerships and register project quota modifications */ -if (xfs_get_projid (ip) != fa->fsx_projid) { +if (ip->i_d.di_projid != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, &ip->i_pdquot, pdqp); }ASSERT (ip->i_d.di_version >1 ); -xfs_set_projid (ip, fa->fsx_projid); + ip->i_d.di_projid = fa->fsx_projid; }/*
fs/xfs/xfs_iops.c +1 -1
@@ -663,7 +663,7 @@ xfs_setattr_nonsize(ASSERT (gdqp ==NULL ); error =xfs_qm_vop_dqalloc (ip,xfs_kuid_to_uid (uid),xfs_kgid_to_gid (gid), -xfs_get_projid (ip), + ip->i_d.di_projid, qflags, &udqp, &gdqp,NULL );if (error)return error;
fs/xfs/xfs_itable.c +1 -1
@@ -84,7 +84,7 @@ xfs_bulkstat_one_int(/* xfs_iget returns the following without needing * further change. */ - buf->bs_projectid =xfs_get_projid (ip); + buf->bs_projectid = ip->i_d.di_projid; buf->bs_ino = ino; buf->bs_uid = dic->di_uid; buf->bs_gid = dic->di_gid;
fs/xfs/xfs_qm.c +4 -4
@@ -341,7 +341,7 @@ xfs_qm_dqattach_locked( }if (XFS_IS_PQUOTA_ON (mp) && !ip->i_pdquot) { - error =xfs_qm_dqattach_one (ip,xfs_get_projid (ip),XFS_DQ_PROJ , + error =xfs_qm_dqattach_one (ip, ip->i_d.di_projid,XFS_DQ_PROJ , doalloc, &ip->i_pdquot);if (error) goto done;
@@ -1693,7 +1693,7 @@ xfs_qm_vop_dqalloc( } }if ((flags &XFS_QMOPT_PQUOTA ) &&XFS_IS_PQUOTA_ON (mp)) { -if (xfs_get_projid (ip) != prid) { +if (ip->i_d.di_projid != prid) {xfs_iunlock (ip, lockflags); error =xfs_qm_dqget (mp, (xfs_dqid_t )prid,XFS_DQ_PROJ , true, &pq);
@@ -1827,7 +1827,7 @@ xfs_qm_vop_chown_reserve( }if (XFS_IS_PQUOTA_ON (ip->i_mount) && pdqp && -xfs_get_projid (ip) !=be32_to_cpu (pdqp->q_core.d_id)) { + ip->i_d.di_projid !=be32_to_cpu (pdqp->q_core.d_id)) { prjflags =XFS_QMOPT_ENOSPC ; pdq_delblks = pdqp;if (delblks) {
@@ -1928,7 +1928,7 @@ xfs_qm_vop_create_dqattach( }if (pdqp &&XFS_IS_PQUOTA_ON (mp)) {ASSERT (ip->i_pdquot ==NULL ); -ASSERT (xfs_get_projid (ip) ==be32_to_cpu (pdqp->q_core.d_id)); +ASSERT (ip->i_d.di_projid ==be32_to_cpu (pdqp->q_core.d_id)); ip->i_pdquot =xfs_qm_dqhold (pdqp);xfs_trans_mod_dquot (tp, pdqp,XFS_TRANS_DQ_ICOUNT ,1 );
fs/xfs/xfs_qm_bhv.c +1 -1
@@ -60,7 +60,7 @@ xfs_qm_statvfs(xfs_mount_t *mp = ip->i_mount;xfs_dquot_t *dqp; -if (!xfs_qm_dqget (mp,xfs_get_projid (ip),XFS_DQ_PROJ , false, &dqp)) { +if (!xfs_qm_dqget (mp, ip->i_d.di_projid,XFS_DQ_PROJ , false, &dqp)) {xfs_fill_statvfs_from_dquot (statp, dqp);xfs_qm_dqput (dqp); }
Signature · 1 line
2.20.1
Re: [PATCH 2/4] xfs: merge the projid fields in struct xfs_icdinode
Quoted 4 lines · Christoph Hellwig
There is no point in splitting the fields like this in an purely in-memory structure.
Signed-off-by Christoph Hellwig <[email protected]>
Looks ok, will give it a spin...
--D
Quoted 298 lines
--- fs/xfs/libxfs/xfs_inode_buf.c | 11 +++++------ fs/xfs/libxfs/xfs_inode_buf.h | 3 +-- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_icache.c | 4 ++-- fs/xfs/xfs_inode.c | 6 +++--- fs/xfs/xfs_inode.h | 21 +-------------------- fs/xfs/xfs_inode_item.c | 4 ++-- fs/xfs/xfs_ioctl.c | 8 ++++---- fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_itable.c | 2 +- fs/xfs/xfs_qm.c | 8 ++++---- fs/xfs/xfs_qm_bhv.c | 2 +- 12 files changed, 26 insertions(+), 47 deletions(-)fs/xfs/libxfs/xfs_inode_buf.c +5
-6@@ -213,13 +213,12 @@ xfs_inode_from_disk( to->di_version = from->di_version;if (to->di_version ==1 ) {set_nlink (inode,be16_to_cpu (from->di_onlink)); - to->di_projid_lo =0 ; - to->di_projid_hi =0 ; + to->di_projid =0 ; to->di_version =2 ; }else {set_nlink (inode,be32_to_cpu (from->di_nlink)); - to->di_projid_lo =be16_to_cpu (from->di_projid_lo); - to->di_projid_hi =be16_to_cpu (from->di_projid_hi); + to->di_projid = (prid_t )be16_to_cpu (from->di_projid_hi) <<16 | +be16_to_cpu (from->di_projid_lo); } to->di_format = from->di_format;@@ -279,8 +278,8 @@ xfs_inode_to_disk( to->di_format = from->di_format; to->di_uid =cpu_to_be32 (from->di_uid); to->di_gid =cpu_to_be32 (from->di_gid); - to->di_projid_lo =cpu_to_be16 (from->di_projid_lo); - to->di_projid_hi =cpu_to_be16 (from->di_projid_hi); + to->di_projid_lo =cpu_to_be16 (from->di_projid &0xffff ); + to->di_projid_hi =cpu_to_be16 (from->di_projid >>16 );memset (to->di_pad,0 ,sizeof (to->di_pad)); to->di_atime.t_sec =cpu_to_be32 (inode->i_atime.tv_sec);fs/xfs/libxfs/xfs_inode_buf.h +1
-2@@ -21,8 +21,7 @@ struct xfs_icdinode {uint16_t di_flushiter;/* incremented on flush */ uint32_t di_uid;/* owner's user id */ uint32_t di_gid;/* owner's group id */ -uint16_t di_projid_lo;/* lower part of owner's project id */ -uint16_t di_projid_hi;/* higher part of owner's project id */ +uint32_t di_projid;/* owner's project id */ xfs_fsize_t di_size;/* number of bytes in file */ xfs_rfsblock_t di_nblocks;/* # of direct & btree blocks used */ xfs_extlen_t di_extsize;/* basic/minimum extent size for file */ fs/xfs/xfs_dquot.c +1
-1@@ -833,7 +833,7 @@ xfs_qm_id_for_quotatype(case XFS_DQ_GROUP :return ip->i_d.di_gid;case XFS_DQ_PROJ : -return xfs_get_projid (ip); +return ip->i_d.di_projid; }ASSERT (0 );return 0 ;fs/xfs/xfs_icache.c +2
-2@@ -1419,7 +1419,7 @@ xfs_inode_match_id(return 0 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && -xfs_get_projid (ip) != eofb->eof_prid) + ip->i_d.di_projid != eofb->eof_prid)return 0 ;return 1 ;@@ -1443,7 +1443,7 @@ xfs_inode_match_id_union(return 1 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && -xfs_get_projid (ip) == eofb->eof_prid) + ip->i_d.di_projid == eofb->eof_prid)return 1 ;return 0 ;fs/xfs/xfs_inode.c +3
-3@@ -809,7 +809,7 @@ xfs_ialloc( ip->i_d.di_uid =xfs_kuid_to_uid (current_fsuid ()); ip->i_d.di_gid =xfs_kgid_to_gid (current_fsgid ()); inode->i_rdev = rdev; -xfs_set_projid (ip, prid); + ip->i_d.di_projid = prid;if (pip &&XFS_INHERIT_GID (pip)) { ip->i_d.di_gid = pip->i_d.di_gid;@@ -1417,7 +1417,7 @@ xfs_link(* the tree quota mechanism could be circumvented. */ if (unlikely ((tdp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && - (xfs_get_projid (tdp) !=xfs_get_projid (sip)))) { + tdp->i_d.di_projid != sip->i_d.di_projid)) { error = -EXDEV ; goto error_return; }@@ -3269,7 +3269,7 @@ xfs_rename(* tree quota mechanism would be circumvented. */ if (unlikely ((target_dp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && - (xfs_get_projid (target_dp) !=xfs_get_projid (src_ip)))) { + target_dp->i_d.di_projid != src_ip->i_d.di_projid)) { error = -EXDEV ; goto out_trans_cancel; }fs/xfs/xfs_inode.h +1
-20@@ -177,30 +177,11 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)return ret; } -/* -* Project quota id helpers (previously projid was 16bit only -* and using two 16bit values to hold new 32bit projid was chosen -* to retain compatibility with "old" filesystems). -*/ -static inline prid_t -xfs_get_projid (struct xfs_inode *ip) -{ -return (prid_t )ip->i_d.di_projid_hi <<16 | ip->i_d.di_projid_lo; -} - -static inline void -xfs_set_projid (struct xfs_inode *ip, -prid_t projid) -{ - ip->i_d.di_projid_hi = (uint16_t ) (projid >>16 ); - ip->i_d.di_projid_lo = (uint16_t ) (projid &0xffff ); -} -static inline prid_t xfs_get_initial_prid (struct xfs_inode *dp) {if (dp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) -return xfs_get_projid (dp); +return dp->i_d.di_projid;return XFS_PROJID_DEFAULT ; }fs/xfs/xfs_inode_item.c +2
-2@@ -309,8 +309,8 @@ xfs_inode_to_log_dinode( to->di_format = from->di_format; to->di_uid = from->di_uid; to->di_gid = from->di_gid; - to->di_projid_lo = from->di_projid_lo; - to->di_projid_hi = from->di_projid_hi; + to->di_projid_lo = from->di_projid &0xffff ; + to->di_projid_hi = from->di_projid >>16 ;memset (to->di_pad,0 ,sizeof (to->di_pad));memset (to->di_pad3,0 ,sizeof (to->di_pad3));fs/xfs/xfs_ioctl.c +4
-4@@ -1116,7 +1116,7 @@ xfs_fill_fsxattr( fa->fsx_extsize = ip->i_d.di_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 =xfs_get_projid (ip); + fa->fsx_projid = ip->i_d.di_projid;if (attr) {if (ip->i_afp) {@@ -1569,7 +1569,7 @@ xfs_ioctl_setattr( }if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp) && -xfs_get_projid (ip) != fa->fsx_projid) { + ip->i_d.di_projid != fa->fsx_projid) { code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */ @@ -1606,13 +1606,13 @@ xfs_ioctl_setattr(VFS_I (ip)->i_mode &= ~(S_ISUID |S_ISGID );/* Change the ownerships and register project quota modifications */ -if (xfs_get_projid (ip) != fa->fsx_projid) { +if (ip->i_d.di_projid != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, &ip->i_pdquot, pdqp); }ASSERT (ip->i_d.di_version >1 ); -xfs_set_projid (ip, fa->fsx_projid); + ip->i_d.di_projid = fa->fsx_projid; }/* fs/xfs/xfs_iops.c +1
-1@@ -663,7 +663,7 @@ xfs_setattr_nonsize(ASSERT (gdqp ==NULL ); error =xfs_qm_vop_dqalloc (ip,xfs_kuid_to_uid (uid),xfs_kgid_to_gid (gid), -xfs_get_projid (ip), + ip->i_d.di_projid, qflags, &udqp, &gdqp,NULL );if (error)return error;fs/xfs/xfs_itable.c +1
-1@@ -84,7 +84,7 @@ xfs_bulkstat_one_int(/* xfs_iget returns the following without needing * further change. */ - buf->bs_projectid =xfs_get_projid (ip); + buf->bs_projectid = ip->i_d.di_projid; buf->bs_ino = ino; buf->bs_uid = dic->di_uid; buf->bs_gid = dic->di_gid;fs/xfs/xfs_qm.c +4
-4@@ -341,7 +341,7 @@ xfs_qm_dqattach_locked( }if (XFS_IS_PQUOTA_ON (mp) && !ip->i_pdquot) { - error =xfs_qm_dqattach_one (ip,xfs_get_projid (ip),XFS_DQ_PROJ , + error =xfs_qm_dqattach_one (ip, ip->i_d.di_projid,XFS_DQ_PROJ , doalloc, &ip->i_pdquot);if (error) goto done;@@ -1693,7 +1693,7 @@ xfs_qm_vop_dqalloc( } }if ((flags &XFS_QMOPT_PQUOTA ) &&XFS_IS_PQUOTA_ON (mp)) { -if (xfs_get_projid (ip) != prid) { +if (ip->i_d.di_projid != prid) {xfs_iunlock (ip, lockflags); error =xfs_qm_dqget (mp, (xfs_dqid_t )prid,XFS_DQ_PROJ , true, &pq);@@ -1827,7 +1827,7 @@ xfs_qm_vop_chown_reserve( }if (XFS_IS_PQUOTA_ON (ip->i_mount) && pdqp && -xfs_get_projid (ip) !=be32_to_cpu (pdqp->q_core.d_id)) { + ip->i_d.di_projid !=be32_to_cpu (pdqp->q_core.d_id)) { prjflags =XFS_QMOPT_ENOSPC ; pdq_delblks = pdqp;if (delblks) {@@ -1928,7 +1928,7 @@ xfs_qm_vop_create_dqattach( }if (pdqp &&XFS_IS_PQUOTA_ON (mp)) {ASSERT (ip->i_pdquot ==NULL ); -ASSERT (xfs_get_projid (ip) ==be32_to_cpu (pdqp->q_core.d_id)); +ASSERT (ip->i_d.di_projid ==be32_to_cpu (pdqp->q_core.d_id)); ip->i_pdquot =xfs_qm_dqhold (pdqp);xfs_trans_mod_dquot (tp, pdqp,XFS_TRANS_DQ_ICOUNT ,1 );fs/xfs/xfs_qm_bhv.c +1
-1@@ -60,7 +60,7 @@ xfs_qm_statvfs(xfs_mount_t *mp = ip->i_mount;xfs_dquot_t *dqp; -if (!xfs_qm_dqget (mp,xfs_get_projid (ip),XFS_DQ_PROJ , false, &dqp)) { +if (!xfs_qm_dqget (mp, ip->i_d.di_projid,XFS_DQ_PROJ , false, &dqp)) {xfs_fill_statvfs_from_dquot (statp, dqp);xfs_qm_dqput (dqp); }Signature · 1 line
2.20.1
PATCH 3/4 xfs: don't reset the "inode core" in xfs_iread
In reply to Christoph HellwigWe have the exact same memset in xfs_inode_alloc, which is always called just before xfs_iread.
--- fs/xfs/libxfs/xfs_inode_buf.c | 2 -- 1 file changed, 2 deletions(-)
fs/xfs/libxfs/xfs_inode_buf.c +0 -2
@@ -631,8 +631,6 @@ xfs_iread(if ((iget_flags &XFS_IGET_CREATE ) &&xfs_sb_version_hascrc (&mp->m_sb) && !(mp->m_flags &XFS_MOUNT_IKEEP )) { -/* initialise the on-disk inode core */ -memset (&ip->i_d,0 ,sizeof (ip->i_d));VFS_I (ip)->i_generation =prandom_u32 (); ip->i_d.di_version =3 ;return 0 ;
Signature · 1 line
2.20.1
Re: [PATCH 3/4] xfs: don't reset the "inode core" in xfs_iread
Quoted 4 lines · Christoph Hellwig
We have the exact same memset in
xfs_inode_alloc, which is always called just beforexfs_iread.Signed-off-by Christoph Hellwig <[email protected]>
Seems fine on its own, but then I looked at all the zero initializers and memsets in xfs_inode_alloc and wondered why we don't just kmem_zone_zalloc the inode?
Anyways,
--D
Quoted 20 lines
--- fs/xfs/libxfs/xfs_inode_buf.c | 2 -- 1 file changed, 2 deletions(-)fs/xfs/libxfs/xfs_inode_buf.c +0
-2@@ -631,8 +631,6 @@ xfs_iread(if ((iget_flags &XFS_IGET_CREATE ) &&xfs_sb_version_hascrc (&mp->m_sb) && !(mp->m_flags &XFS_MOUNT_IKEEP )) { -/* initialise the on-disk inode core */ -memset (&ip->i_d,0 ,sizeof (ip->i_d));VFS_I (ip)->i_generation =prandom_u32 (); ip->i_d.di_version =3 ;return 0 ;Signature · 1 line
2.20.1
Re: [PATCH 3/4] xfs: don't reset the "inode core" in xfs_iread
Quoted 9 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
We have the exact same memset in
xfs_inode_alloc, which is always called just beforexfs_iread.Signed-off-by Christoph Hellwig <[email protected]>Seems fine on its own, but then I looked at all the zero initializers and memsets in
xfs_inode_allocand wondered why we don't justkmem_zone_zallocthe inode?
Because kmem_zone_zalloc doesn't interact well with the rcu lookup schemes and the constructor. That being said I have some plans for this area as part of getting rid of the "dinode core" later on.
PATCH 4/4 xfs: remove struct xfs_icdinode
In reply to Christoph HellwigThere is no point in having this sub-structure except for historical reasons. Remove it and just fold the fields into struct xfs_inode.
--- fs/xfs/libxfs/xfs_attr.c | 16 +-- fs/xfs/libxfs/xfs_attr_leaf.c | 44 +++---- fs/xfs/libxfs/xfs_bmap.c | 54 ++++----- fs/xfs/libxfs/xfs_bmap_btree.c | 10 +- fs/xfs/libxfs/xfs_da_btree.c | 4 +- fs/xfs/libxfs/xfs_dir2.c | 22 ++-- fs/xfs/libxfs/xfs_dir2_block.c | 12 +- fs/xfs/libxfs/xfs_dir2_node.c | 2 +- fs/xfs/libxfs/xfs_dir2_sf.c | 50 ++++---- fs/xfs/libxfs/xfs_inode_buf.c | 107 ++++++++-------- fs/xfs/libxfs/xfs_inode_buf.h | 30 ----- fs/xfs/libxfs/xfs_inode_fork.c | 8 +- fs/xfs/libxfs/xfs_inode_fork.h | 24 ++-- fs/xfs/libxfs/xfs_rtbitmap.c | 4 +- fs/xfs/libxfs/xfs_symlink_remote.c | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 2 +- fs/xfs/scrub/common.c | 2 +- fs/xfs/scrub/dir.c | 10 +- fs/xfs/scrub/parent.c | 4 +- fs/xfs/scrub/symlink.c | 2 +- fs/xfs/xfs_aops.c | 6 +- fs/xfs/xfs_attr_inactive.c | 3 +- fs/xfs/xfs_attr_list.c | 2 +- fs/xfs/xfs_bmap_util.c | 88 +++++++------- fs/xfs/xfs_dir2_readdir.c | 4 +- fs/xfs/xfs_dquot.c | 6 +- fs/xfs/xfs_file.c | 14 +-- fs/xfs/xfs_filestream.h | 2 +- fs/xfs/xfs_icache.c | 34 +++++- fs/xfs/xfs_inode.c | 189 ++++++++++++++--------------- fs/xfs/xfs_inode.h | 32 +++-- fs/xfs/xfs_inode_item.c | 71 ++++++----- fs/xfs/xfs_ioctl.c | 64 +++++----- fs/xfs/xfs_iomap.c | 6 +- fs/xfs/xfs_iops.c | 36 +++--- fs/xfs/xfs_itable.c | 31 +++-- fs/xfs/xfs_linux.h | 2 +- fs/xfs/xfs_log_recover.c | 4 +- fs/xfs/xfs_pnfs.c | 2 +- fs/xfs/xfs_qm.c | 36 +++--- fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 4 +- fs/xfs/xfs_quotaops.c | 4 +- fs/xfs/xfs_reflink.c | 14 +-- fs/xfs/xfs_rtalloc.c | 12 +- fs/xfs/xfs_super.c | 4 +- fs/xfs/xfs_symlink.c | 24 ++-- fs/xfs/xfs_trace.h | 20 +-- 48 files changed, 562 insertions(+), 563 deletions(-)
fs/xfs/libxfs/xfs_attr.c +8 -8
@@ -87,8 +87,8 @@ xfs_inode_hasattr( struct xfs_inode *ip) {if (!XFS_IFORK_Q (ip) || - (ip->i_d.di_aformat ==XFS_DINODE_FMT_EXTENTS && - ip->i_d.di_anextents ==0 )) + (ip->i_aformat ==XFS_DINODE_FMT_EXTENTS && + ip->i_anextents ==0 ))return 0 ;return 1 ; }
@@ -110,7 +110,7 @@ xfs_attr_get_ilocked(if (!xfs_inode_hasattr (ip))return -ENOATTR ; -else if (ip->i_d.di_aformat ==XFS_DINODE_FMT_LOCAL ) +else if (ip->i_aformat ==XFS_DINODE_FMT_LOCAL )return xfs_attr_shortform_getvalue (args);else if (xfs_bmap_one_block (ip,XFS_ATTR_FORK ))return xfs_attr_leaf_get (args);
@@ -262,14 +262,14 @@ xfs_attr_set_args(* If the attribute list is non-existent or a shortform list, * upgrade it to a single-leaf-block attribute list. */ -if (dp->i_d.di_aformat ==XFS_DINODE_FMT_LOCAL || - (dp->i_d.di_aformat ==XFS_DINODE_FMT_EXTENTS && - dp->i_d.di_anextents ==0 )) { +if (dp->i_aformat ==XFS_DINODE_FMT_LOCAL || + (dp->i_aformat ==XFS_DINODE_FMT_EXTENTS && + dp->i_anextents ==0 )) {/* * Build initial attribute list (if required). */ -if (dp->i_d.di_aformat ==XFS_DINODE_FMT_EXTENTS ) +if (dp->i_aformat ==XFS_DINODE_FMT_EXTENTS )xfs_attr_shortform_create (args);/*
@@ -322,7 +322,7 @@ xfs_attr_remove_args(if (!xfs_inode_hasattr (dp)) { error = -ENOATTR ; - }else if (dp->i_d.di_aformat ==XFS_DINODE_FMT_LOCAL ) { + }else if (dp->i_aformat ==XFS_DINODE_FMT_LOCAL ) {ASSERT (dp->i_afp->if_flags &XFS_IFINLINE ); error =xfs_attr_shortform_remove (args); }else if (xfs_bmap_one_block (dp,XFS_ATTR_FORK )) {
fs/xfs/libxfs/xfs_attr_leaf.c +22 -22
133 lines not on this page · raw message
fs/xfs/libxfs/xfs_bmap.c +27 -27
163 lines not on this page · raw message
fs/xfs/libxfs/xfs_bmap_btree.c +5 -5
@@ -183,7 +183,7 @@ xfs_bmbt_update_cursor( struct xfs_btree_cur *dst) {ASSERT ((dst->bc_tp->t_firstblock !=NULLFSBLOCK ) || - (dst->bc_private.b.ip->i_d.di_flags &XFS_DIFLAG_REALTIME )); + (dst->bc_private.b.ip->i_diflags &XFS_DIFLAG_REALTIME )); dst->bc_private.b.allocated += src->bc_private.b.allocated; dst->bc_tp->t_firstblock = src->bc_tp->t_firstblock;
@@ -260,7 +260,7 @@ xfs_bmbt_alloc_block(ASSERT (args.len ==1 ); cur->bc_tp->t_firstblock = args.fsbno; cur->bc_private.b.allocated++; - cur->bc_private.b.ip->i_d.di_nblocks++; + cur->bc_private.b.ip->i_nblocks++;xfs_trans_log_inode (args.tp, cur->bc_private.b.ip,XFS_ILOG_CORE );xfs_trans_mod_dquot_byino (args.tp, cur->bc_private.b.ip,XFS_TRANS_DQ_BCOUNT ,1L );
@@ -287,7 +287,7 @@ xfs_bmbt_free_block(xfs_rmap_ino_bmbt_owner (&oinfo, ip->i_ino, cur->bc_private.b.whichfork);xfs_bmap_add_free (cur->bc_tp, fsbno,1 , &oinfo); - ip->i_d.di_nblocks--; + ip->i_nblocks--;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );xfs_trans_mod_dquot_byino (tp, ip,XFS_TRANS_DQ_BCOUNT ,-1L );
@@ -637,9 +637,9 @@ xfs_bmbt_change_owner(ASSERT (tp || buffer_list);ASSERT (!(tp && buffer_list));if (whichfork ==XFS_DATA_FORK ) -ASSERT (ip->i_d.di_format ==XFS_DINODE_FMT_BTREE ); +ASSERT (ip->i_format ==XFS_DINODE_FMT_BTREE );else -ASSERT (ip->i_d.di_aformat ==XFS_DINODE_FMT_BTREE ); +ASSERT (ip->i_aformat ==XFS_DINODE_FMT_BTREE ); cur =xfs_bmbt_init_cursor (ip->i_mount, tp, ip, whichfork);if (!cur)
fs/xfs/libxfs/xfs_da_btree.c +2 -2
@@ -2065,7 +2065,7 @@ xfs_da_grow_inode_int(struct xfs_trans *tp = args->trans;struct xfs_inode *dp = args->dp;int w = args->whichfork; -xfs_rfsblock_t nblks = dp->i_d.di_nblocks; +xfs_rfsblock_t nblks = dp->i_nblocks;struct xfs_bmbt_irec map, *mapp;int nmap, error, got, i, mapi;
@@ -2131,7 +2131,7 @@ xfs_da_grow_inode_int( }/* account for newly allocated blocks in reserved blocks total */ - args->total -= dp->i_d.di_nblocks - nblks; + args->total -= dp->i_nblocks - nblks; out_free_map:if (mapp != &map)
fs/xfs/libxfs/xfs_dir2.c +11 -11
@@ -173,9 +173,9 @@ xfs_dir_isempty(xfs_dir2_sf_hdr_t *sfp;ASSERT (S_ISDIR (VFS_I (dp)->i_mode)); -if (dp->i_d.di_size ==0 )/* might happen during shutdown. */ +if (dp->i_disk_size ==0 )/* might happen during shutdown. */ return 1 ; -if (dp->i_d.di_size >XFS_IFORK_DSIZE (dp)) +if (dp->i_disk_size >XFS_IFORK_DSIZE (dp))return 0 ; sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;return !sfp->count;
@@ -272,7 +272,7 @@ xfs_dir_createname(if (!inum) args->op_flags |=XFS_DA_OP_JUSTCHECK ; -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) { +if (dp->i_format ==XFS_DINODE_FMT_LOCAL ) { rval =xfs_dir2_sf_addname (args); goto out_free; }
@@ -367,7 +367,7 @@ xfs_dir_lookup( args->op_flags |=XFS_DA_OP_CILOOKUP ; lock_mode =xfs_ilock_data_map_shared (dp); -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) { +if (dp->i_format ==XFS_DINODE_FMT_LOCAL ) { rval =xfs_dir2_sf_lookup (args); goto out_check_rval; }
@@ -437,7 +437,7 @@ xfs_dir_removename( args->whichfork =XFS_DATA_FORK ; args->trans = tp; -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) { +if (dp->i_format ==XFS_DINODE_FMT_LOCAL ) { rval =xfs_dir2_sf_removename (args); goto out_free; }
@@ -498,7 +498,7 @@ xfs_dir_replace( args->whichfork =XFS_DATA_FORK ; args->trans = tp; -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) { +if (dp->i_format ==XFS_DINODE_FMT_LOCAL ) { rval =xfs_dir2_sf_replace (args); goto out_free; }
@@ -578,8 +578,8 @@ xfs_dir2_grow_inode(xfs_fsize_t size;/* directory file (data) size */ size =XFS_FSB_TO_B (mp, bno + count); -if (size > dp->i_d.di_size) { - dp->i_d.di_size = size; +if (size > dp->i_disk_size) { + dp->i_disk_size = size;xfs_trans_log_inode (args->trans, dp,XFS_ILOG_CORE ); } }
@@ -600,7 +600,7 @@ xfs_dir2_isblock(if ((rval =xfs_bmap_last_offset (args->dp, &last,XFS_DATA_FORK )))return rval; rval =XFS_FSB_TO_B (args->dp->i_mount, last) == args->geo->blksize; -if (rval !=0 && args->dp->i_d.di_size != args->geo->blksize) +if (rval !=0 && args->dp->i_disk_size != args->geo->blksize)return -EFSCORRUPTED ; *vp = rval;return 0 ;
@@ -679,7 +679,7 @@ xfs_dir2_shrink_inode(/* * If the block isn't the last one in the directory, we're done. */ -if (dp->i_d.di_size >xfs_dir2_db_off_to_byte (args->geo, db +1 ,0 )) +if (dp->i_disk_size >xfs_dir2_db_off_to_byte (args->geo, db +1 ,0 ))return 0 ; bno = da;if ((error =xfs_bmap_last_before (tp, dp, &bno,XFS_DATA_FORK ))) {
@@ -695,7 +695,7 @@ xfs_dir2_shrink_inode(/* * Set the size to the new last block. */ - dp->i_d.di_size =XFS_FSB_TO_B (mp, bno); + dp->i_disk_size =XFS_FSB_TO_B (mp, bno);xfs_trans_log_inode (tp, dp,XFS_ILOG_CORE );return 0 ; }
fs/xfs/libxfs/xfs_dir2_block.c +6 -6
@@ -935,7 +935,7 @@ xfs_dir2_leaf_to_block(* been left behind during no-space-reservation operations. * These will show up in the leaf bests table. */ -while (dp->i_d.di_size > args->geo->blksize) { +while (dp->i_disk_size > args->geo->blksize) {int hdrsz; hdrsz = dp->d_ops->data_entry_offset;
@@ -1076,17 +1076,17 @@ xfs_dir2_sf_to_block(/* * Bomb out if the shortform directory is way too short. */ -if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t , parent)) { +if (dp->i_disk_size < offsetof(xfs_dir2_sf_hdr_t , parent)) {ASSERT (XFS_FORCED_SHUTDOWN (mp));return -EIO ; } oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; -ASSERT (ifp->if_bytes == dp->i_d.di_size); +ASSERT (ifp->if_bytes == dp->i_disk_size);ASSERT (ifp->if_u1.if_data !=NULL ); -ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (oldsfp->i8count)); -ASSERT (dp->i_d.di_nextents ==0 ); +ASSERT (dp->i_disk_size >=xfs_dir2_sf_hdr_size (oldsfp->i8count)); +ASSERT (dp->i_nextents ==0 );/* * Copy the directory into a temporary buffer.
@@ -1097,7 +1097,7 @@ xfs_dir2_sf_to_block(xfs_idata_realloc (dp, -ifp->if_bytes,XFS_DATA_FORK );xfs_bmap_local_to_extents_empty (tp, dp,XFS_DATA_FORK ); - dp->i_d.di_size =0 ; + dp->i_disk_size =0 ;/* * Add block 0 to the inode.
fs/xfs/libxfs/xfs_dir2_node.c +1 -1
@@ -373,7 +373,7 @@ xfs_dir2_leaf_to_node( leaf = lbp->b_addr; ltp =xfs_dir2_leaf_tail_p (args->geo, leaf);if (be32_to_cpu (ltp->bestcount) > - (uint )dp->i_d.di_size / args->geo->blksize) + (uint )dp->i_disk_size / args->geo->blksize)return -EFSCORRUPTED ;/*
fs/xfs/libxfs/xfs_dir2_sf.c +25 -25
165 lines not on this page · raw message
fs/xfs/libxfs/xfs_inode_buf.c +52 -55
176 lines not on this page · raw message
fs/xfs/libxfs/xfs_inode_buf.h +0 -30
@@ -9,36 +9,6 @@struct xfs_inode ;struct xfs_dinode ; -/* -* In memory representation of the XFS inode. This is held in the in-core struct -* xfs_inode and represents the current on disk values but the structure is not -* in on-disk format. That is, this structure is always translated to on-disk -* format specific structures at the appropriate time. -*/ -struct xfs_icdinode { -int8_t di_version;/* inode version */ -int8_t di_format;/* format of di_c data */ -uint16_t di_flushiter;/* incremented on flush */ -uint32_t di_uid;/* owner's user id */ -uint32_t di_gid;/* owner's group id */ -uint32_t di_projid;/* owner's project id */ -xfs_fsize_t di_size;/* number of bytes in file */ -xfs_rfsblock_t di_nblocks;/* # of direct & btree blocks used */ -xfs_extlen_t di_extsize;/* basic/minimum extent size for file */ -xfs_extnum_t di_nextents;/* number of extents in data fork */ -xfs_aextnum_t di_anextents;/* number of extents in attribute fork*/ -uint8_t di_forkoff;/* attr fork offs, <<3 for 64b align */ -int8_t di_aformat;/* format of attr fork's data */ -uint32_t di_dmevmask;/* DMIG event mask */ -uint16_t di_dmstate;/* DMIG state info */ -uint16_t di_flags;/* random flags, XFS_DIFLAG_... */ - -uint64_t di_flags2;/* more random flags */ -uint32_t di_cowextsize;/* basic cow extent size for file */ - -struct timespec64 di_crtime;/* time created */ -}; -/* * Inode location information. Stored in the inode and passed to * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
fs/xfs/libxfs/xfs_inode_fork.c +4 -4
@@ -55,7 +55,7 @@ xfs_iformat_fork(case S_IFCHR :case S_IFBLK :case S_IFSOCK : - ip->i_d.di_size =0 ; + ip->i_disk_size =0 ; inode->i_rdev =xfs_to_linux_dev_t (xfs_dinode_get_rdev (dip));break ;
@@ -291,7 +291,7 @@ xfs_iformat_btree( nrecs == 0 || XFS_BMDR_SPACE_CALC(nrecs) > XFS_DFORK_SIZE(dip, mp, whichfork) || - XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks) || + XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_nblocks) || level == 0 || level > XFS_BTREE_MAXLEVELS) {xfs_warn (mp,"corrupt inode %Lu (btree)." , (unsigned long long ) ip->i_ino);
@@ -703,7 +703,7 @@ xfs_ifork_verify_data( struct xfs_ifork_ops *ops) {/* Non-local data fork, we're done. */ -if (ip->i_d.di_format !=XFS_DINODE_FMT_LOCAL ) +if (ip->i_format !=XFS_DINODE_FMT_LOCAL )return NULL ;/* Check the inline data fork if there is one. */
@@ -724,7 +724,7 @@ xfs_ifork_verify_attr( struct xfs_ifork_ops *ops) {/* There has to be an attr fork allocated if aformat is local. */ -if (ip->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ) +if (ip->i_aformat !=XFS_DINODE_FMT_LOCAL )return NULL ;if (!XFS_IFORK_PTR (ip,XFS_ATTR_FORK ))return __this_address;
fs/xfs/libxfs/xfs_inode_fork.h +12 -12
@@ -36,8 +36,8 @@ struct xfs_ifork {* Fork handling. */ -#define XFS_IFORK_Q (ip) ((ip)->i_d.di_forkoff != 0) -#define XFS_IFORK_BOFF (ip) ((int)((ip)->i_d.di_forkoff << 3)) +#define XFS_IFORK_Q (ip) ((ip)->i_forkoff != 0) +#define XFS_IFORK_BOFF (ip) ((int)((ip)->i_forkoff << 3))#define XFS_IFORK_PTR (ip,w) \ ((w) == XFS_DATA_FORK ? \
@@ -48,10 +48,10 @@ struct xfs_ifork {#define XFS_IFORK_DSIZE (ip) \ (XFS_IFORK_Q(ip) ? \ XFS_IFORK_BOFF(ip) : \ - XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version)) + XFS_LITINO((ip)->i_mount, (ip)->i_version))#define XFS_IFORK_ASIZE (ip) \ (XFS_IFORK_Q(ip) ? \ - XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version) - \ + XFS_LITINO((ip)->i_mount, (ip)->i_version) - \ XFS_IFORK_BOFF(ip) : \ 0)#define XFS_IFORK_SIZE (ip,w) \
@@ -62,27 +62,27 @@ struct xfs_ifork { 0))#define XFS_IFORK_FORMAT (ip,w) \ ((w) == XFS_DATA_FORK ? \ - (ip)->i_d.di_format : \ + (ip)->i_format : \ ((w) == XFS_ATTR_FORK ? \ - (ip)->i_d.di_aformat : \ + (ip)->i_aformat : \ (ip)->i_cformat))#define XFS_IFORK_FMT_SET (ip,w,n) \ ((w) == XFS_DATA_FORK ? \ - ((ip)->i_d.di_format = (n)) : \ + ((ip)->i_format = (n)) : \ ((w) == XFS_ATTR_FORK ? \ - ((ip)->i_d.di_aformat = (n)) : \ + ((ip)->i_aformat = (n)) : \ ((ip)->i_cformat = (n))))#define XFS_IFORK_NEXTENTS (ip,w) \ ((w) == XFS_DATA_FORK ? \ - (ip)->i_d.di_nextents : \ + (ip)->i_nextents : \ ((w) == XFS_ATTR_FORK ? \ - (ip)->i_d.di_anextents : \ + (ip)->i_anextents : \ (ip)->i_cnextents))#define XFS_IFORK_NEXT_SET (ip,w,n) \ ((w) == XFS_DATA_FORK ? \ - ((ip)->i_d.di_nextents = (n)) : \ + ((ip)->i_nextents = (n)) : \ ((w) == XFS_ATTR_FORK ? \ - ((ip)->i_d.di_anextents = (n)) : \ + ((ip)->i_anextents = (n)) : \ ((ip)->i_cnextents = (n))))#define XFS_IFORK_MAXEXT (ip, w) \ (XFS_IFORK_SIZE(ip, w) / sizeof(xfs_bmbt_rec_t))
fs/xfs/libxfs/xfs_rtbitmap.c +2 -2
@@ -997,8 +997,8 @@ xfs_rtfree_extent(*/ if (tp->t_frextents_delta + mp->m_sb.sb_frextents == mp->m_sb.sb_rextents) { -if (!(mp->m_rbmip->i_d.di_flags &XFS_DIFLAG_NEWRTBM )) - mp->m_rbmip->i_d.di_flags |=XFS_DIFLAG_NEWRTBM ; +if (!(mp->m_rbmip->i_diflags &XFS_DIFLAG_NEWRTBM )) + mp->m_rbmip->i_diflags |=XFS_DIFLAG_NEWRTBM ; *(uint64_t *)&VFS_I (mp->m_rbmip)->i_atime =0 ;xfs_trans_log_inode (tp, mp->m_rbmip,XFS_ILOG_CORE ); }
fs/xfs/libxfs/xfs_symlink_remote.c +1 -1
@@ -209,7 +209,7 @@ xfs_symlink_shortform_verify(struct xfs_ifork *ifp;int size; -ASSERT (ip->i_d.di_format ==XFS_DINODE_FMT_LOCAL ); +ASSERT (ip->i_format ==XFS_DINODE_FMT_LOCAL ); ifp =XFS_IFORK_PTR (ip,XFS_DATA_FORK ); sfp = (char *)ifp->if_u1.if_data; size = ifp->if_bytes;
fs/xfs/libxfs/xfs_trans_inode.c +1 -1
@@ -67,7 +67,7 @@ xfs_trans_ichgtime(if (flags &XFS_ICHGTIME_CHG ) inode->i_ctime = tv;if (flags &XFS_ICHGTIME_CREATE ) - ip->i_d.di_crtime = tv; + ip->i_crtime = tv; }/*
fs/xfs/scrub/common.c +1 -1
@@ -835,7 +835,7 @@ xchk_metadata_inode_forks(return 0 ;/* Metadata inodes don't live on the rt device. */ -if (sc->ip->i_d.di_flags &XFS_DIFLAG_REALTIME ) { +if (sc->ip->i_diflags &XFS_DIFLAG_REALTIME ) {xchk_ino_set_corrupt (sc, sc->ip->i_ino);return 0 ; }
fs/xfs/scrub/dir.c +5 -5
@@ -515,7 +515,7 @@ xchk_directory_leaf1_bestfree(* There should be as many bestfree slots as there are dir data * blocks that can fit under i_size. */ -if (bestcount !=xfs_dir2_byte_to_db (geo, sc->ip->i_d.di_size)) { +if (bestcount !=xfs_dir2_byte_to_db (geo, sc->ip->i_disk_size)) {xchk_fblock_set_corrupt (sc,XFS_DATA_FORK , lblk); goto out; }
@@ -638,8 +638,8 @@ xchk_directory_blocks(int error;/* Ignore local format directories. */ -if (sc->ip->i_d.di_format !=XFS_DINODE_FMT_EXTENTS && - sc->ip->i_d.di_format !=XFS_DINODE_FMT_BTREE ) +if (sc->ip->i_format !=XFS_DINODE_FMT_EXTENTS && + sc->ip->i_format !=XFS_DINODE_FMT_BTREE )return 0 ; ifp =XFS_IFORK_PTR (sc->ip,XFS_DATA_FORK );
@@ -781,7 +781,7 @@ xchk_directory(return -ENOENT ;/* Plausible size? */ -if (sc->ip->i_d.di_size <xfs_dir2_sf_hdr_size (0 )) { +if (sc->ip->i_disk_size <xfs_dir2_sf_hdr_size (0 )) {xchk_ino_set_corrupt (sc, sc->ip->i_ino); goto out; }
@@ -807,7 +807,7 @@ xchk_directory(* Userspace usually asks for a 32k buffer, so we will too. */ bufsize = (size_t )min_t (loff_t,XFS_READDIR_BUFSIZE , - sc->ip->i_d.di_size); + sc->ip->i_disk_size);/* * Look up every name in this directory by hash.
fs/xfs/scrub/parent.c +2 -2
@@ -79,7 +79,7 @@ xchk_parent_count_parent_dentries(* if there is one. */ lock_mode =xfs_ilock_data_map_shared (parent); -if (parent->i_d.di_nextents >0 ) +if (parent->i_nextents >0 ) error =xfs_dir3_data_readahead (parent,0 ,-1 );xfs_iunlock (parent, lock_mode);if (error)
@@ -91,7 +91,7 @@ xchk_parent_count_parent_dentries(* scanned. */ bufsize = (size_t )min_t (loff_t,XFS_READDIR_BUFSIZE , - parent->i_d.di_size); + parent->i_disk_size); oldpos =0 ;while (true) { error =xfs_readdir (sc->tp, parent, &spc.dc, bufsize);
fs/xfs/scrub/symlink.c +1 -1
@@ -43,7 +43,7 @@ xchk_symlink(if (!S_ISLNK (VFS_I (ip)->i_mode))return -ENOENT ; ifp =XFS_IFORK_PTR (ip,XFS_DATA_FORK ); - len = ip->i_d.di_size; + len = ip->i_disk_size;/* Plausible size? */ if (len >XFS_SYMLINK_MAXLEN || len <=0 ) {
fs/xfs/xfs_aops.c +3 -3
@@ -122,7 +122,7 @@ xfs_destroy_ioend(static inline bool xfs_ioend_is_append (struct xfs_ioend *ioend) {return ioend->io_offset + ioend->io_size > -XFS_I (ioend->io_inode)->i_d.di_size; +XFS_I (ioend->io_inode)->i_disk_size; }STATIC int
@@ -174,7 +174,7 @@ __xfs_setfilesize(trace_xfs_setfilesize (ip, offset, size); - ip->i_d.di_size = isize; + ip->i_disk_size = isize;xfs_trans_ijoin (tp, ip,XFS_ILOCK_EXCL );xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );
@@ -530,7 +530,7 @@ xfs_map_blocks(*/ retry:xfs_ilock (ip,XFS_ILOCK_SHARED ); -ASSERT (ip->i_d.di_format !=XFS_DINODE_FMT_BTREE || +ASSERT (ip->i_format !=XFS_DINODE_FMT_BTREE || (ip->i_df.if_flags &XFS_IFEXTENTS ));/*
fs/xfs/xfs_attr_inactive.c +1 -2
@@ -412,8 +412,7 @@ xfs_attr_inactive(* blocks to read and returns an error. In this case, just do the fork * removal below. */ -if (xfs_inode_hasattr (dp) && - dp->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ) { +if (xfs_inode_hasattr (dp) && dp->i_aformat !=XFS_DINODE_FMT_LOCAL ) { error =xfs_attr3_root_inactive (&trans, dp);if (error) goto out_cancel;
fs/xfs/xfs_attr_list.c +1 -1
@@ -501,7 +501,7 @@ xfs_attr_list_int_ilocked(*/ if (!xfs_inode_hasattr (dp))return 0 ; -else if (dp->i_d.di_aformat ==XFS_DINODE_FMT_LOCAL ) +else if (dp->i_aformat ==XFS_DINODE_FMT_LOCAL )return xfs_attr_shortform_list (context);else if (xfs_bmap_one_block (dp,XFS_ATTR_FORK ))return xfs_attr_leaf_list (context);
fs/xfs/xfs_bmap_util.c +44 -44
223 lines not on this page · raw message
fs/xfs/xfs_dir2_readdir.c +2 -2
@@ -56,7 +56,7 @@ xfs_dir2_sf_getdents(struct xfs_da_geometry *geo = args->geo;ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); -ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); +ASSERT (dp->i_df.if_bytes == dp->i_disk_size);ASSERT (dp->i_df.if_u1.if_data !=NULL ); sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
@@ -513,7 +513,7 @@ xfs_readdir( args.geo = dp->i_mount->m_dir_geo; args.trans = tp; -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) +if (dp->i_format ==XFS_DINODE_FMT_LOCAL ) rval =xfs_dir2_sf_getdents (&args, ctx);else if ((rval =xfs_dir2_isblock (&args, &v))) ;
fs/xfs/xfs_dquot.c +3 -3
@@ -829,11 +829,11 @@ xfs_qm_id_for_quotatype( {switch (type) {case XFS_DQ_USER : -return ip->i_d.di_uid; +return ip->i_uid;case XFS_DQ_GROUP : -return ip->i_d.di_gid; +return ip->i_gid;case XFS_DQ_PROJ : -return ip->i_d.di_projid; +return ip->i_projid; }ASSERT (0 );return 0 ;
fs/xfs/xfs_file.c +7 -7
@@ -56,9 +56,9 @@ xfs_update_prealloc_flags( }if (flags &XFS_PREALLOC_SET ) - ip->i_d.di_flags |=XFS_DIFLAG_PREALLOC ; + ip->i_diflags |=XFS_DIFLAG_PREALLOC ;if (flags &XFS_PREALLOC_CLEAR ) - ip->i_d.di_flags &= ~XFS_DIFLAG_PREALLOC ; + ip->i_diflags &= ~XFS_DIFLAG_PREALLOC ;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );if (flags &XFS_PREALLOC_SYNC )
@@ -1012,10 +1012,10 @@ xfs_file_remap_range(*/ cowextsize =0 ;if (pos_in ==0 && len ==i_size_read (inode_in) && - (src->i_d.di_flags2 &XFS_DIFLAG2_COWEXTSIZE ) && + (src->i_diflags2 &XFS_DIFLAG2_COWEXTSIZE ) && pos_out ==0 && len >=i_size_read (inode_out) && - !(dest->i_d.di_flags2 &XFS_DIFLAG2_COWEXTSIZE )) - cowextsize = src->i_d.di_cowextsize; + !(dest->i_diflags2 &XFS_DIFLAG2_COWEXTSIZE )) + cowextsize = src->i_cowextsize; ret =xfs_reflink_update_dest (dest, pos_out + len, cowextsize, remap_flags);
@@ -1058,7 +1058,7 @@ xfs_dir_open(* certain to have the next operation be a read there. */ mode =xfs_ilock_data_map_shared (ip); -if (ip->i_d.di_nextents >0 ) +if (ip->i_nextents >0 ) error =xfs_dir3_data_readahead (ip,0 ,-1 );xfs_iunlock (ip, mode);return error;
@@ -1093,7 +1093,7 @@ xfs_file_readdir(* point we can change the ->readdir prototype to include the * buffer size. For now we use the current glibc buffer size. */ - bufsize = (size_t )min_t (loff_t,XFS_READDIR_BUFSIZE , ip->i_d.di_size); + bufsize = (size_t )min_t (loff_t,XFS_READDIR_BUFSIZE , ip->i_disk_size);return xfs_readdir (NULL , ip, ctx, bufsize); }
fs/xfs/xfs_filestream.h +1 -1
@@ -22,7 +22,7 @@ xfs_inode_is_filestream( struct xfs_inode *ip) {return (ip->i_mount->m_flags &XFS_MOUNT_FILESTREAMS ) || - (ip->i_d.di_flags &XFS_DIFLAG_FILESTREAM ); + (ip->i_diflags &XFS_DIFLAG_FILESTREAM ); }#endif /* __XFS_FILESTREAM_H__ */
fs/xfs/xfs_icache.c +28 -6
@@ -62,12 +62,34 @@ xfs_inode_alloc(memset (&ip->i_imap,0 ,sizeof (struct xfs_imap )); ip->i_afp =NULL ; ip->i_cowfp =NULL ; - ip->i_cnextents =0 ; - ip->i_cformat =XFS_DINODE_FMT_EXTENTS ;memset (&ip->i_df,0 ,sizeof (ip->i_df)); + ip->i_flags =0 ; ip->i_delayed_blks =0 ; -memset (&ip->i_d,0 ,sizeof (ip->i_d)); + + ip->i_version =0 ; + ip->i_format =0 ; + ip->i_flushiter =0 ; + ip->i_uid =0 ; + ip->i_gid =0 ; + ip->i_projid =0 ; + ip->i_disk_size =0 ; + ip->i_nblocks =0 ; + ip->i_extsize =0 ; + ip->i_nextents =0 ; + ip->i_anextents =0 ; + ip->i_forkoff =0 ; + ip->i_aformat =0 ; + ip->i_dmevmask =0 ; + ip->i_dmstate =0 ; + ip->i_diflags =0 ; + ip->i_diflags2 =0 ; + ip->i_cowextsize =0 ; + ip->i_crtime.tv_sec =0 ; + ip->i_crtime.tv_nsec =0 ; + ip->i_cnextents =0 ; + ip->i_cformat =XFS_DINODE_FMT_EXTENTS ; + ip->i_sick =0 ; ip->i_checked =0 ;INIT_WORK (&ip->i_ioend_work, xfs_end_io);
@@ -324,7 +346,7 @@ xfs_iget_check_free_state(return -EFSCORRUPTED ; } -if (ip->i_d.di_nblocks !=0 ) { +if (ip->i_nblocks !=0 ) {xfs_warn (ip->i_mount,"Corruption detected! Free inode 0x%llx has blocks allocated!" , ip->i_ino);
@@ -1419,7 +1441,7 @@ xfs_inode_match_id(return 0 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && - ip->i_d.di_projid != eofb->eof_prid) + ip->i_projid != eofb->eof_prid)return 0 ;return 1 ;
@@ -1443,7 +1465,7 @@ xfs_inode_match_id_union(return 1 ;if ((eofb->eof_flags &XFS_EOF_FLAGS_PRID ) && - ip->i_d.di_projid == eofb->eof_prid) + ip->i_projid == eofb->eof_prid)return 1 ;return 0 ;
fs/xfs/xfs_inode.c +94 -95
411 lines not on this page · raw message
fs/xfs/xfs_inode.h +24 -8
@@ -58,8 +58,25 @@ typedef struct xfs_inode {unsigned long i_flags;/* see defined flags below */ uint64_t i_delayed_blks;/* count of delay alloc blks */ -struct xfs_icdinode i_d;/* most of ondisk inode */ - +int8_t i_version;/* inode version */ +int8_t i_format;/* data fork format */ +uint16_t i_flushiter;/* incremented on flush */ +uint32_t i_uid;/* owner's user id */ +uint32_t i_gid;/* owner's group id */ +uint16_t i_projid;/* owner's project id */ +xfs_fsize_t i_disk_size;/* number of bytes in file */ +xfs_rfsblock_t i_nblocks;/* direct & btree blocks used */ +xfs_extlen_t i_extsize;/* extent size hint */ +xfs_extnum_t i_nextents;/* # of extents in data fork */ +xfs_aextnum_t i_anextents;/* # of extents in attr fork */ +uint8_t i_forkoff;/* attr fork offset */ +int8_t i_aformat;/* attr fork format */ +uint32_t i_dmevmask;/* DMIG event mask */ +uint16_t i_dmstate;/* DMIG state info */ +uint16_t i_diflags;/* random flags */ +uint64_t i_diflags2;/* more random flags */ +uint32_t i_cowextsize;/* cow extent size hint */ +struct timespec64 i_crtime;/* time created */ xfs_extnum_t i_cnextents;/* # of extents in cow fork */ unsigned int i_cformat;/* format of cow fork */
@@ -93,7 +110,7 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip) {if (S_ISREG (VFS_I (ip)->i_mode))return i_size_read (VFS_I (ip)); -return ip->i_d.di_size; +return ip->i_disk_size; }/*
@@ -107,7 +124,7 @@ xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)if (new_size > i_size || new_size <0 ) new_size = i_size; -return new_size > ip->i_d.di_size ? new_size :0 ; +return new_size > ip->i_disk_size ? new_size :0 ; }/*
@@ -180,15 +197,14 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)static inline prid_t xfs_get_initial_prid (struct xfs_inode *dp) { -if (dp->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) -return dp->i_d.di_projid; - +if (dp->i_diflags &XFS_DIFLAG_PROJINHERIT ) +return dp->i_projid;return XFS_PROJID_DEFAULT ; }static inline bool xfs_is_reflink_inode (struct xfs_inode *ip) { -return ip->i_d.di_flags2 &XFS_DIFLAG2_REFLINK ; +return ip->i_diflags2 &XFS_DIFLAG2_REFLINK ; }/*
fs/xfs/xfs_inode_item.c +35 -36
164 lines not on this page · raw message
fs/xfs/xfs_ioctl.c +32 -32
175 lines not on this page · raw message
fs/xfs/xfs_iomap.c +3 -3
@@ -805,7 +805,7 @@ xfs_iomap_write_unwritten(i_size_write (inode, i_size); i_size =xfs_new_eof (ip, i_size);if (i_size) { - ip->i_d.di_size = i_size; + ip->i_disk_size = i_size;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); }
@@ -1247,12 +1247,12 @@ xfs_xattr_iomap_begin( lockmode =xfs_ilock_attr_map_shared (ip);/* if there are no attribute fork or extents, return ENOENT */ -if (!XFS_IFORK_Q (ip) || !ip->i_d.di_anextents) { +if (!XFS_IFORK_Q (ip) || !ip->i_anextents) { error = -ENOENT ; goto out_unlock; } -ASSERT (ip->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ); +ASSERT (ip->i_aformat !=XFS_DINODE_FMT_LOCAL ); error =xfs_bmapi_read (ip, offset_fsb, end_fsb - offset_fsb, &imap, &nimaps,XFS_BMAPI_ATTRFORK ); out_unlock:
fs/xfs/xfs_iops.c +18 -18
@@ -511,12 +511,12 @@ xfs_vn_getattr( stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; stat->blocks = -XFS_FSB_TO_BB (mp, ip->i_d.di_nblocks + ip->i_delayed_blks); +XFS_FSB_TO_BB (mp, ip->i_nblocks + ip->i_delayed_blks); -if (ip->i_d.di_version ==3 ) { +if (ip->i_version ==3 ) {if (request_mask &STATX_BTIME ) { stat->result_mask |=STATX_BTIME ; - stat->btime = ip->i_d.di_crtime; + stat->btime = ip->i_crtime; } }
@@ -524,11 +524,11 @@ xfs_vn_getattr(* Note: If you add another clause to set an attribute flag, please * update attributes_mask below. */ -if (ip->i_d.di_flags &XFS_DIFLAG_IMMUTABLE ) +if (ip->i_diflags &XFS_DIFLAG_IMMUTABLE ) stat->attributes |=STATX_ATTR_IMMUTABLE ; -if (ip->i_d.di_flags &XFS_DIFLAG_APPEND ) +if (ip->i_diflags &XFS_DIFLAG_APPEND ) stat->attributes |=STATX_ATTR_APPEND ; -if (ip->i_d.di_flags &XFS_DIFLAG_NODUMP ) +if (ip->i_diflags &XFS_DIFLAG_NODUMP ) stat->attributes |=STATX_ATTR_NODUMP ; stat->attributes_mask |= (STATX_ATTR_IMMUTABLE |
@@ -663,7 +663,7 @@ xfs_setattr_nonsize(ASSERT (gdqp ==NULL ); error =xfs_qm_vop_dqalloc (ip,xfs_kuid_to_uid (uid),xfs_kgid_to_gid (gid), - ip->i_d.di_projid, + ip->i_projid, qflags, &udqp, &gdqp,NULL );if (error)return error;
@@ -732,7 +732,7 @@ xfs_setattr_nonsize( olddquot1 =xfs_qm_vop_chown (tp, ip, &ip->i_udquot, udqp); } - ip->i_d.di_uid =xfs_kuid_to_uid (uid); + ip->i_uid =xfs_kuid_to_uid (uid); inode->i_uid = uid; }if (!gid_eq (igid, gid)) {
@@ -744,7 +744,7 @@ xfs_setattr_nonsize( olddquot2 =xfs_qm_vop_chown (tp, ip, &ip->i_gdquot, gdqp); } - ip->i_d.di_gid =xfs_kgid_to_gid (gid); + ip->i_gid =xfs_kgid_to_gid (gid); inode->i_gid = gid; } }
@@ -846,7 +846,7 @@ xfs_setattr_size(/* * Short circuit the truncate case for zero length files. */ -if (newsize ==0 && oldsize ==0 && ip->i_d.di_nextents ==0 ) { +if (newsize ==0 && oldsize ==0 && ip->i_nextents ==0 ) {if (!(iattr->ia_valid & (ATTR_CTIME |ATTR_MTIME )))return 0 ;
@@ -923,9 +923,9 @@ xfs_setattr_size(* otherwise those blocks may not be zeroed after a crash. */ if (did_zeroing || - (newsize > ip->i_d.di_size && oldsize != ip->i_d.di_size)) { + (newsize > ip->i_disk_size && oldsize != ip->i_disk_size)) { error =filemap_write_and_wait_range (VFS_I (ip)->i_mapping, - ip->i_d.di_size, newsize -1 ); + ip->i_disk_size, newsize -1 );if (error)return error; }
@@ -967,7 +967,7 @@ xfs_setattr_size(* permanent before actually freeing any blocks it doesn't matter if * they get written to. */ - ip->i_d.di_size = newsize; + ip->i_disk_size = newsize;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );if (newsize <= oldsize) {
@@ -1218,7 +1218,7 @@ xfs_inode_supports_dax(/* DAX mount option or DAX iflag must be set. */ if (!(mp->m_flags &XFS_MOUNT_DAX ) && - !(ip->i_d.di_flags2 &XFS_DIFLAG2_DAX )) + !(ip->i_diflags2 &XFS_DIFLAG2_DAX ))return false;/* Block size must match page size */
@@ -1234,7 +1234,7 @@ xfs_diflags_to_iflags(struct inode *inode, struct xfs_inode *ip) { - uint16_t flags = ip->i_d.di_flags; + uint16_t flags = ip->i_diflags; inode->i_flags &= ~(S_IMMUTABLE |S_APPEND |S_SYNC |S_NOATIME |S_DAX );
@@ -1273,10 +1273,10 @@ xfs_setup_inode(/* make the inode look hashed for the writeback code */ inode_fake_hash (inode); - inode->i_uid =xfs_uid_to_kuid (ip->i_d.di_uid); - inode->i_gid =xfs_gid_to_kgid (ip->i_d.di_gid); + inode->i_uid =xfs_uid_to_kuid (ip->i_uid); + inode->i_gid =xfs_gid_to_kgid (ip->i_gid); -i_size_write (inode, ip->i_d.di_size); +i_size_write (inode, ip->i_disk_size);xfs_diflags_to_iflags (inode, ip);if (S_ISDIR (inode->i_mode)) {
fs/xfs/xfs_itable.c +14 -17
@@ -58,7 +58,6 @@ xfs_bulkstat_one_int(xfs_ino_t ino, struct xfs_bstat_chunk *bc) { - struct xfs_icdinode *dic; /* dinode core info pointer */ struct xfs_inode *ip; /* incore inode pointer */struct inode *inode;struct xfs_bulkstat *buf = bc->buf;
@@ -79,16 +78,14 @@ xfs_bulkstat_one_int(ASSERT (ip->i_imap.im_blkno !=0 ); inode =VFS_I (ip); - dic = &ip->i_d; -/* xfs_iget returns the following without needing * further change. */ - buf->bs_projectid = ip->i_d.di_projid; + buf->bs_projectid = ip->i_projid; buf->bs_ino = ino; - buf->bs_uid = dic->di_uid; - buf->bs_gid = dic->di_gid; - buf->bs_size = dic->di_size; + buf->bs_uid = ip->i_uid; + buf->bs_gid = ip->i_gid; + buf->bs_size = ip->i_disk_size; buf->bs_nlink = inode->i_nlink; buf->bs_atime = inode->i_atime.tv_sec;
@@ -97,25 +94,25 @@ xfs_bulkstat_one_int( buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; buf->bs_ctime = inode->i_ctime.tv_sec; buf->bs_ctime_nsec = inode->i_ctime.tv_nsec; - buf->bs_btime = dic->di_crtime.tv_sec; - buf->bs_btime_nsec = dic->di_crtime.tv_nsec; + buf->bs_btime = ip->i_crtime.tv_sec; + buf->bs_btime_nsec = ip->i_crtime.tv_nsec; buf->bs_gen = inode->i_generation; buf->bs_mode = inode->i_mode; buf->bs_xflags =xfs_ip2xflags (ip); - buf->bs_extsize_blks = dic->di_extsize; - buf->bs_extents = dic->di_nextents; + buf->bs_extsize_blks = ip->i_extsize; + buf->bs_extents = ip->i_nextents;xfs_bulkstat_health (ip, buf); - buf->bs_aextents = dic->di_anextents; + buf->bs_aextents = ip->i_anextents; buf->bs_forkoff =XFS_IFORK_BOFF (ip); buf->bs_version =XFS_BULKSTAT_VERSION_V5 ; -if (dic->di_version ==3 ) { -if (dic->di_flags2 &XFS_DIFLAG2_COWEXTSIZE ) - buf->bs_cowextsize_blks = dic->di_cowextsize; +if (ip->i_version ==3 ) { +if (ip->i_diflags2 &XFS_DIFLAG2_COWEXTSIZE ) + buf->bs_cowextsize_blks = ip->i_cowextsize; } -switch (dic->di_format) { +switch (ip->i_format) {case XFS_DINODE_FMT_DEV : buf->bs_rdev =sysv_encode_dev (inode->i_rdev); buf->bs_blksize =BLKDEV_IOSIZE ;
@@ -130,7 +127,7 @@ xfs_bulkstat_one_int(case XFS_DINODE_FMT_BTREE : buf->bs_rdev =0 ; buf->bs_blksize = mp->m_sb.sb_blocksize; - buf->bs_blocks = dic->di_nblocks + ip->i_delayed_blks; + buf->bs_blocks = ip->i_nblocks + ip->i_delayed_blks;break ; }xfs_iunlock (ip,XFS_ILOCK_SHARED );
fs/xfs/xfs_linux.h +1 -1
@@ -252,7 +252,7 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,* configured realtime device. */ #define XFS_IS_REALTIME_INODE (ip) \ - (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) && \ + (((ip)->i_diflags & XFS_DIFLAG_REALTIME) && \ (ip)->i_mount->m_rtdev_targp)#define XFS_IS_REALTIME_MOUNT (mp) ((mp)->m_rtdev_targp ? 1 : 0)#else
fs/xfs/xfs_log_recover.c +2 -2
@@ -2876,7 +2876,7 @@ xfs_recover_inode_owner_change(/* instantiate the inode */ xfs_inode_from_disk (ip, dip); -ASSERT (ip->i_d.di_version >=3 ); +ASSERT (ip->i_version >=3 ); error =xfs_iformat_fork (ip, dip);if (error)
@@ -5003,7 +5003,7 @@ xlog_recover_process_one_iunlink(* Prevent any DMAPI event from being sent when the reference on * the inode is dropped. */ - ip->i_d.di_dmevmask =0 ; + ip->i_dmevmask =0 ;xfs_irele (ip);return agino;
fs/xfs/xfs_pnfs.c +1 -1
@@ -291,7 +291,7 @@ xfs_fs_commit_blocks(xfs_setattr_time (ip, iattr);if (update_isize) {i_size_write (inode, iattr->ia_size); - ip->i_d.di_size = iattr->ia_size; + ip->i_disk_size = iattr->ia_size; }xfs_trans_set_sync (tp);
fs/xfs/xfs_qm.c +18 -18
@@ -325,7 +325,7 @@ xfs_qm_dqattach_locked(ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL ));if (XFS_IS_UQUOTA_ON (mp) && !ip->i_udquot) { - error =xfs_qm_dqattach_one (ip, ip->i_d.di_uid,XFS_DQ_USER , + error =xfs_qm_dqattach_one (ip, ip->i_uid,XFS_DQ_USER , doalloc, &ip->i_udquot);if (error) goto done;
@@ -333,7 +333,7 @@ xfs_qm_dqattach_locked( }if (XFS_IS_GQUOTA_ON (mp) && !ip->i_gdquot) { - error =xfs_qm_dqattach_one (ip, ip->i_d.di_gid,XFS_DQ_GROUP , + error =xfs_qm_dqattach_one (ip, ip->i_gid,XFS_DQ_GROUP , doalloc, &ip->i_gdquot);if (error) goto done;
@@ -341,7 +341,7 @@ xfs_qm_dqattach_locked( }if (XFS_IS_PQUOTA_ON (mp) && !ip->i_pdquot) { - error =xfs_qm_dqattach_one (ip, ip->i_d.di_projid,XFS_DQ_PROJ , + error =xfs_qm_dqattach_one (ip, ip->i_projid,XFS_DQ_PROJ , doalloc, &ip->i_pdquot);if (error) goto done;
@@ -975,7 +975,7 @@ xfs_qm_reset_dqcounts_buf(* trans_reserve. But, this gets called during quotacheck, and that * happens only at mount time which is single threaded. */ -if (qip->i_d.di_nblocks ==0 ) +if (qip->i_nblocks ==0 )return 0 ; map =kmem_alloc (XFS_DQITER_MAP_SIZE *sizeof (*map),0 );
@@ -1157,7 +1157,7 @@ xfs_qm_dqusage_adjust(xfs_bmap_count_leaves (ifp, &rtblks); } - nblks = (xfs_qcnt_t )ip->i_d.di_nblocks - rtblks; + nblks = (xfs_qcnt_t )ip->i_nblocks - rtblks;/* * Add the (disk blocks and inode) resources occupied by this
@@ -1630,7 +1630,7 @@ xfs_qm_vop_dqalloc(xfs_ilock (ip, lockflags);if ((flags &XFS_QMOPT_INHERIT ) &&XFS_INHERIT_GID (ip)) - gid = ip->i_d.di_gid; + gid = ip->i_gid;/* * Attach the dquot(s) to this inode, doing a dquot allocation
@@ -1645,7 +1645,7 @@ xfs_qm_vop_dqalloc( }if ((flags &XFS_QMOPT_UQUOTA ) &&XFS_IS_UQUOTA_ON (mp)) { -if (ip->i_d.di_uid != uid) { +if (ip->i_uid != uid) {/* * What we need is the dquot that has this uid, and * if we send the inode to dqget, the uid of the inode
@@ -1677,7 +1677,7 @@ xfs_qm_vop_dqalloc( } }if ((flags &XFS_QMOPT_GQUOTA ) &&XFS_IS_GQUOTA_ON (mp)) { -if (ip->i_d.di_gid != gid) { +if (ip->i_gid != gid) {xfs_iunlock (ip, lockflags); error =xfs_qm_dqget (mp, gid,XFS_DQ_GROUP , true, &gq);if (error) {
@@ -1693,7 +1693,7 @@ xfs_qm_vop_dqalloc( } }if ((flags &XFS_QMOPT_PQUOTA ) &&XFS_IS_PQUOTA_ON (mp)) { -if (ip->i_d.di_projid != prid) { +if (ip->i_projid != prid) {xfs_iunlock (ip, lockflags); error =xfs_qm_dqget (mp, (xfs_dqid_t )prid,XFS_DQ_PROJ , true, &pq);
@@ -1757,11 +1757,11 @@ xfs_qm_vop_chown(ASSERT (prevdq);ASSERT (prevdq != newdq); -xfs_trans_mod_dquot (tp, prevdq, bfield, -(ip->i_d.di_nblocks)); +xfs_trans_mod_dquot (tp, prevdq, bfield, -(ip->i_nblocks));xfs_trans_mod_dquot (tp, prevdq,XFS_TRANS_DQ_ICOUNT ,-1 );/* the sparkling new dquot */ -xfs_trans_mod_dquot (tp, newdq, bfield, ip->i_d.di_nblocks); +xfs_trans_mod_dquot (tp, newdq, bfield, ip->i_nblocks);xfs_trans_mod_dquot (tp, newdq,XFS_TRANS_DQ_ICOUNT ,1 );/*
@@ -1805,7 +1805,7 @@ xfs_qm_vop_chown_reserve( XFS_QMOPT_RES_RTBLKS :XFS_QMOPT_RES_REGBLKS ;if (XFS_IS_UQUOTA_ON (mp) && udqp && - ip->i_d.di_uid !=be32_to_cpu (udqp->q_core.d_id)) { + ip->i_uid !=be32_to_cpu (udqp->q_core.d_id)) { udq_delblks = udqp;/* * If there are delayed allocation blocks, then we have to
@@ -1818,7 +1818,7 @@ xfs_qm_vop_chown_reserve( } }if (XFS_IS_GQUOTA_ON (ip->i_mount) && gdqp && - ip->i_d.di_gid !=be32_to_cpu (gdqp->q_core.d_id)) { + ip->i_gid !=be32_to_cpu (gdqp->q_core.d_id)) { gdq_delblks = gdqp;if (delblks) {ASSERT (ip->i_gdquot);
@@ -1827,7 +1827,7 @@ xfs_qm_vop_chown_reserve( }if (XFS_IS_PQUOTA_ON (ip->i_mount) && pdqp && - ip->i_d.di_projid !=be32_to_cpu (pdqp->q_core.d_id)) { + ip->i_projid !=be32_to_cpu (pdqp->q_core.d_id)) { prjflags =XFS_QMOPT_ENOSPC ; pdq_delblks = pdqp;if (delblks) {
@@ -1838,7 +1838,7 @@ xfs_qm_vop_chown_reserve( error =xfs_trans_reserve_quota_bydquots (tp, ip->i_mount, udq_delblks, gdq_delblks, pdq_delblks, - ip->i_d.di_nblocks,1 , + ip->i_nblocks,1 , flags | blkflags | prjflags);if (error)return error;
@@ -1915,20 +1915,20 @@ xfs_qm_vop_create_dqattach(if (udqp &&XFS_IS_UQUOTA_ON (mp)) {ASSERT (ip->i_udquot ==NULL ); -ASSERT (ip->i_d.di_uid ==be32_to_cpu (udqp->q_core.d_id)); +ASSERT (ip->i_uid ==be32_to_cpu (udqp->q_core.d_id)); ip->i_udquot =xfs_qm_dqhold (udqp);xfs_trans_mod_dquot (tp, udqp,XFS_TRANS_DQ_ICOUNT ,1 ); }if (gdqp &&XFS_IS_GQUOTA_ON (mp)) {ASSERT (ip->i_gdquot ==NULL ); -ASSERT (ip->i_d.di_gid ==be32_to_cpu (gdqp->q_core.d_id)); +ASSERT (ip->i_gid ==be32_to_cpu (gdqp->q_core.d_id)); ip->i_gdquot =xfs_qm_dqhold (gdqp);xfs_trans_mod_dquot (tp, gdqp,XFS_TRANS_DQ_ICOUNT ,1 ); }if (pdqp &&XFS_IS_PQUOTA_ON (mp)) {ASSERT (ip->i_pdquot ==NULL ); -ASSERT (ip->i_d.di_projid ==be32_to_cpu (pdqp->q_core.d_id)); +ASSERT (ip->i_projid ==be32_to_cpu (pdqp->q_core.d_id)); ip->i_pdquot =xfs_qm_dqhold (pdqp);xfs_trans_mod_dquot (tp, pdqp,XFS_TRANS_DQ_ICOUNT ,1 );
fs/xfs/xfs_qm_bhv.c +1 -1
@@ -60,7 +60,7 @@ xfs_qm_statvfs(xfs_mount_t *mp = ip->i_mount;xfs_dquot_t *dqp; -if (!xfs_qm_dqget (mp, ip->i_d.di_projid,XFS_DQ_PROJ , false, &dqp)) { +if (!xfs_qm_dqget (mp, ip->i_projid,XFS_DQ_PROJ , false, &dqp)) {xfs_fill_statvfs_from_dquot (statp, dqp);xfs_qm_dqput (dqp); }
fs/xfs/xfs_qm_syscalls.c +2 -2
@@ -229,7 +229,7 @@ xfs_qm_scall_trunc_qfile(xfs_ilock (ip,XFS_ILOCK_EXCL );xfs_trans_ijoin (tp, ip,0 ); - ip->i_d.di_size =0 ; + ip->i_disk_size =0 ;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); error =xfs_itruncate_extents (&tp, ip,XFS_DATA_FORK ,0 );
@@ -238,7 +238,7 @@ xfs_qm_scall_trunc_qfile( goto out_unlock; } -ASSERT (ip->i_d.di_nextents ==0 ); +ASSERT (ip->i_nextents ==0 );xfs_trans_ichgtime (tp, ip,XFS_ICHGTIME_MOD |XFS_ICHGTIME_CHG ); error =xfs_trans_commit (tp);
fs/xfs/xfs_quotaops.c +2 -2
@@ -35,8 +35,8 @@ xfs_qm_fill_state( tempqip = true; } tstate->flags |=QCI_SYSFILE ; - tstate->blocks = ip->i_d.di_nblocks; - tstate->nextents = ip->i_d.di_nextents; + tstate->blocks = ip->i_nblocks; + tstate->nextents = ip->i_nextents; tstate->spc_timelimit = q->qi_btimelimit; tstate->ino_timelimit = q->qi_itimelimit; tstate->rt_spc_timelimit = q->qi_rtbtimelimit;
fs/xfs/xfs_reflink.c +7 -7
@@ -884,7 +884,7 @@ xfs_reflink_set_inode_flag(if (!xfs_is_reflink_inode (src)) {trace_xfs_reflink_set_inode_flag (src);xfs_trans_ijoin (tp, src,XFS_ILOCK_EXCL ); - src->i_d.di_flags2 |=XFS_DIFLAG2_REFLINK ; + src->i_diflags2 |=XFS_DIFLAG2_REFLINK ;xfs_trans_log_inode (tp, src,XFS_ILOG_CORE );xfs_ifork_init_cow (src); }else
@@ -896,7 +896,7 @@ xfs_reflink_set_inode_flag(if (!xfs_is_reflink_inode (dest)) {trace_xfs_reflink_set_inode_flag (dest);xfs_trans_ijoin (tp, dest,XFS_ILOCK_EXCL ); - dest->i_d.di_flags2 |=XFS_DIFLAG2_REFLINK ; + dest->i_diflags2 |=XFS_DIFLAG2_REFLINK ;xfs_trans_log_inode (tp, dest,XFS_ILOG_CORE );xfs_ifork_init_cow (dest); }else
@@ -940,12 +940,12 @@ xfs_reflink_update_dest(if (newlen >i_size_read (VFS_I (dest))) {trace_xfs_reflink_update_inode_size (dest, newlen);i_size_write (VFS_I (dest), newlen); - dest->i_d.di_size = newlen; + dest->i_disk_size = newlen; }if (cowextsize) { - dest->i_d.di_cowextsize = cowextsize; - dest->i_d.di_flags2 |=XFS_DIFLAG2_COWEXTSIZE ; + dest->i_cowextsize = cowextsize; + dest->i_diflags2 |=XFS_DIFLAG2_COWEXTSIZE ; }xfs_trans_log_inode (tp, dest,XFS_ILOG_CORE );
@@ -1079,7 +1079,7 @@ xfs_reflink_remap_extent(if (newlen >i_size_read (VFS_I (ip))) {trace_xfs_reflink_update_inode_size (ip, newlen);i_size_write (VFS_I (ip), newlen); - ip->i_d.di_size = newlen; + ip->i_disk_size = newlen;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); }
@@ -1542,7 +1542,7 @@ xfs_reflink_clear_inode_flag(/* Clear the inode flag. */ trace_xfs_reflink_unset_inode_flag (ip); - ip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK ; + ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK ;xfs_inode_clear_cowblocks_tag (ip);xfs_trans_log_inode (*tpp, ip,XFS_ILOG_CORE );
fs/xfs/xfs_rtalloc.c +6 -6
@@ -944,8 +944,8 @@ xfs_growfs_rt(* Get the old block counts for bitmap and summary inodes. * These can't change since other growfs callers are locked out. */ - rbmblocks =XFS_B_TO_FSB (mp, mp->m_rbmip->i_d.di_size); - rsumblocks =XFS_B_TO_FSB (mp, mp->m_rsumip->i_d.di_size); + rbmblocks =XFS_B_TO_FSB (mp, mp->m_rbmip->i_disk_size); + rsumblocks =XFS_B_TO_FSB (mp, mp->m_rsumip->i_disk_size);/* * Allocate space to the bitmap and summary files, as necessary. */
@@ -1012,7 +1012,7 @@ xfs_growfs_rt(/* * Update the bitmap inode's size. */ - mp->m_rbmip->i_d.di_size = + mp->m_rbmip->i_disk_size = nsbp->sb_rbmblocks * nsbp->sb_blocksize;xfs_trans_log_inode (tp, mp->m_rbmip,XFS_ILOG_CORE );/*
@@ -1023,7 +1023,7 @@ xfs_growfs_rt(/* * Update the summary inode's size. */ - mp->m_rsumip->i_d.di_size = nmp->m_rsumsize; + mp->m_rsumip->i_disk_size = nmp->m_rsumsize;xfs_trans_log_inode (tp, mp->m_rsumip,XFS_ILOG_CORE );/* * Copy summary data from old to new sizes.
@@ -1284,8 +1284,8 @@ xfs_rtpick_extent(ASSERT (xfs_isilocked (mp->m_rbmip,XFS_ILOCK_EXCL )); seqp = (uint64_t *)&VFS_I (mp->m_rbmip)->i_atime; -if (!(mp->m_rbmip->i_d.di_flags &XFS_DIFLAG_NEWRTBM )) { - mp->m_rbmip->i_d.di_flags |=XFS_DIFLAG_NEWRTBM ; +if (!(mp->m_rbmip->i_diflags &XFS_DIFLAG_NEWRTBM )) { + mp->m_rbmip->i_diflags |=XFS_DIFLAG_NEWRTBM ; *seqp =0 ; } seq = *seqp;
fs/xfs/xfs_super.c +2 -2
@@ -1125,13 +1125,13 @@ xfs_fs_statfs( statp->f_ffree =max_t (int64_t, ffree,0 ); -if ((ip->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && +if ((ip->i_diflags &XFS_DIFLAG_PROJINHERIT ) && ((mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))) == (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))xfs_qm_statvfs (ip, statp);if (XFS_IS_REALTIME_MOUNT (mp) && - (ip->i_d.di_flags & (XFS_DIFLAG_RTINHERIT |XFS_DIFLAG_REALTIME ))) { + (ip->i_diflags & (XFS_DIFLAG_RTINHERIT |XFS_DIFLAG_REALTIME ))) { statp->f_blocks = sbp->sb_rblocks; statp->f_bavail = statp->f_bfree = sbp->sb_frextents * sbp->sb_rextsize;
fs/xfs/xfs_symlink.c +12 -12
@@ -32,7 +32,7 @@ xfs_readlink_bmap_ilocked(struct xfs_buf *bp;xfs_daddr_t d;char *cur_chunk; -int pathlen = ip->i_d.di_size; +int pathlen = ip->i_disk_size;int nmaps =XFS_SYMLINK_MAPS ;int byte_cnt;int n;
@@ -95,7 +95,7 @@ xfs_readlink_bmap_ilocked( }ASSERT (pathlen ==0 ); - link[ip->i_d.di_size] ='\0' ; + link[ip->i_disk_size] ='\0' ; error =0 ; out:
@@ -120,7 +120,7 @@ xfs_readlink(xfs_ilock (ip,XFS_ILOCK_SHARED ); - pathlen = ip->i_d.di_size; + pathlen = ip->i_disk_size;if (!pathlen) goto out;
@@ -203,7 +203,7 @@ xfs_symlink(* The symlink will fit into the inode data fork? * There can't be any attributes so we get the whole variable part. */ -if (pathlen <=XFS_LITINO (mp, dp->i_d.di_version)) +if (pathlen <=XFS_LITINO (mp, dp->i_version)) fs_blocks =0 ;else fs_blocks =xfs_symlink_blocks (mp, pathlen);
@@ -219,7 +219,7 @@ xfs_symlink(/* * Check whether the directory allows new symlinks or not. */ -if (dp->i_d.di_flags &XFS_DIFLAG_NOSYMLINKS ) { +if (dp->i_diflags &XFS_DIFLAG_NOSYMLINKS ) { error = -EPERM ; goto out_trans_cancel; }
@@ -263,8 +263,8 @@ xfs_symlink(if (pathlen <=XFS_IFORK_DSIZE (ip)) {xfs_init_local_fork (ip,XFS_DATA_FORK , target_path, pathlen); - ip->i_d.di_size = pathlen; - ip->i_d.di_format =XFS_DINODE_FMT_LOCAL ; + ip->i_disk_size = pathlen; + ip->i_format =XFS_DINODE_FMT_LOCAL ;xfs_trans_log_inode (tp, ip,XFS_ILOG_DDATA |XFS_ILOG_CORE ); }else {int offset;
@@ -279,7 +279,7 @@ xfs_symlink(if (resblks) resblks -= fs_blocks; - ip->i_d.di_size = pathlen; + ip->i_disk_size = pathlen;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); cur_chunk = target_path;
@@ -400,7 +400,7 @@ xfs_inactive_symlink_rmt(* either 1 or 2 extents and that we can * free them all in one bunmapi call. */ -ASSERT (ip->i_d.di_nextents >0 && ip->i_d.di_nextents <=2 ); +ASSERT (ip->i_nextents >0 && ip->i_nextents <=2 ); error =xfs_trans_alloc (mp, &M_RES (mp)->tr_itruncate,0 ,0 ,0 , &tp);if (error)
@@ -415,8 +415,8 @@ xfs_inactive_symlink_rmt(* locked for the second transaction. In the error paths we need it * held so the cancel won't rele it, see below. */ - size = (int )ip->i_d.di_size; - ip->i_d.di_size =0 ; + size = (int )ip->i_disk_size; + ip->i_disk_size =0 ;VFS_I (ip)->i_mode = (VFS_I (ip)->i_mode & ~S_IFMT ) |S_IFREG ;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );/*
@@ -493,7 +493,7 @@ xfs_inactive_symlink(return -EIO ;xfs_ilock (ip,XFS_ILOCK_EXCL ); - pathlen = (int )ip->i_d.di_size; + pathlen = (int )ip->i_disk_size;ASSERT (pathlen);if (pathlen <=0 || pathlen >XFS_SYMLINK_MAXLEN ) {
fs/xfs/xfs_trace.h +10 -10
@@ -1135,7 +1135,7 @@ DECLARE_EVENT_CLASS(xfs_file_class,TP_fast_assign ( __entry->dev = VFS_I(ip)->i_sb->s_dev; __entry->ino = ip->i_ino; - __entry->size = ip->i_d.di_size; + __entry->size = ip->i_disk_size; __entry->offset = offset; __entry->count = count; ),
@@ -1241,7 +1241,7 @@ DECLARE_EVENT_CLASS(xfs_imap_class,TP_fast_assign ( __entry->dev = VFS_I(ip)->i_sb->s_dev; __entry->ino = ip->i_ino; - __entry->size = ip->i_d.di_size; + __entry->size = ip->i_disk_size; __entry->offset = offset; __entry->count = count; __entry->whichfork = whichfork;
@@ -1287,7 +1287,7 @@ DECLARE_EVENT_CLASS(xfs_simple_io_class, __entry->dev =VFS_I (ip)->i_sb->s_dev; __entry->ino = ip->i_ino; __entry->isize =VFS_I (ip)->i_size; - __entry->disize = ip->i_d.di_size; + __entry->disize = ip->i_disk_size; __entry->offset = offset; __entry->count = count; ),
@@ -1325,7 +1325,7 @@ DECLARE_EVENT_CLASS(xfs_itrunc_class,TP_fast_assign ( __entry->dev = VFS_I(ip)->i_sb->s_dev; __entry->ino = ip->i_ino; - __entry->size = ip->i_d.di_size; + __entry->size = ip->i_disk_size; __entry->new_size = new_size; ), TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
@@ -1355,7 +1355,7 @@ TRACE_EVENT(xfs_pagecache_inval,TP_fast_assign ( __entry->dev = VFS_I(ip)->i_sb->s_dev; __entry->ino = ip->i_ino; - __entry->size = ip->i_d.di_size; + __entry->size = ip->i_disk_size; __entry->start = start; __entry->finish = finish; ),
@@ -1383,7 +1383,7 @@ TRACE_EVENT(xfs_bunmap,TP_fast_assign ( __entry->dev = VFS_I(ip)->i_sb->s_dev; __entry->ino = ip->i_ino; - __entry->size = ip->i_d.di_size; + __entry->size = ip->i_disk_size; __entry->bno = bno; __entry->len = len; __entry->caller_ip = caller_ip;
@@ -1922,8 +1922,8 @@ DECLARE_EVENT_CLASS(xfs_swap_extent_class, __entry->dev =VFS_I (ip)->i_sb->s_dev; __entry->which = which; __entry->ino = ip->i_ino; - __entry->format = ip->i_d.di_format; - __entry->nex = ip->i_d.di_nextents; + __entry->format = ip->i_format; + __entry->nex = ip->i_nextents; __entry->broot_size = ip->i_df.if_broot_bytes; __entry->fork_off =XFS_IFORK_BOFF (ip); ),
@@ -3009,12 +3009,12 @@ DECLARE_EVENT_CLASS(xfs_double_io_class, __entry->dev =VFS_I (src)->i_sb->s_dev; __entry->src_ino = src->i_ino; __entry->src_isize =VFS_I (src)->i_size; - __entry->src_disize = src->i_d.di_size; + __entry->src_disize = src->i_disk_size; __entry->src_offset = soffset; __entry->len = len; __entry->dest_ino = dest->i_ino; __entry->dest_isize =VFS_I (dest)->i_size; - __entry->dest_disize = dest->i_d.di_size; + __entry->dest_disize = dest->i_disk_size; __entry->dest_offset = doffset; ), TP_printk("dev %d:%d count %zd "
Signature · 1 line
2.20.1
Re: [PATCH 4/4] xfs: remove struct xfs_icdinode
Quoted 2 lines · Christoph Hellwig
There is no point in having this sub-structure except for historical reasons. Remove it and just fold the fields into struct
xfs_inode.
This is too big to be reviewable. And because it changes stuff like i_d.di_size, it could affect on-disk inode size updates. Hence I think this needs to be broken down into smaller patches...
FWIW, A quick glance reveals:
Quoted 28 lines
fs/xfs/xfs_icache.c +14
-3@@ -62,12 +62,34 @@ xfs_inode_alloc(memset (&ip->i_imap,0 ,sizeof (struct xfs_imap )); ip->i_afp =NULL ; ip->i_cowfp =NULL ; - ip->i_cnextents =0 ; - ip->i_cformat =XFS_DINODE_FMT_EXTENTS ;memset (&ip->i_df,0 ,sizeof (ip->i_df)); + ip->i_flags =0 ; ip->i_delayed_blks =0 ; -memset (&ip->i_d,0 ,sizeof (ip->i_d)); + + ip->i_version =0 ; + ip->i_format =0 ; + ip->i_flushiter =0 ; + ip->i_uid =0 ; + ip->i_gid =0 ; + ip->i_projid =0 ; + ip->i_disk_size =0 ; + ip->i_nblocks =0 ; + ip->i_extsize =0 ; + ip->i_nextents =0 ; + ip->i_anextents =0 ; + ip->i_forkoff =0 ;
fs/xfs/xfs_icache.c xfs_inode_alloc( · line 91
Quoted 10 lines
fs/xfs/xfs_icache.c +10
-0+ ip->i_aformat =0 ; + ip->i_dmevmask =0 ; + ip->i_dmstate =0 ; + ip->i_diflags =0 ; + ip->i_diflags2 =0 ; + ip->i_cowextsize =0 ; + ip->i_crtime.tv_sec =0 ; + ip->i_crtime.tv_nsec =0 ; + ip->i_cnextents =0 ; + ip->i_cformat =XFS_DINODE_FMT_EXTENTS ;
This is, IMO, a step backards. We're going to end up failing to initialise new fields correctly with this...
Quoted 6 lines
fs/xfs/xfs_inode.h +0
-0@@ -58,8 +58,25 @@ typedef struct xfs_inode {unsigned long i_flags;/* see defined flags below */
fs/xfs/xfs_inode.h typedef struct xfs_inode { · line 66
Quoted 10 lines
fs/xfs/xfs_inode.h +6
-2uint64_t i_delayed_blks;/* count of delay alloc blks */ -struct xfs_icdinode i_d;/* most of ondisk inode */ - +int8_t i_version;/* inode version */ +int8_t i_format;/* data fork format */ +uint16_t i_flushiter;/* incremented on flush */ +uint32_t i_uid;/* owner's user id */ +uint32_t i_gid;/* owner's group id */ +uint16_t i_projid;/* owner's project id */
This is a bug and should make all the 32-bit project ID tests fail. If it doesn't them we've got a problem with our test coverage. If it does fail, then I'm not sure this patchset has been adequately tested...
It also introduces a hole in the structure.
fs/xfs/xfs_inode.h typedef struct xfs_inode { · line 75
Quoted 9 lines
fs/xfs/xfs_inode.h +9
-0+xfs_fsize_t i_disk_size;/* number of bytes in file */ +xfs_rfsblock_t i_nblocks;/* direct & btree blocks used */ +xfs_extlen_t i_extsize;/* extent size hint */ +xfs_extnum_t i_nextents;/* # of extents in data fork */ +xfs_aextnum_t i_anextents;/* # of extents in attr fork */ +uint8_t i_forkoff;/* attr fork offset */ +int8_t i_aformat;/* attr fork format */ +uint32_t i_dmevmask;/* DMIG event mask */ +uint16_t i_dmstate;/* DMIG state info */
If we are cleaning up the icdinode, why do these still exist in memory?
fs/xfs/xfs_inode.h typedef struct xfs_inode { · line 79
Quoted 4 lines
fs/xfs/xfs_inode.h +4
-0+uint16_t i_diflags;/* random flags */ +uint64_t i_diflags2;/* more random flags */ +uint32_t i_cowextsize;/* cow extent size hint */ +struct timespec64 i_crtime;/* time created */
And there's another new hole in the structure there, maybe more than one....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 4/4] xfs: remove struct xfs_icdinode
Quoted 2 lines · Dave Chinner
This is, IMO, a step backards. We're going to end up failing to initialise new fields correctly with this...
How is that different from the plain xfs_inode fields? In fact I suspect most of the initializers cn just be removed entirely, so I'll look into preloading that at the front of the series.
Quoted 4 lines
This is a bug and should make all the 32-bit project ID tests fail. If it doesn't them we've got a problem with our test coverage. If it does fail, then I'm not sure this patchset has been adequately tested...
I don't think we have any coverage of that, at least I didn't see any extra failures.
Quoted 4 lines
Quoted 4 lines
fs/xfs/xfs_inode.h +4
-0+xfs_fsize_t i_disk_size;/* number of bytes in file */ +xfs_rfsblock_t i_nblocks;/* direct & btree blocks used */ +xfs_extlen_t i_extsize;/* extent size hint */ +xfs_extnum_t i_nextents;/* # of extents in data fork */
Quoted 8 lines
fs/xfs/xfs_inode.h typedef struct xfs_inode { · line 75
Quoted 5 lines
fs/xfs/xfs_inode.h +5
-0+xfs_aextnum_t i_anextents;/* # of extents in attr fork */ +uint8_t i_forkoff;/* attr fork offset */ +int8_t i_aformat;/* attr fork format */ +uint32_t i_dmevmask;/* DMIG event mask */ +uint16_t i_dmstate;/* DMIG state info */ If we are cleaning up the icdinode, why do these still exist in memory?
Because we need them so that we put the right value in the log when logging the inode core. Otherwise a log recovery might clear these values. The only thing I could do is add a log incompat flag set on a kernel that removes the field and then not apply changes to these two fields when recoverying the log on a file system with that flag set.