Lines Matching refs:sc

55 	struct xfs_scrub	*sc,  in xrep_setup_symlink()  argument
58 struct xfs_mount *mp = sc->mp; in xrep_setup_symlink()
62 error = xrep_tempfile_create(sc, S_IFLNK); in xrep_setup_symlink()
79 blocks = xfs_symlink_blocks(sc->mp, XFS_SYMLINK_MAXLEN); in xrep_setup_symlink()
94 struct xfs_scrub *sc) in xrep_symlink_salvage_remote() argument
97 struct xfs_inode *ip = sc->ip; in xrep_symlink_salvage_remote()
99 char *target_buf = sc->buf; in xrep_symlink_salvage_remote()
114 fsblocks = xfs_symlink_blocks(sc->mp, len); in xrep_symlink_salvage_remote()
122 d = XFS_FSB_TO_DADDR(sc->mp, mval[n].br_startblock); in xrep_symlink_salvage_remote()
125 error = xfs_trans_read_buf(sc->mp, sc->tp, sc->mp->m_ddev_targp, in xrep_symlink_salvage_remote()
126 d, XFS_FSB_TO_BB(sc->mp, mval[n].br_blockcount), in xrep_symlink_salvage_remote()
133 byte_cnt = XFS_FSB_TO_B(sc->mp, mval[n].br_blockcount); in xrep_symlink_salvage_remote()
134 byte_cnt = XFS_SYMLINK_BUF_SPACE(sc->mp, byte_cnt); in xrep_symlink_salvage_remote()
164 struct xfs_scrub *sc) in xrep_symlink_salvage_inline() argument
166 struct xfs_inode *ip = sc->ip; in xrep_symlink_salvage_inline()
167 char *target_buf = sc->buf; in xrep_symlink_salvage_inline()
182 if (xfs_inode_has_sickness(sc->ip, XFS_SICK_INO_SYMLINK_ZAPPED) && in xrep_symlink_salvage_inline()
183 sc->ip->i_disk_size == 1 && old_target[0] == '?') in xrep_symlink_salvage_inline()
202 struct xfs_scrub *sc) in xrep_symlink_salvage() argument
204 char *target_buf = sc->buf; in xrep_symlink_salvage()
213 if (!(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { in xrep_symlink_salvage()
214 if (sc->ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) in xrep_symlink_salvage()
215 buflen = xrep_symlink_salvage_inline(sc); in xrep_symlink_salvage()
217 buflen = xrep_symlink_salvage_remote(sc); in xrep_symlink_salvage()
227 if (strlen(target_buf) != sc->ip->i_disk_size) in xrep_symlink_salvage()
236 sc->sick_mask |= XFS_SICK_INO_SYMLINK_ZAPPED; in xrep_symlink_salvage()
240 trace_xrep_symlink_salvage_target(sc->ip, target_buf, in xrep_symlink_salvage()
253 struct xfs_scrub *sc = priv; in xrep_symlink_local_to_remote() local
258 if (!xfs_has_crc(sc->mp)) in xrep_symlink_local_to_remote()
261 dsl->sl_owner = cpu_to_be64(sc->ip->i_ino); in xrep_symlink_local_to_remote()
273 struct xfs_scrub *sc, in xrep_symlink_swap_prep() argument
286 error = xfs_bmap_local_to_extents(sc->tp, sc->tempip, 1, in xrep_symlink_swap_prep()
289 sc); in xrep_symlink_swap_prep()
293 xfs_trans_log_inode(sc->tp, sc->ip, 0); in xrep_symlink_swap_prep()
295 error = xfs_defer_finish(&sc->tp); in xrep_symlink_swap_prep()
308 ifp = xfs_ifork_ptr(sc->ip, XFS_DATA_FORK); in xrep_symlink_swap_prep()
316 xfs_trans_log_inode(sc->tp, sc->ip, in xrep_symlink_swap_prep()
326 struct xfs_scrub *sc) in xrep_symlink_swap() argument
328 struct xrep_tempexch *tx = sc->buf; in xrep_symlink_swap()
332 ip_local = sc->ip->i_df.if_format == XFS_DINODE_FMT_LOCAL; in xrep_symlink_swap()
333 temp_local = sc->tempip->i_df.if_format == XFS_DINODE_FMT_LOCAL; in xrep_symlink_swap()
341 sc->tempip->i_disk_size <= xfs_inode_data_fork_size(sc->ip)) { in xrep_symlink_swap()
342 xrep_tempfile_copyout_local(sc, XFS_DATA_FORK); in xrep_symlink_swap()
347 error = xrep_symlink_swap_prep(sc, temp_local, ip_local); in xrep_symlink_swap()
351 return xrep_tempexch_contents(sc, tx); in xrep_symlink_swap()
361 struct xfs_scrub *sc) in xrep_symlink_reset_fork() argument
363 struct xfs_ifork *ifp = xfs_ifork_ptr(sc->tempip, XFS_DATA_FORK); in xrep_symlink_reset_fork()
368 error = xrep_reap_ifork(sc, sc->tempip, XFS_DATA_FORK); in xrep_symlink_reset_fork()
373 trace_xrep_symlink_reset_fork(sc->tempip); in xrep_symlink_reset_fork()
377 return xfs_symlink_write_target(sc->tp, sc->tempip, sc->tempip->i_ino, in xrep_symlink_reset_fork()
387 struct xfs_scrub *sc) in xrep_symlink_rebuild() argument
390 char *target_buf = sc->buf; in xrep_symlink_rebuild()
402 trace_xrep_symlink_rebuild(sc->ip); in xrep_symlink_rebuild()
414 xchk_iunlock(sc, XFS_ILOCK_EXCL); in xrep_symlink_rebuild()
415 xrep_tempfile_ilock(sc); in xrep_symlink_rebuild()
416 xfs_trans_ijoin(sc->tp, sc->tempip, 0); in xrep_symlink_rebuild()
423 fs_blocks = xfs_symlink_blocks(sc->mp, target_len); in xrep_symlink_rebuild()
424 resblks = xfs_symlink_space_res(sc->mp, target_len, fs_blocks); in xrep_symlink_rebuild()
425 error = xfs_trans_reserve_quota_nblks(sc->tp, sc->tempip, resblks, 0, in xrep_symlink_rebuild()
431 xfs_idestroy_fork(&sc->tempip->i_df); in xrep_symlink_rebuild()
432 sc->tempip->i_df.if_bytes = 0; in xrep_symlink_rebuild()
433 sc->tempip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; in xrep_symlink_rebuild()
436 error = xfs_symlink_write_target(sc->tp, sc->tempip, sc->ip->i_ino, in xrep_symlink_rebuild()
447 error = xrep_trans_commit(sc); in xrep_symlink_rebuild()
452 if (xchk_should_terminate(sc, &error)) in xrep_symlink_rebuild()
455 xrep_tempfile_iunlock(sc); in xrep_symlink_rebuild()
461 tx = sc->buf; in xrep_symlink_rebuild()
462 error = xrep_tempexch_trans_alloc(sc, XFS_DATA_FORK, tx); in xrep_symlink_rebuild()
471 error = xrep_symlink_swap(sc); in xrep_symlink_rebuild()
480 return xrep_symlink_reset_fork(sc); in xrep_symlink_rebuild()
486 struct xfs_scrub *sc) in xrep_symlink() argument
491 if (!xfs_has_rmapbt(sc->mp)) in xrep_symlink()
494 if (!xfs_has_exchange_range(sc->mp)) in xrep_symlink()
497 ASSERT(sc->ilock_flags & XFS_ILOCK_EXCL); in xrep_symlink()
499 error = xrep_symlink_salvage(sc); in xrep_symlink()
504 error = xrep_symlink_rebuild(sc); in xrep_symlink()
508 return xrep_trans_commit(sc); in xrep_symlink()