]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: merge the projid fields in struct xfs_icdinode
authorChristoph Hellwig <hch@lst.de>
Wed, 22 Jan 2020 16:29:44 +0000 (11:29 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 22 Jan 2020 16:29:44 +0000 (11:29 -0500)
Source kernel commit: de7a866fd41b227b0aa6e9cbeb0dae221c12f542

There is no point in splitting the fields like this in an purely
in-memory structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/check.c
include/xfs_inode.h
libxfs/util.c
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_buf.h

index cc9d371247c8faf14296ad57586245799f8686b3..3b713bdc5a305cbfab716b53b7932c2929f87fc2 100644 (file)
@@ -2679,7 +2679,6 @@ process_inode(
        xfs_qcnt_t              bc = 0;
        xfs_qcnt_t              ic = 0;
        xfs_qcnt_t              rc = 0;
-       xfs_dqid_t              dqprid;
        int                     v = 0;
        mode_t                  mode;
        static char             okfmts[] = {
@@ -2899,9 +2898,8 @@ process_inode(
                        break;
                }
                if (ic) {
-                       dqprid = xfs_get_projid(&xino.i_d);     /* dquot ID is u32 */
-                       quota_add(&dqprid, &xino.i_d.di_gid, &xino.i_d.di_uid,
-                                 0, bc, ic, rc);
+                       quota_add(&xino.i_d.di_projid, &xino.i_d.di_gid,
+                                 &xino.i_d.di_uid, 0, bc, ic, rc);
                }
        }
        totblocks = totdblocks + totiblocks + atotdblocks + atotiblocks;
index 7345209a00bdd3bfceacd927b3ebec2d03c2d9ec..e95a4959e76a80133ea7b90841d5763ba716d131 100644 (file)
@@ -119,27 +119,6 @@ static inline void inc_nlink(struct inode *inode)
        inode->i_nlink++;
 }
 
-/*
- * 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).
- *
- * Copied here from xfs_inode.h because it has to be defined after the struct
- * xfs_inode...
- */
-static inline prid_t
-xfs_get_projid(struct xfs_icdinode *id)
-{
-       return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
-}
-
-static inline void
-xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
-{
-       id->di_projid_hi = (uint16_t) (projid >> 16);
-       id->di_projid_lo = (uint16_t) (projid & 0xffff);
-}
-
 static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
 {
        return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
index b6cc4e2c6e3cc809d108cd6356a4a4e06db3e452..2e2ade24c4442e888294030e20fb4270c201073b 100644 (file)
@@ -257,7 +257,7 @@ libxfs_ialloc(
        set_nlink(VFS_I(ip), nlink);
        ip->i_d.di_uid = cr->cr_uid;
        ip->i_d.di_gid = cr->cr_gid;
-       xfs_set_projid(&ip->i_d, pip ? 0 : fsx->fsx_projid);
+       ip->i_d.di_projid = pip ? 0 : fsx->fsx_projid;
        xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD);
 
        /*
index a95e2e1521f1d36af352b1c4423371afb4fb327e..776a116f00954897d4f6457dc03679df5799d5bb 100644 (file)
@@ -209,13 +209,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;
@@ -275,8 +274,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);
index c9ac69c82d21ffb34070b72746c2b2fa12a78a68..fd94b107872290f1166f1d3fb9bd50707f39126f 100644 (file)
@@ -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 */