Lines Matching full:sc
40 struct xfs_scrub *sc, in xrep_tempfile_create() argument
44 .pip = sc->mp->m_rootip, in xrep_tempfile_create()
48 struct xfs_mount *mp = sc->mp; in xrep_tempfile_create()
65 ASSERT(sc->tp == NULL); in xrep_tempfile_create()
66 ASSERT(sc->tempip == NULL); in xrep_tempfile_create()
94 error = xfs_icreate(tp, ino, &args, &sc->tempip); in xrep_tempfile_create()
99 sc->tempip->i_diflags &= ~(XFS_DIFLAG_REALTIME | XFS_DIFLAG_RTINHERIT); in xrep_tempfile_create()
100 xfs_trans_log_inode(tp, sc->tempip, XFS_ILOG_CORE); in xrep_tempfile_create()
107 VFS_I(sc->tempip)->i_flags |= S_PRIVATE; in xrep_tempfile_create()
108 VFS_I(sc->tempip)->i_opflags &= ~IOP_XATTR; in xrep_tempfile_create()
111 error = xfs_dir_init(tp, sc->tempip, dp); in xrep_tempfile_create()
114 } else if (S_ISLNK(VFS_I(sc->tempip)->i_mode)) { in xrep_tempfile_create()
122 error = xfs_symlink_write_target(tp, sc->tempip, in xrep_tempfile_create()
123 sc->tempip->i_ino, ".", 1, 0, 0); in xrep_tempfile_create()
133 xfs_qm_vop_create_dqattach(tp, sc->tempip, udqp, gdqp, pdqp); in xrep_tempfile_create()
142 error = xfs_iunlink(tp, sc->tempip); in xrep_tempfile_create()
150 trace_xrep_tempfile_create(sc); in xrep_tempfile_create()
157 xfs_iunlock(sc->tempip, XFS_ILOCK_EXCL); in xrep_tempfile_create()
158 xfs_setup_iops(sc->tempip); in xrep_tempfile_create()
159 xfs_finish_inode_setup(sc->tempip); in xrep_tempfile_create()
161 sc->temp_ilock_flags = 0; in xrep_tempfile_create()
172 if (sc->tempip) { in xrep_tempfile_create()
173 xfs_iunlock(sc->tempip, XFS_ILOCK_EXCL); in xrep_tempfile_create()
174 xfs_finish_inode_setup(sc->tempip); in xrep_tempfile_create()
175 xchk_irele(sc, sc->tempip); in xrep_tempfile_create()
188 struct xfs_scrub *sc) in xrep_tempfile_iolock_nowait() argument
190 if (xfs_ilock_nowait(sc->tempip, XFS_IOLOCK_EXCL)) { in xrep_tempfile_iolock_nowait()
191 sc->temp_ilock_flags |= XFS_IOLOCK_EXCL; in xrep_tempfile_iolock_nowait()
205 struct xfs_scrub *sc) in xrep_tempfile_iolock_polled() argument
209 while (!xrep_tempfile_iolock_nowait(sc)) { in xrep_tempfile_iolock_polled()
210 if (xchk_should_terminate(sc, &error)) in xrep_tempfile_iolock_polled()
221 struct xfs_scrub *sc) in xrep_tempfile_iounlock() argument
223 xfs_iunlock(sc->tempip, XFS_IOLOCK_EXCL); in xrep_tempfile_iounlock()
224 sc->temp_ilock_flags &= ~XFS_IOLOCK_EXCL; in xrep_tempfile_iounlock()
230 struct xfs_scrub *sc) in xrep_tempfile_ilock() argument
232 sc->temp_ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempfile_ilock()
233 xfs_ilock(sc->tempip, XFS_ILOCK_EXCL); in xrep_tempfile_ilock()
239 struct xfs_scrub *sc) in xrep_tempfile_ilock_nowait() argument
241 if (xfs_ilock_nowait(sc->tempip, XFS_ILOCK_EXCL)) { in xrep_tempfile_ilock_nowait()
242 sc->temp_ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempfile_ilock_nowait()
252 struct xfs_scrub *sc) in xrep_tempfile_iunlock() argument
254 xfs_iunlock(sc->tempip, XFS_ILOCK_EXCL); in xrep_tempfile_iunlock()
255 sc->temp_ilock_flags &= ~XFS_ILOCK_EXCL; in xrep_tempfile_iunlock()
264 struct xfs_scrub *sc) in xrep_tempfile_ilock_both() argument
266 xfs_lock_two_inodes(sc->ip, XFS_ILOCK_EXCL, sc->tempip, XFS_ILOCK_EXCL); in xrep_tempfile_ilock_both()
267 sc->ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempfile_ilock_both()
268 sc->temp_ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempfile_ilock_both()
274 struct xfs_scrub *sc) in xrep_tempfile_iunlock_both() argument
276 xrep_tempfile_iunlock(sc); in xrep_tempfile_iunlock_both()
277 xchk_iunlock(sc, XFS_ILOCK_EXCL); in xrep_tempfile_iunlock_both()
283 struct xfs_scrub *sc) in xrep_tempfile_rele() argument
285 if (!sc->tempip) in xrep_tempfile_rele()
288 if (sc->temp_ilock_flags) { in xrep_tempfile_rele()
289 xfs_iunlock(sc->tempip, sc->temp_ilock_flags); in xrep_tempfile_rele()
290 sc->temp_ilock_flags = 0; in xrep_tempfile_rele()
293 xchk_irele(sc, sc->tempip); in xrep_tempfile_rele()
294 sc->tempip = NULL; in xrep_tempfile_rele()
304 struct xfs_scrub *sc, in xrep_tempfile_prealloc() argument
312 ASSERT(sc->tempip != NULL); in xrep_tempfile_prealloc()
313 ASSERT(!XFS_NOT_DQATTACHED(sc->mp, sc->tempip)); in xrep_tempfile_prealloc()
322 error = xfs_bmapi_read(sc->tempip, off, end - off, &map, &nmaps, in xrep_tempfile_prealloc()
346 error = xfs_bmapi_write(sc->tp, sc->tempip, off, end - off, in xrep_tempfile_prealloc()
354 trace_xrep_tempfile_prealloc(sc, XFS_DATA_FORK, &map); in xrep_tempfile_prealloc()
357 error = xfs_defer_finish(&sc->tp); in xrep_tempfile_prealloc()
371 struct xfs_scrub *sc, in xrep_tempfile_copyin() argument
378 struct xfs_mount *mp = sc->mp; in xrep_tempfile_copyin()
385 ASSERT(S_ISREG(VFS_I(sc->tempip)->i_mode)); in xrep_tempfile_copyin()
395 error = xfs_bmapi_read(sc->tempip, off, 1, &map, &nmaps, 0); in xrep_tempfile_copyin()
404 error = xfs_trans_get_buf(sc->tp, mp->m_ddev_targp, in xrep_tempfile_copyin()
410 trace_xrep_tempfile_copyin(sc, XFS_DATA_FORK, &map); in xrep_tempfile_copyin()
413 error = prep_fn(sc, bp, data); in xrep_tempfile_copyin()
415 xfs_trans_brelse(sc->tp, bp); in xrep_tempfile_copyin()
421 xfs_trans_brelse(sc->tp, bp); in xrep_tempfile_copyin()
458 struct xfs_scrub *sc, in xrep_tempfile_set_isize() argument
461 if (sc->tempip->i_disk_size == isize) in xrep_tempfile_set_isize()
464 sc->tempip->i_disk_size = isize; in xrep_tempfile_set_isize()
465 i_size_write(VFS_I(sc->tempip), isize); in xrep_tempfile_set_isize()
466 return xrep_tempfile_roll_trans(sc); in xrep_tempfile_set_isize()
477 struct xfs_scrub *sc) in xrep_tempfile_roll_trans() argument
481 xfs_trans_log_inode(sc->tp, sc->tempip, XFS_ILOG_CORE); in xrep_tempfile_roll_trans()
482 error = xrep_roll_trans(sc); in xrep_tempfile_roll_trans()
486 xfs_trans_ijoin(sc->tp, sc->tempip, 0); in xrep_tempfile_roll_trans()
497 struct xfs_scrub *sc, in xrep_tempexch_prep_request() argument
512 if (!xfs_ifork_ptr(sc->ip, whichfork) || in xrep_tempexch_prep_request()
513 !xfs_ifork_ptr(sc->tempip, whichfork)) { in xrep_tempexch_prep_request()
514 ASSERT(xfs_ifork_ptr(sc->ip, whichfork) != NULL); in xrep_tempexch_prep_request()
515 ASSERT(xfs_ifork_ptr(sc->tempip, whichfork) != NULL); in xrep_tempexch_prep_request()
520 req->ip1 = sc->tempip; in xrep_tempexch_prep_request()
521 req->ip2 = sc->ip; in xrep_tempexch_prep_request()
545 struct xfs_scrub *sc, in xrep_tempexch_estimate() argument
559 ifp = xfs_ifork_ptr(sc->ip, whichfork); in xrep_tempexch_estimate()
563 tifp = xfs_ifork_ptr(sc->tempip, whichfork); in xrep_tempexch_estimate()
581 req->ip1_bcount = sc->tempip->i_nblocks; in xrep_tempexch_estimate()
597 req->ip2_bcount = sc->ip->i_nblocks; in xrep_tempexch_estimate()
629 struct xfs_scrub *sc, in xrep_tempexch_reserve_quota() argument
632 struct xfs_trans *tp = sc->tp; in xrep_tempexch_reserve_quota()
686 struct xfs_scrub *sc, in xrep_tempexch_trans_reserve() argument
692 ASSERT(sc->tp != NULL); in xrep_tempexch_trans_reserve()
693 xfs_assert_ilocked(sc->ip, XFS_ILOCK_EXCL); in xrep_tempexch_trans_reserve()
694 xfs_assert_ilocked(sc->tempip, XFS_ILOCK_EXCL); in xrep_tempexch_trans_reserve()
696 error = xrep_tempexch_prep_request(sc, whichfork, tx); in xrep_tempexch_trans_reserve()
704 error = xfs_trans_reserve_more(sc->tp, tx->req.resblks, 0); in xrep_tempexch_trans_reserve()
708 return xrep_tempexch_reserve_quota(sc, tx); in xrep_tempexch_trans_reserve()
724 struct xfs_scrub *sc, in xrep_tempexch_trans_alloc() argument
731 ASSERT(sc->tp == NULL); in xrep_tempexch_trans_alloc()
732 ASSERT(xfs_has_exchange_range(sc->mp)); in xrep_tempexch_trans_alloc()
734 error = xrep_tempexch_prep_request(sc, whichfork, tx); in xrep_tempexch_trans_alloc()
738 error = xrep_tempexch_estimate(sc, tx); in xrep_tempexch_trans_alloc()
742 if (xfs_has_lazysbcount(sc->mp)) in xrep_tempexch_trans_alloc()
745 error = xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xrep_tempexch_trans_alloc()
746 tx->req.resblks, 0, flags, &sc->tp); in xrep_tempexch_trans_alloc()
750 sc->temp_ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempexch_trans_alloc()
751 sc->ilock_flags |= XFS_ILOCK_EXCL; in xrep_tempexch_trans_alloc()
752 xfs_exchrange_ilock(sc->tp, sc->ip, sc->tempip); in xrep_tempexch_trans_alloc()
754 return xrep_tempexch_reserve_quota(sc, tx); in xrep_tempexch_trans_alloc()
764 struct xfs_scrub *sc, in xrep_tempexch_contents() argument
769 ASSERT(xfs_has_exchange_range(sc->mp)); in xrep_tempexch_contents()
771 xfs_exchange_mappings(sc->tp, &tx->req); in xrep_tempexch_contents()
772 error = xfs_defer_finish(&sc->tp); in xrep_tempexch_contents()
783 temp = i_size_read(VFS_I(sc->ip)); in xrep_tempexch_contents()
784 i_size_write(VFS_I(sc->ip), i_size_read(VFS_I(sc->tempip))); in xrep_tempexch_contents()
785 i_size_write(VFS_I(sc->tempip), temp); in xrep_tempexch_contents()
799 struct xfs_scrub *sc, in xrep_tempfile_copyout_local() argument
806 temp_ifp = xfs_ifork_ptr(sc->tempip, whichfork); in xrep_tempfile_copyout_local()
807 ifp = xfs_ifork_ptr(sc->ip, whichfork); in xrep_tempfile_copyout_local()
816 ASSERT(sc->tempip->i_disk_size <= in xrep_tempfile_copyout_local()
817 xfs_inode_data_fork_size(sc->ip)); in xrep_tempfile_copyout_local()
820 ASSERT(sc->tempip->i_forkoff >= sc->ip->i_forkoff); in xrep_tempfile_copyout_local()
827 /* Recreate @sc->ip's incore fork (ifp) with data from temp_ifp. */ in xrep_tempfile_copyout_local()
829 xfs_init_local_fork(sc->ip, whichfork, temp_ifp->if_data, in xrep_tempfile_copyout_local()
833 i_size_write(VFS_I(sc->ip), i_size_read(VFS_I(sc->tempip))); in xrep_tempfile_copyout_local()
834 sc->ip->i_disk_size = sc->tempip->i_disk_size; in xrep_tempfile_copyout_local()
838 xfs_trans_log_inode(sc->tp, sc->ip, ilog_flags); in xrep_tempfile_copyout_local()