Lines Matching full:sc

51 	struct xfs_scrub	*sc,  in xrep_chown_orphanage()  argument
55 struct xfs_mount *mp = sc->mp; in xrep_chown_orphanage()
120 /* Create the orphanage directory, and set sc->orphanage to it. */
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()
243 /* Grab the IOLOCK of the orphanage and sc->ip. */
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()
287 /* Can the orphanage adopt @sc->ip? */
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 (xchk_inode_is_sb_rooted(sc->ip)) in xrep_orphanage_can_adopt()
300 if (xfs_is_internal_inode(sc->ip)) in xrep_orphanage_can_adopt()
309 * adoption, take ILOCK_EXCL of the orphanage and sc->ip, joins them to the
311 * IOLOCK of the orphanage and sc->ip.
315 struct xfs_scrub *sc, in xrep_adoption_trans_alloc() argument
318 struct xfs_mount *mp = sc->mp; in xrep_adoption_trans_alloc()
322 ASSERT(sc->tp == NULL); in xrep_adoption_trans_alloc()
323 ASSERT(sc->ip != NULL); in xrep_adoption_trans_alloc()
324 ASSERT(sc->orphanage != NULL); in xrep_adoption_trans_alloc()
325 ASSERT(sc->ilock_flags & XFS_IOLOCK_EXCL); in xrep_adoption_trans_alloc()
326 ASSERT(sc->orphanage_ilock_flags & XFS_IOLOCK_EXCL); in xrep_adoption_trans_alloc()
327 ASSERT(!(sc->ilock_flags & (XFS_ILOCK_SHARED | XFS_ILOCK_EXCL))); in xrep_adoption_trans_alloc()
328 ASSERT(!(sc->orphanage_ilock_flags & in xrep_adoption_trans_alloc()
332 adopt->sc = sc; in xrep_adoption_trans_alloc()
334 if (S_ISDIR(VFS_I(sc->ip)->i_mode)) in xrep_adoption_trans_alloc()
348 &sc->tp); in xrep_adoption_trans_alloc()
352 xfs_lock_two_inodes(sc->orphanage, XFS_ILOCK_EXCL, in xrep_adoption_trans_alloc()
353 sc->ip, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
354 sc->ilock_flags |= XFS_ILOCK_EXCL; in xrep_adoption_trans_alloc()
355 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL; in xrep_adoption_trans_alloc()
357 xfs_trans_ijoin(sc->tp, sc->orphanage, 0); in xrep_adoption_trans_alloc()
358 xfs_trans_ijoin(sc->tp, sc->ip, 0); in xrep_adoption_trans_alloc()
366 error = xfs_trans_reserve_quota_nblks(sc->tp, sc->orphanage, in xrep_adoption_trans_alloc()
377 error = xfs_trans_reserve_quota_nblks(sc->tp, sc->ip, in xrep_adoption_trans_alloc()
385 xchk_trans_cancel(sc); in xrep_adoption_trans_alloc()
386 xrep_orphanage_iunlock(sc, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
387 xchk_iunlock(sc, XFS_ILOCK_EXCL); in xrep_adoption_trans_alloc()
393 * orphanage. Caller must hold ILOCKs of sc->ip and the orphanage and must not
401 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_compute_name() local
408 xname->len = snprintf(namebuf, MAXNAMELEN, "%llu", sc->ip->i_ino); in xrep_adoption_compute_name()
409 xname->type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode); in xrep_adoption_compute_name()
412 error = xchk_dir_lookup(sc, sc->orphanage, xname, &ino); in xrep_adoption_compute_name()
415 sc->ip->i_ino, ++incr); in xrep_adoption_compute_name()
416 error = xchk_dir_lookup(sc, sc->orphanage, xname, &ino); in xrep_adoption_compute_name()
439 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_check_dcache() local
443 d_orphanage = d_find_alias(VFS_I(sc->orphanage)); in xrep_adoption_check_dcache()
449 trace_xrep_adoption_check_child(sc->mp, d_child); in xrep_adoption_check_dcache()
476 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_zap_dcache() local
480 d_orphanage = d_find_alias(VFS_I(sc->orphanage)); in xrep_adoption_zap_dcache()
486 trace_xrep_adoption_invalidate_child(sc->mp, d_child); in xrep_adoption_zap_dcache()
497 while ((d_child = d_find_alias(VFS_I(sc->ip))) != NULL) { in xrep_adoption_zap_dcache()
498 trace_xrep_adoption_invalidate_child(sc->mp, d_child); in xrep_adoption_zap_dcache()
528 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_move() local
529 bool isdir = S_ISDIR(VFS_I(sc->ip)->i_mode); in xrep_adoption_move()
532 trace_xrep_adoption_reparent(sc->orphanage, adopt->xname, in xrep_adoption_move()
533 sc->ip->i_ino); in xrep_adoption_move()
544 if (!xfs_inode_has_attr_fork(sc->ip) && xfs_has_parent(sc->mp)) { in xrep_adoption_move()
547 error = xfs_bmap_add_attrfork(sc->tp, sc->ip, sf_size, true); in xrep_adoption_move()
553 error = xfs_dir_createname(sc->tp, sc->orphanage, adopt->xname, in xrep_adoption_move()
554 sc->ip->i_ino, adopt->orphanage_blkres); in xrep_adoption_move()
562 xfs_trans_ichgtime(sc->tp, sc->orphanage, in xrep_adoption_move()
565 xfs_bumplink(sc->tp, sc->orphanage); in xrep_adoption_move()
566 xfs_trans_log_inode(sc->tp, sc->orphanage, XFS_ILOG_CORE); in xrep_adoption_move()
570 xfs_bumplink(sc->tp, sc->ip); in xrep_adoption_move()
571 xfs_trans_log_inode(sc->tp, sc->ip, XFS_ILOG_CORE); in xrep_adoption_move()
576 error = xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, in xrep_adoption_move()
577 sc->orphanage->i_ino, adopt->child_blkres); in xrep_adoption_move()
583 if (xfs_has_parent(sc->mp)) { in xrep_adoption_move()
584 error = xfs_parent_addname(sc->tp, &adopt->ppargs, in xrep_adoption_move()
585 sc->orphanage, adopt->xname, sc->ip); in xrep_adoption_move()
595 xfs_dir_update_hook(sc->orphanage, sc->ip, 1, adopt->xname); in xrep_adoption_move()
616 struct xfs_scrub *sc = adopt->sc; in xrep_adoption_trans_roll() local
619 trace_xrep_adoption_trans_roll(sc->orphanage, sc->ip, in xrep_adoption_trans_roll()
620 !!(sc->tp->t_flags & XFS_TRANS_DIRTY)); in xrep_adoption_trans_roll()
623 error = xrep_defer_finish(sc); in xrep_adoption_trans_roll()
628 return xfs_trans_roll(&sc->tp); in xrep_adoption_trans_roll()