Lines Matching defs:cursor

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