| .. | .. |
|---|
| 20 | 20 | #define XFS_DQITER_MAP_SIZE 10 |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ |
|---|
| 23 | | - !dqp->q_core.d_blk_hardlimit && \ |
|---|
| 24 | | - !dqp->q_core.d_blk_softlimit && \ |
|---|
| 25 | | - !dqp->q_core.d_rtb_hardlimit && \ |
|---|
| 26 | | - !dqp->q_core.d_rtb_softlimit && \ |
|---|
| 27 | | - !dqp->q_core.d_ino_hardlimit && \ |
|---|
| 28 | | - !dqp->q_core.d_ino_softlimit && \ |
|---|
| 29 | | - !dqp->q_core.d_bcount && \ |
|---|
| 30 | | - !dqp->q_core.d_rtbcount && \ |
|---|
| 31 | | - !dqp->q_core.d_icount) |
|---|
| 23 | + !dqp->q_blk.hardlimit && \ |
|---|
| 24 | + !dqp->q_blk.softlimit && \ |
|---|
| 25 | + !dqp->q_rtb.hardlimit && \ |
|---|
| 26 | + !dqp->q_rtb.softlimit && \ |
|---|
| 27 | + !dqp->q_ino.hardlimit && \ |
|---|
| 28 | + !dqp->q_ino.softlimit && \ |
|---|
| 29 | + !dqp->q_blk.count && \ |
|---|
| 30 | + !dqp->q_rtb.count && \ |
|---|
| 31 | + !dqp->q_ino.count) |
|---|
| 32 | 32 | |
|---|
| 33 | | -/* |
|---|
| 34 | | - * This defines the unit of allocation of dquots. |
|---|
| 35 | | - * Currently, it is just one file system block, and a 4K blk contains 30 |
|---|
| 36 | | - * (136 * 30 = 4080) dquots. It's probably not worth trying to make |
|---|
| 37 | | - * this more dynamic. |
|---|
| 38 | | - * XXXsup However, if this number is changed, we have to make sure that we don't |
|---|
| 39 | | - * implicitly assume that we do allocations in chunks of a single filesystem |
|---|
| 40 | | - * block in the dquot/xqm code. |
|---|
| 41 | | - */ |
|---|
| 42 | | -#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 |
|---|
| 33 | +struct xfs_quota_limits { |
|---|
| 34 | + xfs_qcnt_t hard; /* default hard limit */ |
|---|
| 35 | + xfs_qcnt_t soft; /* default soft limit */ |
|---|
| 36 | + time64_t time; /* limit for timers */ |
|---|
| 37 | + xfs_qwarncnt_t warn; /* limit for warnings */ |
|---|
| 38 | +}; |
|---|
| 43 | 39 | |
|---|
| 40 | +/* Defaults for each quota type: time limits, warn limits, usage limits */ |
|---|
| 44 | 41 | struct xfs_def_quota { |
|---|
| 45 | | - xfs_qcnt_t bhardlimit; /* default data blk hard limit */ |
|---|
| 46 | | - xfs_qcnt_t bsoftlimit; /* default data blk soft limit */ |
|---|
| 47 | | - xfs_qcnt_t ihardlimit; /* default inode count hard limit */ |
|---|
| 48 | | - xfs_qcnt_t isoftlimit; /* default inode count soft limit */ |
|---|
| 49 | | - xfs_qcnt_t rtbhardlimit; /* default realtime blk hard limit */ |
|---|
| 50 | | - xfs_qcnt_t rtbsoftlimit; /* default realtime blk soft limit */ |
|---|
| 42 | + struct xfs_quota_limits blk; |
|---|
| 43 | + struct xfs_quota_limits ino; |
|---|
| 44 | + struct xfs_quota_limits rtb; |
|---|
| 51 | 45 | }; |
|---|
| 52 | 46 | |
|---|
| 53 | 47 | /* |
|---|
| 54 | 48 | * Various quota information for individual filesystems. |
|---|
| 55 | 49 | * The mount structure keeps a pointer to this. |
|---|
| 56 | 50 | */ |
|---|
| 57 | | -typedef struct xfs_quotainfo { |
|---|
| 58 | | - struct radix_tree_root qi_uquota_tree; |
|---|
| 59 | | - struct radix_tree_root qi_gquota_tree; |
|---|
| 60 | | - struct radix_tree_root qi_pquota_tree; |
|---|
| 61 | | - struct mutex qi_tree_lock; |
|---|
| 51 | +struct xfs_quotainfo { |
|---|
| 52 | + struct radix_tree_root qi_uquota_tree; |
|---|
| 53 | + struct radix_tree_root qi_gquota_tree; |
|---|
| 54 | + struct radix_tree_root qi_pquota_tree; |
|---|
| 55 | + struct mutex qi_tree_lock; |
|---|
| 62 | 56 | struct xfs_inode *qi_uquotaip; /* user quota inode */ |
|---|
| 63 | 57 | struct xfs_inode *qi_gquotaip; /* group quota inode */ |
|---|
| 64 | 58 | struct xfs_inode *qi_pquotaip; /* project quota inode */ |
|---|
| 65 | | - struct list_lru qi_lru; |
|---|
| 66 | | - int qi_dquots; |
|---|
| 67 | | - time_t qi_btimelimit; /* limit for blks timer */ |
|---|
| 68 | | - time_t qi_itimelimit; /* limit for inodes timer */ |
|---|
| 69 | | - time_t qi_rtbtimelimit;/* limit for rt blks timer */ |
|---|
| 70 | | - xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */ |
|---|
| 71 | | - xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */ |
|---|
| 72 | | - xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */ |
|---|
| 73 | | - struct mutex qi_quotaofflock;/* to serialize quotaoff */ |
|---|
| 74 | | - xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */ |
|---|
| 75 | | - uint qi_dqperchunk; /* # ondisk dqs in above chunk */ |
|---|
| 59 | + struct list_lru qi_lru; |
|---|
| 60 | + int qi_dquots; |
|---|
| 61 | + struct mutex qi_quotaofflock;/* to serialize quotaoff */ |
|---|
| 62 | + xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */ |
|---|
| 63 | + uint qi_dqperchunk; /* # ondisk dq in above chunk */ |
|---|
| 76 | 64 | struct xfs_def_quota qi_usr_default; |
|---|
| 77 | 65 | struct xfs_def_quota qi_grp_default; |
|---|
| 78 | 66 | struct xfs_def_quota qi_prj_default; |
|---|
| 79 | | - struct shrinker qi_shrinker; |
|---|
| 80 | | -} xfs_quotainfo_t; |
|---|
| 67 | + struct shrinker qi_shrinker; |
|---|
| 68 | + |
|---|
| 69 | + /* Minimum and maximum quota expiration timestamp values. */ |
|---|
| 70 | + time64_t qi_expiry_min; |
|---|
| 71 | + time64_t qi_expiry_max; |
|---|
| 72 | +}; |
|---|
| 81 | 73 | |
|---|
| 82 | 74 | static inline struct radix_tree_root * |
|---|
| 83 | 75 | xfs_dquot_tree( |
|---|
| 84 | 76 | struct xfs_quotainfo *qi, |
|---|
| 85 | | - int type) |
|---|
| 77 | + xfs_dqtype_t type) |
|---|
| 86 | 78 | { |
|---|
| 87 | 79 | switch (type) { |
|---|
| 88 | | - case XFS_DQ_USER: |
|---|
| 80 | + case XFS_DQTYPE_USER: |
|---|
| 89 | 81 | return &qi->qi_uquota_tree; |
|---|
| 90 | | - case XFS_DQ_GROUP: |
|---|
| 82 | + case XFS_DQTYPE_GROUP: |
|---|
| 91 | 83 | return &qi->qi_gquota_tree; |
|---|
| 92 | | - case XFS_DQ_PROJ: |
|---|
| 84 | + case XFS_DQTYPE_PROJ: |
|---|
| 93 | 85 | return &qi->qi_pquota_tree; |
|---|
| 94 | 86 | default: |
|---|
| 95 | 87 | ASSERT(0); |
|---|
| .. | .. |
|---|
| 98 | 90 | } |
|---|
| 99 | 91 | |
|---|
| 100 | 92 | static inline struct xfs_inode * |
|---|
| 101 | | -xfs_quota_inode(xfs_mount_t *mp, uint dq_flags) |
|---|
| 93 | +xfs_quota_inode(struct xfs_mount *mp, xfs_dqtype_t type) |
|---|
| 102 | 94 | { |
|---|
| 103 | | - switch (dq_flags & XFS_DQ_ALLTYPES) { |
|---|
| 104 | | - case XFS_DQ_USER: |
|---|
| 95 | + switch (type) { |
|---|
| 96 | + case XFS_DQTYPE_USER: |
|---|
| 105 | 97 | return mp->m_quotainfo->qi_uquotaip; |
|---|
| 106 | | - case XFS_DQ_GROUP: |
|---|
| 98 | + case XFS_DQTYPE_GROUP: |
|---|
| 107 | 99 | return mp->m_quotainfo->qi_gquotaip; |
|---|
| 108 | | - case XFS_DQ_PROJ: |
|---|
| 100 | + case XFS_DQTYPE_PROJ: |
|---|
| 109 | 101 | return mp->m_quotainfo->qi_pquotaip; |
|---|
| 110 | 102 | default: |
|---|
| 111 | 103 | ASSERT(0); |
|---|
| .. | .. |
|---|
| 113 | 105 | return NULL; |
|---|
| 114 | 106 | } |
|---|
| 115 | 107 | |
|---|
| 116 | | -extern void xfs_trans_mod_dquot(struct xfs_trans *, |
|---|
| 117 | | - struct xfs_dquot *, uint, long); |
|---|
| 118 | | -extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, |
|---|
| 119 | | - struct xfs_mount *, struct xfs_dquot *, |
|---|
| 120 | | - struct xfs_dquot *, struct xfs_dquot *, |
|---|
| 121 | | - long, long, uint); |
|---|
| 108 | +extern void xfs_trans_mod_dquot(struct xfs_trans *tp, struct xfs_dquot *dqp, |
|---|
| 109 | + uint field, int64_t delta); |
|---|
| 122 | 110 | extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *); |
|---|
| 123 | 111 | extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *); |
|---|
| 124 | 112 | |
|---|
| .. | .. |
|---|
| 158 | 146 | |
|---|
| 159 | 147 | /* quota ops */ |
|---|
| 160 | 148 | extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); |
|---|
| 161 | | -extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, |
|---|
| 162 | | - uint, struct qc_dqblk *); |
|---|
| 163 | | -extern int xfs_qm_scall_getquota_next(struct xfs_mount *, |
|---|
| 164 | | - xfs_dqid_t *, uint, struct qc_dqblk *); |
|---|
| 165 | | -extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, |
|---|
| 166 | | - struct qc_dqblk *); |
|---|
| 149 | +extern int xfs_qm_scall_getquota(struct xfs_mount *mp, |
|---|
| 150 | + xfs_dqid_t id, |
|---|
| 151 | + xfs_dqtype_t type, |
|---|
| 152 | + struct qc_dqblk *dst); |
|---|
| 153 | +extern int xfs_qm_scall_getquota_next(struct xfs_mount *mp, |
|---|
| 154 | + xfs_dqid_t *id, |
|---|
| 155 | + xfs_dqtype_t type, |
|---|
| 156 | + struct qc_dqblk *dst); |
|---|
| 157 | +extern int xfs_qm_scall_setqlim(struct xfs_mount *mp, |
|---|
| 158 | + xfs_dqid_t id, |
|---|
| 159 | + xfs_dqtype_t type, |
|---|
| 160 | + struct qc_dqblk *newlim); |
|---|
| 167 | 161 | extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); |
|---|
| 168 | 162 | extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); |
|---|
| 169 | 163 | |
|---|
| 170 | 164 | static inline struct xfs_def_quota * |
|---|
| 171 | | -xfs_get_defquota(struct xfs_dquot *dqp, struct xfs_quotainfo *qi) |
|---|
| 165 | +xfs_get_defquota(struct xfs_quotainfo *qi, xfs_dqtype_t type) |
|---|
| 172 | 166 | { |
|---|
| 173 | | - struct xfs_def_quota *defq; |
|---|
| 174 | | - |
|---|
| 175 | | - if (XFS_QM_ISUDQ(dqp)) |
|---|
| 176 | | - defq = &qi->qi_usr_default; |
|---|
| 177 | | - else if (XFS_QM_ISGDQ(dqp)) |
|---|
| 178 | | - defq = &qi->qi_grp_default; |
|---|
| 179 | | - else { |
|---|
| 180 | | - ASSERT(XFS_QM_ISPDQ(dqp)); |
|---|
| 181 | | - defq = &qi->qi_prj_default; |
|---|
| 167 | + switch (type) { |
|---|
| 168 | + case XFS_DQTYPE_USER: |
|---|
| 169 | + return &qi->qi_usr_default; |
|---|
| 170 | + case XFS_DQTYPE_GROUP: |
|---|
| 171 | + return &qi->qi_grp_default; |
|---|
| 172 | + case XFS_DQTYPE_PROJ: |
|---|
| 173 | + return &qi->qi_prj_default; |
|---|
| 174 | + default: |
|---|
| 175 | + ASSERT(0); |
|---|
| 176 | + return NULL; |
|---|
| 182 | 177 | } |
|---|
| 183 | | - return defq; |
|---|
| 184 | 178 | } |
|---|
| 185 | 179 | |
|---|
| 186 | 180 | #endif /* __XFS_QM_H__ */ |
|---|