Lines Matching refs:upd
155 * directory tree operation. The caller retains its reference to @upd->ip
160 struct xfs_metadir_update *upd,
163 trace_xfs_metadir_teardown(upd, error);
165 if (upd->ppargs) {
166 xfs_parent_finish(upd->dp->i_mount, upd->ppargs);
167 upd->ppargs = NULL;
170 if (upd->ip) {
171 if (upd->ip_locked)
172 xfs_iunlock(upd->ip, XFS_ILOCK_EXCL);
173 upd->ip_locked = false;
176 if (upd->dp_locked)
177 xfs_iunlock(upd->dp, XFS_ILOCK_EXCL);
178 upd->dp_locked = false;
187 struct xfs_metadir_update *upd)
189 struct xfs_mount *mp = upd->dp->i_mount;
192 ASSERT(upd->dp != NULL);
193 ASSERT(upd->ip == NULL);
195 ASSERT(upd->metafile_type != XFS_METAFILE_UNKNOWN);
197 error = xfs_parent_start(mp, &upd->ppargs);
209 xfs_create_space_res(mp, MAXNAMELEN), 0, 0, &upd->tp);
217 xfs_ilock(upd->dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
218 upd->dp_locked = true;
220 trace_xfs_metadir_start_create(upd);
223 xfs_metadir_teardown(upd, error);
229 * metadata directory tree at the given @upd->path. The path up to the final
232 * The new metadata inode will be attached to the update structure @upd->ip,
241 struct xfs_metadir_update *upd,
245 .pip = upd->dp,
250 .dp = upd->dp,
252 .ppargs = upd->ppargs,
254 struct xfs_mount *mp = upd->dp->i_mount;
259 xfs_assert_ilocked(upd->dp, XFS_ILOCK_EXCL);
262 xfs_metadir_set_xname(&xname, upd->path, XFS_DIR3_FT_UNKNOWN);
263 error = xfs_metadir_lookup(upd->tp, upd->dp, &xname, &ino);
279 error = xfs_dialloc(&upd->tp, &args, &ino);
282 error = xfs_icreate(upd->tp, ino, &args, &upd->ip);
285 du.ip = upd->ip;
286 xfs_metafile_set_iflag(upd->tp, upd->ip, upd->metafile_type);
287 upd->ip_locked = true;
293 xfs_trans_ijoin(upd->tp, upd->dp, 0);
302 trace_xfs_metadir_try_create(upd);
304 error = xfs_dir_create_child(upd->tp, resblks, &du);
310 trace_xfs_metadir_create(upd);
322 struct xfs_metadir_update *upd)
324 struct xfs_mount *mp = upd->dp->i_mount;
329 ASSERT(upd->dp != NULL);
330 ASSERT(upd->ip != NULL);
333 error = xfs_parent_start(mp, &upd->ppargs);
338 error = xfs_trans_alloc_dir(upd->dp, &M_RES(mp)->tr_link, upd->ip,
339 &resblks, &upd->tp, &nospace_error);
344 xfs_trans_cancel(upd->tp);
345 upd->tp = NULL;
346 xfs_iunlock(upd->dp, XFS_ILOCK_EXCL);
347 xfs_iunlock(upd->ip, XFS_ILOCK_EXCL);
352 upd->dp_locked = true;
353 upd->ip_locked = true;
355 trace_xfs_metadir_start_link(upd);
358 xfs_metadir_teardown(upd, error);
363 * Link the metadata directory given by @path to the inode @upd->ip.
369 struct xfs_metadir_update *upd)
373 .dp = upd->dp,
375 .ip = upd->ip,
376 .ppargs = upd->ppargs,
378 struct xfs_mount *mp = upd->dp->i_mount;
383 xfs_assert_ilocked(upd->dp, XFS_ILOCK_EXCL);
384 xfs_assert_ilocked(upd->ip, XFS_ILOCK_EXCL);
387 xfs_metadir_set_xname(&xname, upd->path,
388 xfs_mode_to_ftype(VFS_I(upd->ip)->i_mode));
389 error = xfs_metadir_lookup(upd->tp, upd->dp, &xname, &ino);
401 error = xfs_dir_add_child(upd->tp, resblks, &du);
405 trace_xfs_metadir_link(upd);
414 struct xfs_metadir_update *upd)
418 trace_xfs_metadir_commit(upd);
420 error = xfs_trans_commit(upd->tp);
421 upd->tp = NULL;
423 xfs_metadir_teardown(upd, error);
430 struct xfs_metadir_update *upd,
433 trace_xfs_metadir_cancel(upd);
435 xfs_trans_cancel(upd->tp);
436 upd->tp = NULL;
438 xfs_metadir_teardown(upd, error);
448 struct xfs_metadir_update upd = {
459 error = xfs_metadir_start_create(&upd);
464 error = xfs_metadir_create(&upd, S_IFDIR);
468 error = xfs_metadir_commit(&upd);
472 xfs_finish_inode_setup(upd.ip);
473 *ipp = upd.ip;
477 xfs_metadir_cancel(&upd, error);
480 if (upd.ip) {
481 xfs_finish_inode_setup(upd.ip);
482 xfs_irele(upd.ip);