Lines Matching refs:sc
51 struct xfs_scrub *sc, in xrep_chown_orphanage() argument
55 struct xfs_mount *mp = sc->mp; in xrep_chown_orphanage()
123 struct xfs_scrub *sc) in xrep_orphanage_create() argument
125 struct xfs_mount *mp = sc->mp; in xrep_orphanage_create()
127 struct inode *root_inode = VFS_I(sc->mp->m_rootip); in xrep_orphanage_create()
134 sc->orphanage = NULL; in xrep_orphanage_create()
138 ASSERT(sc->tp == NULL); in xrep_orphanage_create()
139 ASSERT(sc->orphanage == NULL); in xrep_orphanage_create()
194 error = xrep_chown_orphanage(sc, XFS_I(orphanage_inode)); in xrep_orphanage_create()
199 sc->orphanage = XFS_I(orphanage_inode); in xrep_orphanage_create()
200 sc->orphanage_ilock_flags = 0; in xrep_orphanage_create()
205 inode_unlock(VFS_I(sc->mp->m_rootip)); in xrep_orphanage_create()
214 struct xfs_scrub *sc, in xrep_orphanage_ilock() argument
217 sc->orphanage_ilock_flags |= ilock_flags; in xrep_orphanage_ilock()
218 xfs_ilock(sc->orphanage, ilock_flags); in xrep_orphanage_ilock()
223 struct xfs_scrub *sc, in xrep_orphanage_ilock_nowait() argument
226 if (xfs_ilock_nowait(sc->orphanage, ilock_flags)) { in xrep_orphanage_ilock_nowait()
227 sc->orphanage_ilock_flags |= ilock_flags; in xrep_orphanage_ilock_nowait()
236 struct xfs_scrub *sc, in xrep_orphanage_iunlock() argument
239 xfs_iunlock(sc->orphanage, ilock_flags); in xrep_orphanage_iunlock()
240 sc->orphanage_ilock_flags &= ~ilock_flags; in xrep_orphanage_iunlock()
246 struct xfs_scrub *sc) in xrep_orphanage_iolock_two() argument
251 if (xchk_should_terminate(sc, &error)) in xrep_orphanage_iolock_two()
259 if (xrep_orphanage_ilock_nowait(sc, XFS_IOLOCK_EXCL)) { in xrep_orphanage_iolock_two()
260 if (xchk_ilock_nowait(sc, XFS_IOLOCK_EXCL)) in xrep_orphanage_iolock_two()
262 xrep_orphanage_iunlock(sc, XFS_IOLOCK_EXCL); in xrep_orphanage_iolock_two()
273 struct xfs_scrub *sc) in xrep_orphanage_rele() argument
275 if (!sc->orphanage) in xrep_orphanage_rele()
278 if (sc->orphanage_ilock_flags) in xrep_orphanage_rele()
279 xfs_iunlock(sc->orphanage, sc->orphanage_ilock_flags); in xrep_orphanage_rele()
281 xchk_irele(sc, sc->orphanage); in xrep_orphanage_rele()
282 sc->orphanage = NULL; in xrep_orphanage_rele()
290 struct xfs_scrub *sc) in xrep_orphanage_can_adopt() argument
292 ASSERT(sc->ip != NULL); in xrep_orphanage_can_adopt()
294 if (!sc->orphanage) in xrep_orphanage_can_adopt()
296 if (sc->ip == sc->orphanage) in xrep_orphanage_can_adopt()
298 if (xfs_internal_inum(sc->mp, sc->ip->i_ino)) in xrep_orphanage_can_adopt()
313 struct xfs_scrub *sc, in xrep_adoption_trans_alloc() argument
316 struct xfs_mount *mp = sc->mp; in xrep_adoption_trans_alloc()
320 ASSERT(sc->tp == NULL); in xrep_adoption_trans_alloc()
321 ASSERT(sc->ip != NULL); in xrep_adoption_trans_alloc()
322 ASSERT(sc->orphanage != NULL); in xrep_adoption_trans_alloc()
323 ASSERT(sc->ilock_flags & XFS_IOLOCK_EXCL); in xrep_adoption_trans_alloc()
324 ASSERT(sc->orphanage_ilock_flags & XFS_IOLOCK_EXCL); in xrep_adoption_trans_alloc()
325 ASSERT(!(sc->ilock_flags & (XFS_ILOCK_SHARED | XFS_ILOCK_EXCL))); in xrep_adoption_trans_alloc()
326 ASSERT(!(sc->orphanage_ilock_flags & in xrep_adoption_trans_alloc()
330 adopt->sc = sc; in xrep_adoption_trans_alloc()
332 if (S_ISDIR(VFS_I(sc->ip)->i_mode)) in xrep_adoption_trans_alloc()
346 &sc->tp); in xrep_adoption_trans_alloc()
350 xfs_lock_two_inodes(sc->orphanage, XFS_ILOCK_EXCL, in xrep_adoption_trans_alloc()
351 sc->ip, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
352 sc->ilock_flags |= XFS_ILOCK_EXCL; in xrep_adoption_trans_alloc()
353 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL; in xrep_adoption_trans_alloc()
355 xfs_trans_ijoin(sc->tp, sc->orphanage, 0); in xrep_adoption_trans_alloc()
356 xfs_trans_ijoin(sc->tp, sc->ip, 0); in xrep_adoption_trans_alloc()
364 error = xfs_trans_reserve_quota_nblks(sc->tp, sc->orphanage, in xrep_adoption_trans_alloc()
375 error = xfs_trans_reserve_quota_nblks(sc->tp, sc->ip, in xrep_adoption_trans_alloc()
383 xchk_trans_cancel(sc); in xrep_adoption_trans_alloc()
384 xrep_orphanage_iunlock(sc, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
385 xchk_iunlock(sc, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
399 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_compute_name() local
406 xname->len = snprintf(namebuf, MAXNAMELEN, "%llu", sc->ip->i_ino); in xrep_adoption_compute_name()
407 xname->type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode); in xrep_adoption_compute_name()
410 error = xchk_dir_lookup(sc, sc->orphanage, xname, &ino); in xrep_adoption_compute_name()
413 sc->ip->i_ino, ++incr); in xrep_adoption_compute_name()
414 error = xchk_dir_lookup(sc, sc->orphanage, xname, &ino); in xrep_adoption_compute_name()
437 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_check_dcache() local
441 d_orphanage = d_find_alias(VFS_I(sc->orphanage)); in xrep_adoption_check_dcache()
447 trace_xrep_adoption_check_child(sc->mp, d_child); in xrep_adoption_check_dcache()
474 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_zap_dcache() local
478 d_orphanage = d_find_alias(VFS_I(sc->orphanage)); in xrep_adoption_zap_dcache()
484 trace_xrep_adoption_invalidate_child(sc->mp, d_child); in xrep_adoption_zap_dcache()
495 while ((d_child = d_find_alias(VFS_I(sc->ip))) != NULL) { in xrep_adoption_zap_dcache()
496 trace_xrep_adoption_invalidate_child(sc->mp, d_child); in xrep_adoption_zap_dcache()
526 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_move() local
527 bool isdir = S_ISDIR(VFS_I(sc->ip)->i_mode); in xrep_adoption_move()
530 trace_xrep_adoption_reparent(sc->orphanage, adopt->xname, in xrep_adoption_move()
531 sc->ip->i_ino); in xrep_adoption_move()
542 if (!xfs_inode_has_attr_fork(sc->ip) && xfs_has_parent(sc->mp)) { in xrep_adoption_move()
545 error = xfs_bmap_add_attrfork(sc->tp, sc->ip, sf_size, true); in xrep_adoption_move()
551 error = xfs_dir_createname(sc->tp, sc->orphanage, adopt->xname, in xrep_adoption_move()
552 sc->ip->i_ino, adopt->orphanage_blkres); in xrep_adoption_move()
560 xfs_trans_ichgtime(sc->tp, sc->orphanage, in xrep_adoption_move()
563 xfs_bumplink(sc->tp, sc->orphanage); in xrep_adoption_move()
564 xfs_trans_log_inode(sc->tp, sc->orphanage, XFS_ILOG_CORE); in xrep_adoption_move()
568 xfs_bumplink(sc->tp, sc->ip); in xrep_adoption_move()
569 xfs_trans_log_inode(sc->tp, sc->ip, XFS_ILOG_CORE); in xrep_adoption_move()
574 error = xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, in xrep_adoption_move()
575 sc->orphanage->i_ino, adopt->child_blkres); in xrep_adoption_move()
581 if (xfs_has_parent(sc->mp)) { in xrep_adoption_move()
582 error = xfs_parent_addname(sc->tp, &adopt->ppargs, in xrep_adoption_move()
583 sc->orphanage, adopt->xname, sc->ip); in xrep_adoption_move()
593 xfs_dir_update_hook(sc->orphanage, sc->ip, 1, adopt->xname); in xrep_adoption_move()
614 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_trans_roll() local
617 trace_xrep_adoption_trans_roll(sc->orphanage, sc->ip, in xrep_adoption_trans_roll()
618 !!(sc->tp->t_flags & XFS_TRANS_DIRTY)); in xrep_adoption_trans_roll()
621 error = xrep_defer_finish(sc); in xrep_adoption_trans_roll()
626 return xfs_trans_roll(&sc->tp); in xrep_adoption_trans_roll()