Lines Matching +full:0 +full:xc

91  * space.  Caller must ensure that the physical range is within xc->irec.
95 struct xrep_cow *xc, in xrep_cow_mark_file_range() argument
101 startoff = xc->irec.br_startoff + in xrep_cow_mark_file_range()
102 (startblock - xc->irec.br_startblock); in xrep_cow_mark_file_range()
104 trace_xrep_cow_mark_file_range(xc->sc->ip, startblock, startoff, in xrep_cow_mark_file_range()
107 return xoff_bitmap_set(&xc->bad_fileoffs, startoff, blockcount); in xrep_cow_mark_file_range()
116 struct xrep_cow *xc, in xrep_cow_trim_refcount() argument
124 if (dst->rc_startblock < xc->irec_startbno) { in xrep_cow_trim_refcount()
125 adj = xc->irec_startbno - dst->rc_startblock; in xrep_cow_trim_refcount()
131 xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_trim_refcount()
133 (xc->irec_startbno + xc->irec.br_blockcount); in xrep_cow_trim_refcount()
145 struct xrep_cow *xc = priv; in xrep_cow_mark_shared_staging() local
152 xrep_cow_trim_refcount(xc, &rrec, rec); in xrep_cow_mark_shared_staging()
154 return xrep_cow_mark_file_range(xc, in xrep_cow_mark_shared_staging()
173 struct xrep_cow *xc = priv; in xrep_cow_mark_missing_staging() local
181 xrep_cow_trim_refcount(xc, &rrec, rec); in xrep_cow_mark_missing_staging()
183 if (xc->next_bno >= rrec.rc_startblock) in xrep_cow_mark_missing_staging()
186 error = xrep_cow_mark_file_range(xc, in xrep_cow_mark_missing_staging()
187 xfs_gbno_to_fsb(cur->bc_group, xc->next_bno), in xrep_cow_mark_missing_staging()
188 rrec.rc_startblock - xc->next_bno); in xrep_cow_mark_missing_staging()
193 xc->next_bno = rrec.rc_startblock + rrec.rc_blockcount; in xrep_cow_mark_missing_staging()
194 return 0; in xrep_cow_mark_missing_staging()
207 struct xrep_cow *xc = priv; in xrep_cow_mark_missing_staging_rmap() local
213 return 0; in xrep_cow_mark_missing_staging_rmap()
217 if (rec_bno < xc->irec_startbno) { in xrep_cow_mark_missing_staging_rmap()
218 adj = xc->irec_startbno - rec_bno; in xrep_cow_mark_missing_staging_rmap()
223 if (rec_bno + rec_len > xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_mark_missing_staging_rmap()
225 (xc->irec_startbno + xc->irec.br_blockcount); in xrep_cow_mark_missing_staging_rmap()
229 return xrep_cow_mark_file_range(xc, in xrep_cow_mark_missing_staging_rmap()
239 struct xrep_cow *xc) in xrep_cow_find_bad() argument
241 struct xfs_refcount_irec rc_low = { 0 }; in xrep_cow_find_bad()
242 struct xfs_refcount_irec rc_high = { 0 }; in xrep_cow_find_bad()
243 struct xfs_rmap_irec rm_low = { 0 }; in xrep_cow_find_bad()
244 struct xfs_rmap_irec rm_high = { 0 }; in xrep_cow_find_bad()
246 struct xfs_scrub *sc = xc->sc; in xrep_cow_find_bad()
250 agno = XFS_FSB_TO_AGNO(sc->mp, xc->irec.br_startblock); in xrep_cow_find_bad()
251 xc->irec_startbno = XFS_FSB_TO_AGBNO(sc->mp, xc->irec.br_startblock); in xrep_cow_find_bad()
262 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad()
263 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
266 xrep_cow_mark_shared_staging, xc); in xrep_cow_find_bad()
271 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad()
272 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
274 xc->next_bno = xc->irec_startbno; in xrep_cow_find_bad()
276 xrep_cow_mark_missing_staging, xc); in xrep_cow_find_bad()
280 if (xc->next_bno < xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_find_bad()
281 error = xrep_cow_mark_file_range(xc, in xrep_cow_find_bad()
282 xfs_agbno_to_fsb(pag, xc->next_bno), in xrep_cow_find_bad()
283 xc->irec_startbno + xc->irec.br_blockcount - in xrep_cow_find_bad()
284 xc->next_bno); in xrep_cow_find_bad()
290 rm_low.rm_startblock = xc->irec_startbno; in xrep_cow_find_bad()
291 memset(&rm_high, 0xFF, sizeof(rm_high)); in xrep_cow_find_bad()
292 rm_high.rm_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad()
294 xrep_cow_mark_missing_staging_rmap, xc); in xrep_cow_find_bad()
304 error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock, in xrep_cow_find_bad()
305 xc->irec.br_blockcount); in xrep_cow_find_bad()
314 return 0; in xrep_cow_find_bad()
323 struct xrep_cow *xc) in xrep_cow_find_bad_rt() argument
325 struct xfs_refcount_irec rc_low = { 0 }; in xrep_cow_find_bad_rt()
326 struct xfs_refcount_irec rc_high = { 0 }; in xrep_cow_find_bad_rt()
327 struct xfs_rmap_irec rm_low = { 0 }; in xrep_cow_find_bad_rt()
328 struct xfs_rmap_irec rm_high = { 0 }; in xrep_cow_find_bad_rt()
329 struct xfs_scrub *sc = xc->sc; in xrep_cow_find_bad_rt()
331 int error = 0; in xrep_cow_find_bad_rt()
333 xc->irec_startbno = xfs_rtb_to_rgbno(sc->mp, xc->irec.br_startblock); in xrep_cow_find_bad_rt()
336 xfs_rtb_to_rgno(sc->mp, xc->irec.br_startblock)); in xrep_cow_find_bad_rt()
346 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad_rt()
347 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad_rt()
350 xrep_cow_mark_shared_staging, xc); in xrep_cow_find_bad_rt()
355 rc_low.rc_startblock = xc->irec_startbno; in xrep_cow_find_bad_rt()
356 rc_high.rc_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad_rt()
358 xc->next_bno = xc->irec_startbno; in xrep_cow_find_bad_rt()
360 xrep_cow_mark_missing_staging, xc); in xrep_cow_find_bad_rt()
364 if (xc->next_bno < xc->irec_startbno + xc->irec.br_blockcount) { in xrep_cow_find_bad_rt()
365 error = xrep_cow_mark_file_range(xc, in xrep_cow_find_bad_rt()
366 xfs_rgbno_to_rtb(rtg, xc->next_bno), in xrep_cow_find_bad_rt()
367 xc->irec_startbno + xc->irec.br_blockcount - in xrep_cow_find_bad_rt()
368 xc->next_bno); in xrep_cow_find_bad_rt()
374 rm_low.rm_startblock = xc->irec_startbno; in xrep_cow_find_bad_rt()
375 memset(&rm_high, 0xFF, sizeof(rm_high)); in xrep_cow_find_bad_rt()
376 rm_high.rm_startblock = xc->irec_startbno + xc->irec.br_blockcount - 1; in xrep_cow_find_bad_rt()
378 xrep_cow_mark_missing_staging_rmap, xc); in xrep_cow_find_bad_rt()
389 error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock, in xrep_cow_find_bad_rt()
390 xc->irec.br_blockcount); in xrep_cow_find_bad_rt()
425 error = xfs_trans_reserve_more(sc->tp, maxlen, 0); in xrep_cow_alloc()
440 return 0; in xrep_cow_alloc()
456 error = xfs_trans_reserve_more(sc->tp, 0, maxrtx); in xrep_cow_alloc_rt()
466 return 0; in xrep_cow_alloc_rt()
477 struct xrep_cow *xc, in xrep_cow_find_mapping() argument
482 struct xfs_inode *ip = xc->sc->ip; in xrep_cow_find_mapping()
491 if (got->br_blockcount == 0) in xrep_cow_find_mapping()
500 return 0; in xrep_cow_find_mapping()
502 ASSERT(0); in xrep_cow_find_mapping()
506 #define REPLACE_LEFT_SIDE (1U << 0)
522 ASSERT(repl->len > 0); in xrep_cow_replace_mapping()
558 struct xrep_cow *xc, in xrep_cow_replace_range() argument
565 struct xfs_scrub *sc = xc->sc; in xrep_cow_replace_range()
574 error = xrep_cow_find_mapping(xc, &icur, startoff, &got); in xrep_cow_replace_range()
606 error = xrtb_bitmap_set(&xc->old_cowfork_rtblocks, in xrep_cow_replace_range()
609 error = xfsb_bitmap_set(&xc->old_cowfork_fsblocks, in xrep_cow_replace_range()
615 return 0; in xrep_cow_replace_range()
628 struct xrep_cow *xc = priv; in xrep_cow_replace() local
629 int error = 0; in xrep_cow_replace()
631 while (blockcount > 0) { in xrep_cow_replace()
635 error = xrep_cow_replace_range(xc, startoff, &len); in xrep_cow_replace()
655 struct xrep_cow *xc; in xrep_bmap_cow() local
664 return 0; in xrep_bmap_cow()
684 ifp->if_nextents = 0; in xrep_bmap_cow()
685 return 0; in xrep_bmap_cow()
688 xc = kzalloc(sizeof(struct xrep_cow), XCHK_GFP_FLAGS); in xrep_bmap_cow()
689 if (!xc) in xrep_bmap_cow()
692 xfs_trans_ijoin(sc->tp, sc->ip, 0); in xrep_bmap_cow()
694 xc->sc = sc; in xrep_bmap_cow()
695 xoff_bitmap_init(&xc->bad_fileoffs); in xrep_bmap_cow()
697 xrtb_bitmap_init(&xc->old_cowfork_rtblocks); in xrep_bmap_cow()
699 xfsb_bitmap_init(&xc->old_cowfork_fsblocks); in xrep_bmap_cow()
701 for_each_xfs_iext(ifp, &icur, &xc->irec) { in xrep_bmap_cow()
710 if (isnullstartblock(xc->irec.br_startblock)) in xrep_bmap_cow()
719 if (xfs_bmap_is_written_extent(&xc->irec)) in xrep_bmap_cow()
723 error = xrep_cow_find_bad_rt(xc); in xrep_bmap_cow()
725 error = xrep_cow_find_bad(xc); in xrep_bmap_cow()
731 error = xoff_bitmap_walk(&xc->bad_fileoffs, xrep_cow_replace, xc); in xrep_bmap_cow()
741 error = xrep_reap_rtblocks(sc, &xc->old_cowfork_rtblocks, in xrep_bmap_cow()
744 error = xrep_reap_fsblocks(sc, &xc->old_cowfork_fsblocks, in xrep_bmap_cow()
751 xrtb_bitmap_destroy(&xc->old_cowfork_rtblocks); in xrep_bmap_cow()
753 xfsb_bitmap_destroy(&xc->old_cowfork_fsblocks); in xrep_bmap_cow()
754 xoff_bitmap_destroy(&xc->bad_fileoffs); in xrep_bmap_cow()
755 kfree(xc); in xrep_bmap_cow()