Lines Matching full:cursor
24 /* Initialize a dquot iteration cursor. */
27 struct xchk_dqiter *cursor, in xchk_dqiter_init() argument
31 cursor->sc = sc; in xchk_dqiter_init()
32 cursor->bmap.br_startoff = NULLFILEOFF; in xchk_dqiter_init()
33 cursor->dqtype = dqtype & XFS_DQTYPE_REC_MASK; in xchk_dqiter_init()
34 cursor->quota_ip = xfs_quota_inode(sc->mp, cursor->dqtype); in xchk_dqiter_init()
35 cursor->id = 0; in xchk_dqiter_init()
39 * Ensure that the cached data fork mapping for the dqiter cursor is fresh and
40 * covers the dquot pointed to by the scan cursor.
44 struct xchk_dqiter *cursor) in xchk_dquot_iter_revalidate_bmap() argument
46 struct xfs_quotainfo *qi = cursor->sc->mp->m_quotainfo; in xchk_dquot_iter_revalidate_bmap()
47 struct xfs_ifork *ifp = xfs_ifork_ptr(cursor->quota_ip, in xchk_dquot_iter_revalidate_bmap()
50 xfs_dqid_t this_id = cursor->id; in xchk_dquot_iter_revalidate_bmap()
57 * If we have a mapping for cursor->id and it's still fresh, there's in xchk_dquot_iter_revalidate_bmap()
60 if (cursor->bmap.br_startoff != NULLFILEOFF && in xchk_dquot_iter_revalidate_bmap()
61 cursor->if_seq == ifp->if_seq && in xchk_dquot_iter_revalidate_bmap()
62 cursor->bmap.br_startoff + cursor->bmap.br_blockcount > fileoff) in xchk_dquot_iter_revalidate_bmap()
66 error = xfs_bmapi_read(cursor->quota_ip, fileoff, in xchk_dquot_iter_revalidate_bmap()
67 XFS_MAX_FILEOFF - fileoff, &cursor->bmap, &nmaps, 0); in xchk_dquot_iter_revalidate_bmap()
74 if (cursor->bmap.br_startoff > fileoff) { in xchk_dquot_iter_revalidate_bmap()
75 ASSERT(cursor->bmap.br_startoff == fileoff); in xchk_dquot_iter_revalidate_bmap()
79 cursor->if_seq = ifp->if_seq; in xchk_dquot_iter_revalidate_bmap()
80 trace_xchk_dquot_iter_revalidate_bmap(cursor, cursor->id); in xchk_dquot_iter_revalidate_bmap()
84 /* Advance the dqiter cursor to the next non-sparse region of the quota file. */
87 struct xchk_dqiter *cursor, in xchk_dquot_iter_advance_bmap() argument
90 struct xfs_quotainfo *qi = cursor->sc->mp->m_quotainfo; in xchk_dquot_iter_advance_bmap()
91 struct xfs_ifork *ifp = xfs_ifork_ptr(cursor->quota_ip, in xchk_dquot_iter_advance_bmap()
100 fileoff = cursor->bmap.br_startoff + cursor->bmap.br_blockcount; in xchk_dquot_iter_advance_bmap()
107 error = xfs_bmapi_read(cursor->quota_ip, fileoff, in xchk_dquot_iter_advance_bmap()
108 XFS_MAX_FILEOFF - fileoff, &cursor->bmap, in xchk_dquot_iter_advance_bmap()
117 if (cursor->bmap.br_startoff > fileoff) { in xchk_dquot_iter_advance_bmap()
118 ASSERT(cursor->bmap.br_startoff == fileoff); in xchk_dquot_iter_advance_bmap()
121 } while (!xfs_bmap_is_real_extent(&cursor->bmap)); in xchk_dquot_iter_advance_bmap()
123 next_id = cursor->bmap.br_startoff * qi->qi_dqperchunk; in xchk_dquot_iter_advance_bmap()
132 cursor->if_seq = ifp->if_seq; in xchk_dquot_iter_advance_bmap()
133 trace_xchk_dquot_iter_advance_bmap(cursor, *next_ondisk_id); in xchk_dquot_iter_advance_bmap()
145 struct xchk_dqiter *cursor, in xchk_dquot_iter_advance_incore() argument
148 struct xfs_quotainfo *qi = cursor->sc->mp->m_quotainfo; in xchk_dquot_iter_advance_incore()
149 struct radix_tree_root *tree = xfs_dquot_tree(qi, cursor->dqtype); in xchk_dquot_iter_advance_incore()
156 nr_found = radix_tree_gang_lookup(tree, (void **)&dq, cursor->id, 1); in xchk_dquot_iter_advance_incore()
161 trace_xchk_dquot_iter_advance_incore(cursor, *next_incore_id); in xchk_dquot_iter_advance_incore()
172 struct xchk_dqiter *cursor, in xchk_dquot_iter() argument
175 struct xfs_mount *mp = cursor->sc->mp; in xchk_dquot_iter()
181 if (cursor->id > XFS_DQ_ID_MAX) in xchk_dquot_iter()
183 next_ondisk = cursor->id; in xchk_dquot_iter()
185 /* Revalidate and/or advance the cursor. */ in xchk_dquot_iter()
186 lock_mode = xfs_ilock_data_map_shared(cursor->quota_ip); in xchk_dquot_iter()
187 error = xchk_dquot_iter_revalidate_bmap(cursor); in xchk_dquot_iter()
188 if (!error && !xfs_bmap_is_real_extent(&cursor->bmap)) in xchk_dquot_iter()
189 error = xchk_dquot_iter_advance_bmap(cursor, &next_ondisk); in xchk_dquot_iter()
190 xfs_iunlock(cursor->quota_ip, lock_mode); in xchk_dquot_iter()
194 if (next_ondisk > cursor->id) in xchk_dquot_iter()
195 xchk_dquot_iter_advance_incore(cursor, &next_incore); in xchk_dquot_iter()
198 cursor->id = min(next_ondisk, next_incore); in xchk_dquot_iter()
199 if (cursor->id > XFS_DQ_ID_MAX) in xchk_dquot_iter()
202 trace_xchk_dquot_iter(cursor, cursor->id); in xchk_dquot_iter()
204 error = xfs_qm_dqget(mp, cursor->id, cursor->dqtype, false, &dq); in xchk_dquot_iter()
208 cursor->id = dq->q_id + 1; in xchk_dquot_iter()