Lines Matching +full:sc +full:- +full:resource
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2017-2023 Oracle. All Rights Reserved.
24 struct xfs_scrub *sc) in xchk_quota_to_dqtype() argument
26 switch (sc->sm->sm_type) { in xchk_quota_to_dqtype()
41 struct xfs_scrub *sc) in xchk_setup_quota() argument
46 if (!XFS_IS_QUOTA_ON(sc->mp)) in xchk_setup_quota()
47 return -ENOENT; in xchk_setup_quota()
49 dqtype = xchk_quota_to_dqtype(sc); in xchk_setup_quota()
51 return -EINVAL; in xchk_setup_quota()
53 if (!xfs_this_quota_on(sc->mp, dqtype)) in xchk_setup_quota()
54 return -ENOENT; in xchk_setup_quota()
56 if (xchk_need_intent_drain(sc)) in xchk_setup_quota()
57 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); in xchk_setup_quota()
59 error = xchk_setup_fs(sc); in xchk_setup_quota()
63 error = xchk_install_live_inode(sc, xfs_quota_inode(sc->mp, dqtype)); in xchk_setup_quota()
67 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_setup_quota()
74 struct xfs_scrub *sc; member
86 struct xfs_scrub *sc = sqi->sc; in xchk_quota_item() local
87 struct xfs_mount *mp = sc->mp; in xchk_quota_item()
88 struct xfs_quotainfo *qi = mp->m_quotainfo; in xchk_quota_item()
93 if (xchk_should_terminate(sc, &error)) in xchk_quota_item()
100 offset = dq->q_id / qi->qi_dqperchunk; in xchk_quota_item()
101 if (dq->q_id && dq->q_id <= sqi->last_id) in xchk_quota_item()
102 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
104 sqi->last_id = dq->q_id; in xchk_quota_item()
114 if (dq->q_blk.hardlimit > mp->m_sb.sb_dblocks) in xchk_quota_item()
115 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
116 if (dq->q_blk.softlimit > dq->q_blk.hardlimit) in xchk_quota_item()
117 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
119 if (dq->q_ino.hardlimit > M_IGEO(mp)->maxicount) in xchk_quota_item()
120 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
121 if (dq->q_ino.softlimit > dq->q_ino.hardlimit) in xchk_quota_item()
122 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
124 if (dq->q_rtb.hardlimit > mp->m_sb.sb_rblocks) in xchk_quota_item()
125 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
126 if (dq->q_rtb.softlimit > dq->q_rtb.hardlimit) in xchk_quota_item()
127 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
129 /* Check the resource counts. */ in xchk_quota_item()
130 fs_icount = percpu_counter_sum(&mp->m_icount); in xchk_quota_item()
138 if (mp->m_sb.sb_dblocks < dq->q_blk.count) in xchk_quota_item()
139 xchk_fblock_set_warning(sc, XFS_DATA_FORK, in xchk_quota_item()
142 if (mp->m_sb.sb_dblocks < dq->q_blk.count) in xchk_quota_item()
143 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, in xchk_quota_item()
146 if (dq->q_ino.count > fs_icount || dq->q_rtb.count > mp->m_sb.sb_rblocks) in xchk_quota_item()
147 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
154 if (dq->q_id == 0) in xchk_quota_item()
157 if (dq->q_blk.hardlimit != 0 && in xchk_quota_item()
158 dq->q_blk.count > dq->q_blk.hardlimit) in xchk_quota_item()
159 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
161 if (dq->q_ino.hardlimit != 0 && in xchk_quota_item()
162 dq->q_ino.count > dq->q_ino.hardlimit) in xchk_quota_item()
163 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
165 if (dq->q_rtb.hardlimit != 0 && in xchk_quota_item()
166 dq->q_rtb.count > dq->q_rtb.hardlimit) in xchk_quota_item()
167 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
170 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_quota_item()
171 return -ECANCELED; in xchk_quota_item()
179 struct xfs_scrub *sc) in xchk_quota_data_fork() argument
183 struct xfs_quotainfo *qi = sc->mp->m_quotainfo; in xchk_quota_data_fork()
189 error = xchk_metadata_inode_forks(sc); in xchk_quota_data_fork()
190 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_quota_data_fork()
194 max_dqid_off = ((xfs_dqid_t)-1) / qi->qi_dqperchunk; in xchk_quota_data_fork()
195 ifp = xfs_ifork_ptr(sc->ip, XFS_DATA_FORK); in xchk_quota_data_fork()
197 if (xchk_should_terminate(sc, &error)) in xchk_quota_data_fork()
206 irec.br_startoff + irec.br_blockcount - 1 > max_dqid_off) { in xchk_quota_data_fork()
207 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, in xchk_quota_data_fork()
219 struct xfs_scrub *sc) in xchk_quota() argument
222 struct xfs_mount *mp = sc->mp; in xchk_quota()
223 struct xfs_quotainfo *qi = mp->m_quotainfo; in xchk_quota()
227 dqtype = xchk_quota_to_dqtype(sc); in xchk_quota()
230 error = xchk_quota_data_fork(sc); in xchk_quota()
233 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_quota()
241 xchk_iunlock(sc, sc->ilock_flags); in xchk_quota()
242 sqi.sc = sc; in xchk_quota()
245 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_quota()
246 if (error == -ECANCELED) in xchk_quota()
248 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, in xchk_quota()
249 sqi.last_id * qi->qi_dqperchunk, &error)) in xchk_quota()