Lines Matching refs:xc

88 	struct xrep_cow		*xc,  in xrep_cow_mark_file_range()  argument
94 startoff = xc->irec.br_startoff + in xrep_cow_mark_file_range()
95 (startblock - xc->irec.br_startblock); in xrep_cow_mark_file_range()
97 trace_xrep_cow_mark_file_range(xc->sc->ip, startblock, startoff, in xrep_cow_mark_file_range()
100 return xoff_bitmap_set(&xc->bad_fileoffs, startoff, blockcount); in xrep_cow_mark_file_range()
109 struct xrep_cow *xc, in xrep_cow_trim_refcount() argument
117 if (dst->rc_startblock < xc->irec_startbno) { in xrep_cow_trim_refcount()
118 adj = xc->irec_startbno - dst->rc_startblock; in xrep_cow_trim_refcount()
124 xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_trim_refcount()
126 (xc->irec_startbno + xc->irec.br_blockcount); in xrep_cow_trim_refcount()
138 struct xrep_cow *xc = priv; in xrep_cow_mark_shared_staging() local
146 xrep_cow_trim_refcount(xc, &rrec, rec); in xrep_cow_mark_shared_staging()
148 fsbno = XFS_AGB_TO_FSB(xc->sc->mp, cur->bc_ag.pag->pag_agno, in xrep_cow_mark_shared_staging()
150 return xrep_cow_mark_file_range(xc, fsbno, rrec.rc_blockcount); in xrep_cow_mark_shared_staging()
167 struct xrep_cow *xc = priv; in xrep_cow_mark_missing_staging() local
175 xrep_cow_trim_refcount(xc, &rrec, rec); in xrep_cow_mark_missing_staging()
177 if (xc->next_bno >= rrec.rc_startblock) in xrep_cow_mark_missing_staging()
180 error = xrep_cow_mark_file_range(xc, in xrep_cow_mark_missing_staging()
181 XFS_AGB_TO_FSB(xc->sc->mp, cur->bc_ag.pag->pag_agno, in xrep_cow_mark_missing_staging()
182 xc->next_bno), in xrep_cow_mark_missing_staging()
183 rrec.rc_startblock - xc->next_bno); in xrep_cow_mark_missing_staging()
188 xc->next_bno = rrec.rc_startblock + rrec.rc_blockcount; in xrep_cow_mark_missing_staging()
202 struct xrep_cow *xc = priv; in xrep_cow_mark_missing_staging_rmap() local
213 if (rec_bno < xc->irec_startbno) { in xrep_cow_mark_missing_staging_rmap()
214 adj = xc->irec_startbno - rec_bno; in xrep_cow_mark_missing_staging_rmap()
219 if (rec_bno + rec_len > xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_mark_missing_staging_rmap()
221 (xc->irec_startbno + xc->irec.br_blockcount); in xrep_cow_mark_missing_staging_rmap()
225 fsbno = XFS_AGB_TO_FSB(xc->sc->mp, cur->bc_ag.pag->pag_agno, rec_bno); in xrep_cow_mark_missing_staging_rmap()
226 return xrep_cow_mark_file_range(xc, fsbno, rec_len); in xrep_cow_mark_missing_staging_rmap()
235 struct xrep_cow *xc) in xrep_cow_find_bad() argument
242 struct xfs_scrub *sc = xc->sc; in xrep_cow_find_bad()
246 agno = XFS_FSB_TO_AGNO(sc->mp, xc->irec.br_startblock); in xrep_cow_find_bad()
247 xc->irec_startbno = XFS_FSB_TO_AGBNO(sc->mp, xc->irec.br_startblock); in xrep_cow_find_bad()
258 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad()
259 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
262 xrep_cow_mark_shared_staging, xc); in xrep_cow_find_bad()
267 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad()
268 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
270 xc->next_bno = xc->irec_startbno; in xrep_cow_find_bad()
272 xrep_cow_mark_missing_staging, xc); in xrep_cow_find_bad()
276 if (xc->next_bno < xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_find_bad()
277 error = xrep_cow_mark_file_range(xc, in xrep_cow_find_bad()
279 xc->next_bno), in xrep_cow_find_bad()
280 xc->irec_startbno + xc->irec.br_blockcount - in xrep_cow_find_bad()
281 xc->next_bno); in xrep_cow_find_bad()
287 rm_low.rm_startblock = xc->irec_startbno; in xrep_cow_find_bad()
289 rm_high.rm_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
291 xrep_cow_mark_missing_staging_rmap, xc); in xrep_cow_find_bad()
301 error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock, in xrep_cow_find_bad()
302 xc->irec.br_blockcount); in xrep_cow_find_bad()
362 struct xrep_cow *xc, in xrep_cow_find_mapping() argument
367 struct xfs_inode *ip = xc->sc->ip; in xrep_cow_find_mapping()
443 struct xrep_cow *xc, in xrep_cow_replace_range() argument
450 struct xfs_scrub *sc = xc->sc; in xrep_cow_replace_range()
459 error = xrep_cow_find_mapping(xc, &icur, startoff, &got); in xrep_cow_replace_range()
487 error = xfsb_bitmap_set(&xc->old_cowfork_fsblocks, got.br_startblock, in xrep_cow_replace_range()
506 struct xrep_cow *xc = priv; in xrep_cow_replace() local
513 error = xrep_cow_replace_range(xc, startoff, &len); in xrep_cow_replace()
533 struct xrep_cow *xc; in xrep_bmap_cow() local
558 xc = kzalloc(sizeof(struct xrep_cow), XCHK_GFP_FLAGS); in xrep_bmap_cow()
559 if (!xc) in xrep_bmap_cow()
564 xc->sc = sc; in xrep_bmap_cow()
565 xoff_bitmap_init(&xc->bad_fileoffs); in xrep_bmap_cow()
566 xfsb_bitmap_init(&xc->old_cowfork_fsblocks); in xrep_bmap_cow()
568 for_each_xfs_iext(ifp, &icur, &xc->irec) { in xrep_bmap_cow()
577 if (isnullstartblock(xc->irec.br_startblock)) in xrep_bmap_cow()
586 if (xfs_bmap_is_written_extent(&xc->irec)) in xrep_bmap_cow()
589 error = xrep_cow_find_bad(xc); in xrep_bmap_cow()
595 error = xoff_bitmap_walk(&xc->bad_fileoffs, xrep_cow_replace, xc); in xrep_bmap_cow()
604 error = xrep_reap_fsblocks(sc, &xc->old_cowfork_fsblocks, in xrep_bmap_cow()
610 xfsb_bitmap_destroy(&xc->old_cowfork_fsblocks); in xrep_bmap_cow()
611 xoff_bitmap_destroy(&xc->bad_fileoffs); in xrep_bmap_cow()
612 kfree(xc); in xrep_bmap_cow()