• Home
  • Raw
  • Download

Lines Matching +full:sc +full:- +full:resource

1 // SPDX-License-Identifier: GPL-2.0+
23 struct xfs_scrub *sc) in xchk_quota_to_dqtype() argument
25 switch (sc->sm->sm_type) { in xchk_quota_to_dqtype()
40 struct xfs_scrub *sc, in xchk_setup_quota() argument
46 if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !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()
52 sc->flags |= XCHK_HAS_QUOTAOFFLOCK; in xchk_setup_quota()
53 mutex_lock(&sc->mp->m_quotainfo->qi_quotaofflock); in xchk_setup_quota()
54 if (!xfs_this_quota_on(sc->mp, dqtype)) in xchk_setup_quota()
55 return -ENOENT; in xchk_setup_quota()
56 error = xchk_setup_fs(sc, ip); in xchk_setup_quota()
59 sc->ip = xfs_quota_inode(sc->mp, dqtype); in xchk_setup_quota()
60 xfs_ilock(sc->ip, XFS_ILOCK_EXCL); in xchk_setup_quota()
61 sc->ilock_flags = XFS_ILOCK_EXCL; in xchk_setup_quota()
68 struct xfs_scrub *sc; member
80 struct xfs_scrub *sc = sqi->sc; in xchk_quota_item() local
81 struct xfs_mount *mp = sc->mp; in xchk_quota_item()
82 struct xfs_quotainfo *qi = mp->m_quotainfo; in xchk_quota_item()
87 if (xchk_should_terminate(sc, &error)) in xchk_quota_item()
94 offset = dq->q_id / qi->qi_dqperchunk; in xchk_quota_item()
95 if (dq->q_id && dq->q_id <= sqi->last_id) in xchk_quota_item()
96 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
98 sqi->last_id = dq->q_id; in xchk_quota_item()
108 if (dq->q_blk.hardlimit > mp->m_sb.sb_dblocks) in xchk_quota_item()
109 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
110 if (dq->q_blk.softlimit > dq->q_blk.hardlimit) in xchk_quota_item()
111 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
113 if (dq->q_ino.hardlimit > M_IGEO(mp)->maxicount) in xchk_quota_item()
114 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
115 if (dq->q_ino.softlimit > dq->q_ino.hardlimit) in xchk_quota_item()
116 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
118 if (dq->q_rtb.hardlimit > mp->m_sb.sb_rblocks) in xchk_quota_item()
119 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
120 if (dq->q_rtb.softlimit > dq->q_rtb.hardlimit) in xchk_quota_item()
121 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
123 /* Check the resource counts. */ in xchk_quota_item()
124 fs_icount = percpu_counter_sum(&mp->m_icount); in xchk_quota_item()
131 if (xfs_sb_version_hasreflink(&mp->m_sb)) { in xchk_quota_item()
132 if (mp->m_sb.sb_dblocks < dq->q_blk.count) in xchk_quota_item()
133 xchk_fblock_set_warning(sc, XFS_DATA_FORK, in xchk_quota_item()
136 if (mp->m_sb.sb_dblocks < dq->q_blk.count) in xchk_quota_item()
137 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, in xchk_quota_item()
140 if (dq->q_ino.count > fs_icount || dq->q_rtb.count > mp->m_sb.sb_rblocks) in xchk_quota_item()
141 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
148 if (dq->q_id == 0) in xchk_quota_item()
151 if (dq->q_blk.hardlimit != 0 && in xchk_quota_item()
152 dq->q_blk.count > dq->q_blk.hardlimit) in xchk_quota_item()
153 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
155 if (dq->q_ino.hardlimit != 0 && in xchk_quota_item()
156 dq->q_ino.count > dq->q_ino.hardlimit) in xchk_quota_item()
157 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
159 if (dq->q_rtb.hardlimit != 0 && in xchk_quota_item()
160 dq->q_rtb.count > dq->q_rtb.hardlimit) in xchk_quota_item()
161 xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); in xchk_quota_item()
164 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_quota_item()
165 return -EFSCORRUPTED; in xchk_quota_item()
173 struct xfs_scrub *sc) in xchk_quota_data_fork() argument
177 struct xfs_quotainfo *qi = sc->mp->m_quotainfo; in xchk_quota_data_fork()
183 error = xchk_metadata_inode_forks(sc); in xchk_quota_data_fork()
184 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_quota_data_fork()
188 max_dqid_off = ((xfs_dqid_t)-1) / qi->qi_dqperchunk; in xchk_quota_data_fork()
189 ifp = XFS_IFORK_PTR(sc->ip, XFS_DATA_FORK); in xchk_quota_data_fork()
191 if (xchk_should_terminate(sc, &error)) in xchk_quota_data_fork()
199 irec.br_startoff + irec.br_blockcount - 1 > max_dqid_off) { in xchk_quota_data_fork()
200 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, in xchk_quota_data_fork()
212 struct xfs_scrub *sc) in xchk_quota() argument
215 struct xfs_mount *mp = sc->mp; in xchk_quota()
216 struct xfs_quotainfo *qi = mp->m_quotainfo; in xchk_quota()
220 dqtype = xchk_quota_to_dqtype(sc); in xchk_quota()
223 error = xchk_quota_data_fork(sc); in xchk_quota()
226 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_quota()
234 xfs_iunlock(sc->ip, sc->ilock_flags); in xchk_quota()
235 sc->ilock_flags = 0; in xchk_quota()
236 sqi.sc = sc; in xchk_quota()
239 sc->ilock_flags = XFS_ILOCK_EXCL; in xchk_quota()
240 xfs_ilock(sc->ip, sc->ilock_flags); in xchk_quota()
241 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, in xchk_quota()
242 sqi.last_id * qi->qi_dqperchunk, &error)) in xchk_quota()