Lines Matching +full:scrubber +full:- +full:done

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2017-2023 Oracle. All Rights Reserved.
52 struct xfs_mount *mp = sc->mp; in xchk_setup_rtsummary()
57 rts = kvzalloc(struct_size(rts, words, mp->m_blockwsize), in xchk_setup_rtsummary()
60 return -ENOMEM; in xchk_setup_rtsummary()
61 sc->buf = rts; in xchk_setup_rtsummary()
68 error = xfile_create(descr, mp->m_rsumsize, &sc->xfile); in xchk_setup_rtsummary()
77 error = xchk_install_live_inode(sc, mp->m_rsumip); in xchk_setup_rtsummary()
87 * careful to unlock it ourselves when we are done with the rtbitmap in xchk_setup_rtsummary()
91 xfs_ilock(mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); in xchk_setup_rtsummary()
99 if (mp->m_sb.sb_rblocks) { in xchk_setup_rtsummary()
103 rts->rextents = xfs_rtb_to_rtx(mp, mp->m_sb.sb_rblocks); in xchk_setup_rtsummary()
104 rextslog = xfs_compute_rextslog(rts->rextents); in xchk_setup_rtsummary()
105 rts->rsumlevels = rextslog + 1; in xchk_setup_rtsummary()
106 rts->rbmblocks = xfs_rtbitmap_blockcount(mp, rts->rextents); in xchk_setup_rtsummary()
107 rsumblocks = xfs_rtsummary_blockcount(mp, rts->rsumlevels, in xchk_setup_rtsummary()
108 rts->rbmblocks); in xchk_setup_rtsummary()
109 rts->rsumsize = XFS_FSB_TO_B(mp, rsumblocks); in xchk_setup_rtsummary()
122 return xfile_obj_load(sc->xfile, rawinfo, in xfsum_load()
133 return xfile_obj_store(sc->xfile, &rawinfo, in xfsum_store()
145 return xfile_obj_load(sc->xfile, rawinfo, nr_words << XFS_WORDLOG, in xfsum_copyout()
154 v->old += 1; in xchk_rtsum_inc()
155 return v->old; in xchk_rtsum_inc()
180 rbmoff = xfs_rtx_to_rbmblock(mp, rec->ar_startext); in xchk_rtsum_record_free()
181 lenlog = xfs_highbit64(rec->ar_extcount); in xchk_rtsum_record_free()
184 rtbno = xfs_rtx_to_rtb(mp, rec->ar_startext); in xchk_rtsum_record_free()
185 rtlen = xfs_rtx_to_rtb(mp, rec->ar_extcount); in xchk_rtsum_record_free()
188 xchk_ino_xref_set_corrupt(sc, mp->m_rbmip->i_ino); in xchk_rtsum_record_free()
189 return -EFSCORRUPTED; in xchk_rtsum_record_free()
197 value = xchk_rtsum_inc(sc->mp, &v); in xchk_rtsum_record_free()
198 trace_xchk_rtsum_record_free(mp, rec->ar_startext, rec->ar_extcount, in xchk_rtsum_record_free()
209 struct xfs_mount *mp = sc->mp; in xchk_rtsum_compute()
213 rtbmp_blocks = xfs_rtbitmap_blockcount(mp, mp->m_sb.sb_rextents); in xchk_rtsum_compute()
214 if (XFS_FSB_TO_B(mp, rtbmp_blocks) != mp->m_rbmip->i_disk_size) in xchk_rtsum_compute()
215 return -EFSCORRUPTED; in xchk_rtsum_compute()
217 return xfs_rtalloc_query_all(sc->mp, sc->tp, xchk_rtsum_record_free, in xchk_rtsum_compute()
229 struct xfs_mount *mp = sc->mp; in xchk_rtsum_compare()
230 struct xfs_inode *ip = sc->ip; in xchk_rtsum_compare()
231 struct xchk_rtsummary *rts = sc->buf; in xchk_rtsum_compare()
237 rts->args.mp = sc->mp; in xchk_rtsum_compare()
238 rts->args.tp = sc->tp; in xchk_rtsum_compare()
241 endoff = XFS_B_TO_FSB(mp, ip->i_disk_size); in xchk_rtsum_compare()
242 if (xfs_iext_lookup_extent(ip, &ip->i_df, endoff, &icur, &map)) { in xchk_rtsum_compare()
252 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_rtsum_compare()
256 error = xfs_bmapi_read(ip, off, endoff - off, &map, &nmap, in xchk_rtsum_compare()
273 error = xfs_rtsummary_read_buf(&rts->args, off); in xchk_rtsum_compare()
278 error = xfsum_copyout(sc, sumoff, rts->words, mp->m_blockwsize); in xchk_rtsum_compare()
280 xfs_rtbuf_cache_relse(&rts->args); in xchk_rtsum_compare()
284 ondisk_info = xfs_rsumblock_infoptr(&rts->args, 0); in xchk_rtsum_compare()
285 if (memcmp(ondisk_info, rts->words, in xchk_rtsum_compare()
286 mp->m_blockwsize << XFS_WORDLOG) != 0) { in xchk_rtsum_compare()
288 xfs_rtbuf_cache_relse(&rts->args); in xchk_rtsum_compare()
292 xfs_rtbuf_cache_relse(&rts->args); in xchk_rtsum_compare()
293 sumoff += mp->m_blockwsize; in xchk_rtsum_compare()
304 struct xfs_mount *mp = sc->mp; in xchk_rtsummary()
305 struct xchk_rtsummary *rts = sc->buf; in xchk_rtsummary()
309 if (mp->m_sb.sb_rextents != rts->rextents) { in xchk_rtsummary()
310 xchk_ino_set_corrupt(sc, mp->m_rbmip->i_ino); in xchk_rtsummary()
315 if (mp->m_rsumlevels != rts->rsumlevels) { in xchk_rtsummary()
316 xchk_ino_set_corrupt(sc, mp->m_rsumip->i_ino); in xchk_rtsummary()
321 if (mp->m_rsumsize != rts->rsumsize) { in xchk_rtsummary()
322 xchk_ino_set_corrupt(sc, mp->m_rsumip->i_ino); in xchk_rtsummary()
327 if (mp->m_rsumip->i_disk_size & mp->m_blockmask) { in xchk_rtsummary()
328 xchk_ino_set_corrupt(sc, mp->m_rsumip->i_ino); in xchk_rtsummary()
337 if (mp->m_rsumip->i_disk_size < rts->rsumsize) { in xchk_rtsummary()
338 xchk_ino_set_corrupt(sc, mp->m_rsumip->i_ino); in xchk_rtsummary()
342 /* Invoke the fork scrubber. */ in xchk_rtsummary()
344 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_rtsummary()
349 if (error == -EFSCORRUPTED) { in xchk_rtsummary()
354 xchk_ino_xref_set_corrupt(sc, mp->m_rbmip->i_ino); in xchk_rtsummary()
365 /* Unlock the rtbitmap since we're done with it. */ in xchk_rtsummary()
366 xfs_iunlock(mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); in xchk_rtsummary()