Lines Matching +full:tp +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * Copyright (c) 2012-2013 Red Hat, Inc.
34 char *link) in xfs_readlink() argument
36 struct xfs_mount *mp = ip->i_mount; in xfs_readlink()
43 return -EIO; in xfs_readlink()
45 return -EIO; in xfs_readlink()
49 pathlen = ip->i_disk_size; in xfs_readlink()
55 __func__, (unsigned long long) ip->i_ino, in xfs_readlink()
61 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { in xfs_readlink()
63 * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED in xfs_readlink()
66 if (XFS_IS_CORRUPT(ip->i_mount, !ip->i_df.if_data)) in xfs_readlink()
69 memcpy(link, ip->i_df.if_data, pathlen + 1); in xfs_readlink()
72 error = xfs_symlink_remote_read(ip, link); in xfs_readlink()
80 return -EFSCORRUPTED; in xfs_readlink()
92 struct xfs_mount *mp = dp->i_mount; in xfs_symlink()
102 struct xfs_trans *tp = NULL; in xfs_symlink() local
118 return -EIO; in xfs_symlink()
125 return -ENAMETOOLONG; in xfs_symlink()
143 resblks = xfs_symlink_space_res(mp, link_name->len, fs_blocks); in xfs_symlink()
149 error = xfs_trans_alloc_icreate(mp, &M_RES(mp)->tr_symlink, udqp, gdqp, in xfs_symlink()
150 pdqp, resblks, &tp); in xfs_symlink()
160 if (dp->i_diflags & XFS_DIFLAG_NOSYMLINKS) { in xfs_symlink()
161 error = -EPERM; in xfs_symlink()
168 error = xfs_dialloc(&tp, &args, &ino); in xfs_symlink()
170 error = xfs_icreate(tp, ino, &args, &du.ip); in xfs_symlink()
181 xfs_trans_ijoin(tp, dp, 0); in xfs_symlink()
186 xfs_qm_vop_create_dqattach(tp, du.ip, udqp, gdqp, pdqp); in xfs_symlink()
188 resblks -= XFS_IALLOC_SPACE_RES(mp); in xfs_symlink()
189 error = xfs_symlink_write_target(tp, du.ip, du.ip->i_ino, target_path, in xfs_symlink()
193 resblks -= fs_blocks; in xfs_symlink()
194 i_size_write(VFS_I(du.ip), du.ip->i_disk_size); in xfs_symlink()
199 error = xfs_dir_create_child(tp, resblks, &du); in xfs_symlink()
209 xfs_trans_set_sync(tp); in xfs_symlink()
211 error = xfs_trans_commit(tp); in xfs_symlink()
226 xfs_trans_cancel(tp); in xfs_symlink()
257 * but allows us to catch corrupt zero-length symlinks in the verifiers.
263 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_symlink_rmt()
264 struct xfs_trans *tp; in xfs_inactive_symlink_rmt() local
267 ASSERT(!xfs_need_iread_extents(&ip->i_df)); in xfs_inactive_symlink_rmt()
275 ASSERT(ip->i_df.if_nextents > 0 && ip->i_df.if_nextents <= 2); in xfs_inactive_symlink_rmt()
277 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); in xfs_inactive_symlink_rmt()
282 xfs_trans_ijoin(tp, ip, 0); in xfs_inactive_symlink_rmt()
290 ip->i_disk_size = 0; in xfs_inactive_symlink_rmt()
291 VFS_I(ip)->i_mode = (VFS_I(ip)->i_mode & ~S_IFMT) | S_IFREG; in xfs_inactive_symlink_rmt()
292 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_inactive_symlink_rmt()
294 error = xfs_symlink_remote_truncate(tp, ip); in xfs_inactive_symlink_rmt()
298 error = xfs_trans_commit(tp); in xfs_inactive_symlink_rmt()
307 if (ip->i_df.if_bytes) in xfs_inactive_symlink_rmt()
308 xfs_idata_realloc(ip, -ip->i_df.if_bytes, XFS_DATA_FORK); in xfs_inactive_symlink_rmt()
309 ASSERT(ip->i_df.if_bytes == 0); in xfs_inactive_symlink_rmt()
315 xfs_trans_cancel(tp); in xfs_inactive_symlink_rmt()
322 * xfs_inactive_symlink - free a symlink
328 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_symlink()
334 return -EIO; in xfs_inactive_symlink()
337 pathlen = (int)ip->i_disk_size; in xfs_inactive_symlink()
342 __func__, (unsigned long long)ip->i_ino, pathlen); in xfs_inactive_symlink()
346 return -EFSCORRUPTED; in xfs_inactive_symlink()
353 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { in xfs_inactive_symlink()