~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/xfs/libxfs/xfs_quota_defs.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
  4  * All Rights Reserved.
  5  */
  6 #ifndef __XFS_QUOTA_DEFS_H__
  7 #define __XFS_QUOTA_DEFS_H__
  8 
  9 /*
 10  * Quota definitions shared between user and kernel source trees.
 11  */
 12 
 13 /*
 14  * Even though users may not have quota limits occupying all 64-bits,
 15  * they may need 64-bit accounting. Hence, 64-bit quota-counters,
 16  * and quota-limits. This is a waste in the common case, but hey ...
 17  */
 18 typedef uint64_t        xfs_qcnt_t;
 19 
 20 typedef uint8_t         xfs_dqtype_t;
 21 
 22 #define XFS_DQTYPE_STRINGS \
 23         { XFS_DQTYPE_USER,      "USER" }, \
 24         { XFS_DQTYPE_PROJ,      "PROJ" }, \
 25         { XFS_DQTYPE_GROUP,     "GROUP" }, \
 26         { XFS_DQTYPE_BIGTIME,   "BIGTIME" }
 27 
 28 /*
 29  * flags for q_flags field in the dquot.
 30  */
 31 #define XFS_DQFLAG_DIRTY        (1u << 0)       /* dquot is dirty */
 32 #define XFS_DQFLAG_FREEING      (1u << 1)       /* dquot is being torn down */
 33 
 34 #define XFS_DQFLAG_STRINGS \
 35         { XFS_DQFLAG_DIRTY,     "DIRTY" }, \
 36         { XFS_DQFLAG_FREEING,   "FREEING" }
 37 
 38 /*
 39  * We have the possibility of all three quota types being active at once, and
 40  * hence free space modification requires modification of all three current
 41  * dquots in a single transaction. For this case we need to have a reservation
 42  * of at least 3 dquots.
 43  *
 44  * However, a chmod operation can change both UID and GID in a single
 45  * transaction, resulting in requiring {old, new} x {uid, gid} dquots to be
 46  * modified. Hence for this case we need to reserve space for at least 4 dquots.
 47  *
 48  * And in the worst case, there's a rename operation that can be modifying up to
 49  * 4 inodes with dquots attached to them. In reality, the only inodes that can
 50  * have their dquots modified are the source and destination directory inodes
 51  * due to directory name creation and removal. That can require space allocation
 52  * and/or freeing on both directory inodes, and hence all three dquots on each
 53  * inode can be modified. And if the directories are world writeable, all the
 54  * dquots can be unique and so 6 dquots can be modified....
 55  *
 56  * And, of course, we also need to take into account the dquot log format item
 57  * used to describe each dquot.
 58  */
 59 #define XFS_DQUOT_LOGRES        \
 60         ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6)
 61 
 62 #define XFS_IS_QUOTA_ON(mp)             ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
 63 #define XFS_IS_UQUOTA_ON(mp)            ((mp)->m_qflags & XFS_UQUOTA_ACCT)
 64 #define XFS_IS_PQUOTA_ON(mp)            ((mp)->m_qflags & XFS_PQUOTA_ACCT)
 65 #define XFS_IS_GQUOTA_ON(mp)            ((mp)->m_qflags & XFS_GQUOTA_ACCT)
 66 #define XFS_IS_UQUOTA_ENFORCED(mp)      ((mp)->m_qflags & XFS_UQUOTA_ENFD)
 67 #define XFS_IS_GQUOTA_ENFORCED(mp)      ((mp)->m_qflags & XFS_GQUOTA_ENFD)
 68 #define XFS_IS_PQUOTA_ENFORCED(mp)      ((mp)->m_qflags & XFS_PQUOTA_ENFD)
 69 
 70 /*
 71  * Flags to tell various functions what to do. Not all of these are meaningful
 72  * to a single function. None of these XFS_QMOPT_* flags are meant to have
 73  * persistent values (ie. their values can and will change between versions)
 74  */
 75 #define XFS_QMOPT_UQUOTA        (1u << 0) /* user dquot requested */
 76 #define XFS_QMOPT_GQUOTA        (1u << 1) /* group dquot requested */
 77 #define XFS_QMOPT_PQUOTA        (1u << 2) /* project dquot requested */
 78 #define XFS_QMOPT_FORCE_RES     (1u << 3) /* ignore quota limits */
 79 #define XFS_QMOPT_SBVERSION     (1u << 4) /* change superblock version num */
 80 
 81 /*
 82  * flags to xfs_trans_mod_dquot to indicate which field needs to be
 83  * modified.
 84  */
 85 #define XFS_QMOPT_RES_REGBLKS   (1u << 7)
 86 #define XFS_QMOPT_RES_RTBLKS    (1u << 8)
 87 #define XFS_QMOPT_BCOUNT        (1u << 9)
 88 #define XFS_QMOPT_ICOUNT        (1u << 10)
 89 #define XFS_QMOPT_RTBCOUNT      (1u << 11)
 90 #define XFS_QMOPT_DELBCOUNT     (1u << 12)
 91 #define XFS_QMOPT_DELRTBCOUNT   (1u << 13)
 92 #define XFS_QMOPT_RES_INOS      (1u << 14)
 93 
 94 /*
 95  * flags for dqalloc.
 96  */
 97 #define XFS_QMOPT_INHERIT       (1u << 31)
 98 
 99 #define XFS_QMOPT_FLAGS \
