Lines Matching defs:iwag

154 	struct xfs_iwalk_ag	*iwag)
158 ASSERT(iwag->recs == NULL);
159 iwag->nr_recs = 0;
162 size = iwag->sz_recs * sizeof(struct xfs_inobt_rec_incore);
163 iwag->recs = kmem_alloc(size, KM_MAYFAIL);
164 if (iwag->recs == NULL)
173 struct xfs_iwalk_ag *iwag)
175 kmem_free(iwag->recs);
176 iwag->recs = NULL;
182 struct xfs_iwalk_ag *iwag)
184 struct xfs_mount *mp = iwag->mp;
185 struct xfs_trans *tp = iwag->tp;
186 struct xfs_perag *pag = iwag->pag;
191 for (i = 0; i < iwag->nr_recs; i++) {
192 struct xfs_inobt_rec_incore *irec = &iwag->recs[i];
196 if (xfs_pwork_want_abort(&iwag->pwork))
199 if (iwag->inobt_walk_fn) {
200 error = iwag->inobt_walk_fn(mp, tp, pag->pag_agno, irec,
201 iwag->data);
206 if (!iwag->iwalk_fn)
210 if (xfs_pwork_want_abort(&iwag->pwork))
220 error = iwag->iwalk_fn(mp, tp, ino, iwag->data);
264 struct xfs_iwalk_ag *iwag,
270 struct xfs_mount *mp = iwag->mp;
271 struct xfs_trans *tp = iwag->tp;
272 struct xfs_perag *pag = iwag->pag;
277 iwag->nr_recs = 0;
305 irec = &iwag->recs[iwag->nr_recs];
312 iwag->lastino = XFS_AGINO_TO_INO(mp, pag->pag_agno,
326 if (iwag->trim_start)
335 iwag->nr_recs++;
336 ASSERT(iwag->nr_recs < iwag->sz_recs);
352 struct xfs_iwalk_ag *iwag,
357 struct xfs_mount *mp = iwag->mp;
362 next_agino = XFS_INO_TO_AGINO(mp, iwag->lastino) + 1;
364 ASSERT(iwag->nr_recs > 0);
367 xfs_iwalk_del_inobt(iwag->tp, curpp, agi_bpp, 0);
368 irec = &iwag->recs[iwag->nr_recs - 1];
371 if (iwag->drop_trans) {
372 xfs_trans_cancel(iwag->tp);
373 iwag->tp = NULL;
376 error = xfs_iwalk_ag_recs(iwag);
381 iwag->nr_recs = 0;
386 if (iwag->drop_trans) {
387 error = xfs_trans_alloc_empty(mp, &iwag->tp);
393 error = xfs_inobt_cur(iwag->pag, iwag->tp, XFS_BTNUM_INO, curpp,
401 /* Walk all inodes in a single AG, from @iwag->startino to the end of the AG. */
404 struct xfs_iwalk_ag *iwag)
406 struct xfs_mount *mp = iwag->mp;
407 struct xfs_perag *pag = iwag->pag;
415 ASSERT(pag->pag_agno == XFS_INO_TO_AGNO(mp, iwag->startino));
416 agino = XFS_INO_TO_AGINO(mp, iwag->startino);
417 error = xfs_iwalk_ag_start(iwag, agino, &cur, &agi_bp, &has_more);
424 if (xfs_pwork_want_abort(&iwag->pwork))
428 irec = &iwag->recs[iwag->nr_recs];
435 if (iwag->lastino != NULLFSINO &&
436 XFS_IS_CORRUPT(mp, iwag->lastino >= rec_fsino)) {
440 iwag->lastino = rec_fsino + XFS_INODES_PER_CHUNK - 1;
443 if (iwag->skip_empty && irec->ir_freecount == irec->ir_count) {
454 if (iwag->iwalk_fn)
461 if (++iwag->nr_recs < iwag->sz_recs) {
475 error = xfs_iwalk_run_callbacks(iwag, &cur, &agi_bp, &has_more);
478 if (iwag->nr_recs == 0 || error)
482 error = xfs_iwalk_run_callbacks(iwag, &cur, &agi_bp, &has_more);
485 xfs_iwalk_del_inobt(iwag->tp, &cur, &agi_bp, error);
559 struct xfs_iwalk_ag iwag = {
578 error = xfs_iwalk_alloc(&iwag);
583 iwag.pag = pag;
584 error = xfs_iwalk_ag(&iwag);
587 iwag.startino = XFS_AGINO_TO_INO(mp, agno + 1, 0);
590 iwag.pag = NULL;
593 if (iwag.pag)
595 xfs_iwalk_free(&iwag);
605 struct xfs_iwalk_ag *iwag;
608 iwag = container_of(pwork, struct xfs_iwalk_ag, pwork);
612 error = xfs_iwalk_alloc(iwag);
619 error = xfs_trans_alloc_empty(mp, &iwag->tp);
622 iwag->drop_trans = 1;
624 error = xfs_iwalk_ag(iwag);
625 if (iwag->tp)
626 xfs_trans_cancel(iwag->tp);
627 xfs_iwalk_free(iwag);
629 xfs_perag_put(iwag->pag);
630 kmem_free(iwag);
661 struct xfs_iwalk_ag *iwag;
666 iwag = kmem_zalloc(sizeof(struct xfs_iwalk_ag), 0);
667 iwag->mp = mp;
673 iwag->pag = xfs_perag_hold(pag);
674 iwag->iwalk_fn = iwalk_fn;
675 iwag->data = data;
676 iwag->startino = startino;
677 iwag->sz_recs = xfs_iwalk_prefetch(inode_records);
678 iwag->lastino = NULLFSINO;
679 xfs_pwork_queue(&pctl, &iwag->pwork);
745 struct xfs_iwalk_ag iwag = {
762 error = xfs_iwalk_alloc(&iwag);
767 iwag.pag = pag;
768 error = xfs_iwalk_ag(&iwag);
771 iwag.startino = XFS_AGINO_TO_INO(mp, pag->pag_agno + 1, 0);
774 iwag.pag = NULL;
777 if (iwag.pag)
779 xfs_iwalk_free(&iwag);