100         { XFS_QMOPT_UQUOTA,             "UQUOTA" }, \
101         { XFS_QMOPT_PQUOTA,             "PQUOTA" }, \
102         { XFS_QMOPT_FORCE_RES,          "FORCE_RES" }, \
103         { XFS_QMOPT_SBVERSION,          "SBVERSION" }, \
104         { XFS_QMOPT_GQUOTA,             "GQUOTA" }, \
105         { XFS_QMOPT_INHERIT,            "INHERIT" }, \
106         { XFS_QMOPT_RES_REGBLKS,        "RES_REGBLKS" }, \
107         { XFS_QMOPT_RES_RTBLKS,         "RES_RTBLKS" }, \
108         { XFS_QMOPT_BCOUNT,             "BCOUNT" }, \
109         { XFS_QMOPT_ICOUNT,             "ICOUNT" }, \
110         { XFS_QMOPT_RTBCOUNT,           "RTBCOUNT" }, \
111         { XFS_QMOPT_DELBCOUNT,          "DELBCOUNT" }, \
112         { XFS_QMOPT_DELRTBCOUNT,        "DELRTBCOUNT" }, \
113         { XFS_QMOPT_RES_INOS,           "RES_INOS" }
114 
115 /*
116  * flags to xfs_trans_mod_dquot.
117  */
118 #define XFS_TRANS_DQ_RES_BLKS   XFS_QMOPT_RES_REGBLKS
119 #define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
120 #define XFS_TRANS_DQ_RES_INOS   XFS_QMOPT_RES_INOS
121 #define XFS_TRANS_DQ_BCOUNT     XFS_QMOPT_BCOUNT
122 #define XFS_TRANS_DQ_DELBCOUNT  XFS_QMOPT_DELBCOUNT
123 #define XFS_TRANS_DQ_ICOUNT     XFS_QMOPT_ICOUNT
124 #define XFS_TRANS_DQ_RTBCOUNT   XFS_QMOPT_RTBCOUNT
125 #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT
126 
127 
128 #define XFS_QMOPT_QUOTALL       \
129                 (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
130 #define XFS_QMOPT_RESBLK_MASK   (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
131 
132 
133 extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
134                 struct xfs_disk_dquot *ddq, xfs_dqid_t id);
135 extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
136                 struct xfs_dqblk *dqb, xfs_dqid_t id);
137 extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
138 extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
139                 xfs_dqid_t id, xfs_dqtype_t type);
140 
141 struct xfs_dquot;
142 time64_t xfs_dquot_from_disk_ts(struct xfs_disk_dquot *ddq,
143                 __be32 dtimer);
144 __be32 xfs_dquot_to_disk_ts(struct xfs_dquot *ddq, time64_t timer);
145 
146 #endif  /* __XFS_QUOTA_H__ */
147 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php