Lines Matching refs:args
41 STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args);
46 STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);
47 STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args);
48 STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);
49 STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp);
54 STATIC int xfs_attr_node_get(xfs_da_args_t *args);
55 STATIC int xfs_attr_node_addname(xfs_da_args_t *args);
56 STATIC int xfs_attr_node_removename(xfs_da_args_t *args);
57 STATIC int xfs_attr_node_hasname(xfs_da_args_t *args,
83 struct xfs_da_args *args) in xfs_attr_get_ilocked() argument
85 ASSERT(xfs_isilocked(args->dp, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL)); in xfs_attr_get_ilocked()
87 if (!xfs_inode_hasattr(args->dp)) in xfs_attr_get_ilocked()
90 if (args->dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) in xfs_attr_get_ilocked()
91 return xfs_attr_shortform_getvalue(args); in xfs_attr_get_ilocked()
92 if (xfs_bmap_one_block(args->dp, XFS_ATTR_FORK)) in xfs_attr_get_ilocked()
93 return xfs_attr_leaf_get(args); in xfs_attr_get_ilocked()
94 return xfs_attr_node_get(args); in xfs_attr_get_ilocked()
115 struct xfs_da_args *args) in xfs_attr_get() argument
120 XFS_STATS_INC(args->dp->i_mount, xs_attr_get); in xfs_attr_get()
122 if (XFS_FORCED_SHUTDOWN(args->dp->i_mount)) in xfs_attr_get()
125 args->geo = args->dp->i_mount->m_attr_geo; in xfs_attr_get()
126 args->whichfork = XFS_ATTR_FORK; in xfs_attr_get()
127 args->hashval = xfs_da_hashname(args->name, args->namelen); in xfs_attr_get()
130 args->op_flags = XFS_DA_OP_OKNOENT; in xfs_attr_get()
132 lock_mode = xfs_ilock_attr_map_shared(args->dp); in xfs_attr_get()
133 error = xfs_attr_get_ilocked(args); in xfs_attr_get()
134 xfs_iunlock(args->dp, lock_mode); in xfs_attr_get()
144 struct xfs_da_args *args, in xfs_attr_calc_size() argument
147 struct xfs_mount *mp = args->dp->i_mount; in xfs_attr_calc_size()
155 size = xfs_attr_leaf_newentsize(args, local); in xfs_attr_calc_size()
158 if (size > (args->geo->blksize / 2)) { in xfs_attr_calc_size()
167 uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen); in xfs_attr_calc_size()
178 struct xfs_da_args *args) in xfs_attr_try_sf_addname() argument
187 xfs_attr_shortform_create(args); in xfs_attr_try_sf_addname()
189 error = xfs_attr_shortform_addname(args); in xfs_attr_try_sf_addname()
197 if (!error && !(args->op_flags & XFS_DA_OP_NOTIME)) in xfs_attr_try_sf_addname()
198 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); in xfs_attr_try_sf_addname()
201 xfs_trans_set_sync(args->trans); in xfs_attr_try_sf_addname()
226 struct xfs_da_args *args, in xfs_attr_set_shortform() argument
229 struct xfs_inode *dp = args->dp; in xfs_attr_set_shortform()
235 error = xfs_attr_try_sf_addname(dp, args); in xfs_attr_set_shortform()
237 error2 = xfs_trans_commit(args->trans); in xfs_attr_set_shortform()
238 args->trans = NULL; in xfs_attr_set_shortform()
245 error = xfs_attr_shortform_to_leaf(args, leaf_bp); in xfs_attr_set_shortform()
255 xfs_trans_bhold(args->trans, *leaf_bp); in xfs_attr_set_shortform()
256 error = xfs_defer_finish(&args->trans); in xfs_attr_set_shortform()
257 xfs_trans_bhold_release(args->trans, *leaf_bp); in xfs_attr_set_shortform()
259 xfs_trans_brelse(args->trans, *leaf_bp); in xfs_attr_set_shortform()
271 struct xfs_da_args *args) in xfs_attr_set_args() argument
273 struct xfs_inode *dp = args->dp; in xfs_attr_set_args()
291 error = xfs_attr_set_shortform(args, &leaf_bp); in xfs_attr_set_args()
292 if (error || !args->trans) in xfs_attr_set_args()
297 error = xfs_attr_leaf_addname(args); in xfs_attr_set_args()
304 error = xfs_attr3_leaf_to_node(args); in xfs_attr_set_args()
314 error = xfs_defer_finish(&args->trans); in xfs_attr_set_args()
322 error = xfs_trans_roll_inode(&args->trans, dp); in xfs_attr_set_args()
327 error = xfs_attr_node_addname(args); in xfs_attr_set_args()
336 struct xfs_da_args *args) in xfs_has_attr() argument
338 struct xfs_inode *dp = args->dp; in xfs_has_attr()
347 return xfs_attr_sf_findname(args, NULL, NULL); in xfs_has_attr()
351 error = xfs_attr_leaf_hasname(args, &bp); in xfs_has_attr()
354 xfs_trans_brelse(args->trans, bp); in xfs_has_attr()
359 return xfs_attr_node_hasname(args, NULL); in xfs_has_attr()
367 struct xfs_da_args *args) in xfs_attr_remove_args() argument
369 struct xfs_inode *dp = args->dp; in xfs_attr_remove_args()
376 error = xfs_attr_shortform_remove(args); in xfs_attr_remove_args()
378 error = xfs_attr_leaf_removename(args); in xfs_attr_remove_args()
380 error = xfs_attr_node_removename(args); in xfs_attr_remove_args()
392 struct xfs_da_args *args) in xfs_attr_set() argument
394 struct xfs_inode *dp = args->dp; in xfs_attr_set()
397 bool rsvd = (args->attr_filter & XFS_ATTR_ROOT); in xfs_attr_set()
408 args->geo = mp->m_attr_geo; in xfs_attr_set()
409 args->whichfork = XFS_ATTR_FORK; in xfs_attr_set()
410 args->hashval = xfs_da_hashname(args->name, args->namelen); in xfs_attr_set()
417 args->op_flags = XFS_DA_OP_OKNOENT; in xfs_attr_set()
419 if (args->value) { in xfs_attr_set()
422 args->op_flags |= XFS_DA_OP_ADDNAME; in xfs_attr_set()
423 args->total = xfs_attr_calc_size(args, &local); in xfs_attr_set()
431 xfs_attr_sf_entsize_byname(args->namelen, in xfs_attr_set()
432 args->valuelen); in xfs_attr_set()
441 args->total; in xfs_attr_set()
444 total = args->total; in xfs_attr_set()
457 rsvd ? XFS_TRANS_RESERVE : 0, &args->trans); in xfs_attr_set()
462 xfs_trans_ijoin(args->trans, dp, 0); in xfs_attr_set()
463 if (args->value) { in xfs_attr_set()
468 error = xfs_trans_reserve_quota_nblks(args->trans, dp, in xfs_attr_set()
469 args->total, 0, quota_flags); in xfs_attr_set()
473 error = xfs_has_attr(args); in xfs_attr_set()
474 if (error == -EEXIST && (args->attr_flags & XATTR_CREATE)) in xfs_attr_set()
476 if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) in xfs_attr_set()
481 error = xfs_attr_set_args(args); in xfs_attr_set()
485 if (!args->trans) in xfs_attr_set()
488 error = xfs_has_attr(args); in xfs_attr_set()
492 error = xfs_attr_remove_args(args); in xfs_attr_set()
502 xfs_trans_set_sync(args->trans); in xfs_attr_set()
504 if (!(args->op_flags & XFS_DA_OP_NOTIME)) in xfs_attr_set()
505 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); in xfs_attr_set()
510 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE); in xfs_attr_set()
511 error = xfs_trans_commit(args->trans); in xfs_attr_set()
517 if (args->trans) in xfs_attr_set()
518 xfs_trans_cancel(args->trans); in xfs_attr_set()
539 xfs_attr_shortform_addname(xfs_da_args_t *args) in xfs_attr_shortform_addname() argument
543 trace_xfs_attr_sf_addname(args); in xfs_attr_shortform_addname()
545 retval = xfs_attr_shortform_lookup(args); in xfs_attr_shortform_addname()
546 if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) in xfs_attr_shortform_addname()
549 if (args->attr_flags & XATTR_CREATE) in xfs_attr_shortform_addname()
551 retval = xfs_attr_shortform_remove(args); in xfs_attr_shortform_addname()
559 args->attr_flags &= ~XATTR_REPLACE; in xfs_attr_shortform_addname()
562 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX || in xfs_attr_shortform_addname()
563 args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX) in xfs_attr_shortform_addname()
566 newsize = xfs_attr_sf_totsize(args->dp); in xfs_attr_shortform_addname()
567 newsize += xfs_attr_sf_entsize_byname(args->namelen, args->valuelen); in xfs_attr_shortform_addname()
569 forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize); in xfs_attr_shortform_addname()
573 xfs_attr_shortform_add(args, forkoff); in xfs_attr_shortform_addname()
585 struct xfs_da_args *args) in xfs_attr_save_rmt_blk() argument
587 args->blkno2 = args->blkno; in xfs_attr_save_rmt_blk()
588 args->index2 = args->index; in xfs_attr_save_rmt_blk()
589 args->rmtblkno2 = args->rmtblkno; in xfs_attr_save_rmt_blk()
590 args->rmtblkcnt2 = args->rmtblkcnt; in xfs_attr_save_rmt_blk()
591 args->rmtvaluelen2 = args->rmtvaluelen; in xfs_attr_save_rmt_blk()
597 struct xfs_da_args *args) in xfs_attr_restore_rmt_blk() argument
599 args->blkno = args->blkno2; in xfs_attr_restore_rmt_blk()
600 args->index = args->index2; in xfs_attr_restore_rmt_blk()
601 args->rmtblkno = args->rmtblkno2; in xfs_attr_restore_rmt_blk()
602 args->rmtblkcnt = args->rmtblkcnt2; in xfs_attr_restore_rmt_blk()
603 args->rmtvaluelen = args->rmtvaluelen2; in xfs_attr_restore_rmt_blk()
618 struct xfs_da_args *args, in xfs_attr_leaf_try_add() argument
627 retval = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_leaf_try_add()
630 if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) in xfs_attr_leaf_try_add()
633 if (args->attr_flags & XATTR_CREATE) in xfs_attr_leaf_try_add()
636 trace_xfs_attr_leaf_replace(args); in xfs_attr_leaf_try_add()
639 args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ in xfs_attr_leaf_try_add()
640 xfs_attr_save_rmt_blk(args); in xfs_attr_leaf_try_add()
647 args->rmtblkno = 0; in xfs_attr_leaf_try_add()
648 args->rmtblkcnt = 0; in xfs_attr_leaf_try_add()
649 args->rmtvaluelen = 0; in xfs_attr_leaf_try_add()
655 return xfs_attr3_leaf_add(bp, args); in xfs_attr_leaf_try_add()
658 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_try_add()
671 struct xfs_da_args *args) in xfs_attr_leaf_addname() argument
675 struct xfs_inode *dp = args->dp; in xfs_attr_leaf_addname()
677 trace_xfs_attr_leaf_addname(args); in xfs_attr_leaf_addname()
679 error = xfs_attr_leaf_try_add(args, bp); in xfs_attr_leaf_addname()
687 error = xfs_trans_roll_inode(&args->trans, dp); in xfs_attr_leaf_addname()
697 if (args->rmtblkno > 0) { in xfs_attr_leaf_addname()
698 error = xfs_attr_rmtval_set(args); in xfs_attr_leaf_addname()
703 if (!(args->op_flags & XFS_DA_OP_RENAME)) { in xfs_attr_leaf_addname()
707 if (args->rmtblkno > 0) in xfs_attr_leaf_addname()
708 error = xfs_attr3_leaf_clearflag(args); in xfs_attr_leaf_addname()
723 error = xfs_attr3_leaf_flipflags(args); in xfs_attr_leaf_addname()
729 error = xfs_trans_roll_inode(&args->trans, args->dp); in xfs_attr_leaf_addname()
737 xfs_attr_restore_rmt_blk(args); in xfs_attr_leaf_addname()
739 if (args->rmtblkno) { in xfs_attr_leaf_addname()
740 error = xfs_attr_rmtval_invalidate(args); in xfs_attr_leaf_addname()
744 error = xfs_attr_rmtval_remove(args); in xfs_attr_leaf_addname()
753 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, in xfs_attr_leaf_addname()
758 xfs_attr3_leaf_remove(bp, args); in xfs_attr_leaf_addname()
765 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_leaf_addname()
776 struct xfs_da_args *args, in xfs_attr_leaf_hasname() argument
781 error = xfs_attr3_leaf_read(args->trans, args->dp, 0, bp); in xfs_attr_leaf_hasname()
785 error = xfs_attr3_leaf_lookup_int(*bp, args); in xfs_attr_leaf_hasname()
787 xfs_trans_brelse(args->trans, *bp); in xfs_attr_leaf_hasname()
800 struct xfs_da_args *args) in xfs_attr_leaf_removename() argument
806 trace_xfs_attr_leaf_removename(args); in xfs_attr_leaf_removename()
811 dp = args->dp; in xfs_attr_leaf_removename()
813 error = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_leaf_removename()
816 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_removename()
821 xfs_attr3_leaf_remove(bp, args); in xfs_attr_leaf_removename()
828 return xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_leaf_removename()
843 xfs_attr_leaf_get(xfs_da_args_t *args) in xfs_attr_leaf_get() argument
848 trace_xfs_attr_leaf_get(args); in xfs_attr_leaf_get()
850 error = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_leaf_get()
853 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_get()
859 error = xfs_attr3_leaf_getvalue(bp, args); in xfs_attr_leaf_get()
860 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_get()
871 struct xfs_da_args *args, in xfs_attr_node_hasname() argument
877 state = xfs_da_state_alloc(args); in xfs_attr_node_hasname()
910 struct xfs_da_args *args) in xfs_attr_node_addname() argument
917 trace_xfs_attr_node_addname(args); in xfs_attr_node_addname()
922 dp = args->dp; in xfs_attr_node_addname()
929 retval = xfs_attr_node_hasname(args, &state); in xfs_attr_node_addname()
935 if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) in xfs_attr_node_addname()
938 if (args->attr_flags & XATTR_CREATE) in xfs_attr_node_addname()
941 trace_xfs_attr_node_replace(args); in xfs_attr_node_addname()
944 args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ in xfs_attr_node_addname()
945 xfs_attr_save_rmt_blk(args); in xfs_attr_node_addname()
952 args->rmtblkno = 0; in xfs_attr_node_addname()
953 args->rmtblkcnt = 0; in xfs_attr_node_addname()
954 args->rmtvaluelen = 0; in xfs_attr_node_addname()
957 retval = xfs_attr3_leaf_add(blk->bp, state->args); in xfs_attr_node_addname()
967 error = xfs_attr3_leaf_to_node(args); in xfs_attr_node_addname()
970 error = xfs_defer_finish(&args->trans); in xfs_attr_node_addname()
978 error = xfs_trans_roll_inode(&args->trans, dp); in xfs_attr_node_addname()
994 error = xfs_defer_finish(&args->trans); in xfs_attr_node_addname()
1015 error = xfs_trans_roll_inode(&args->trans, dp); in xfs_attr_node_addname()
1025 if (args->rmtblkno > 0) { in xfs_attr_node_addname()
1026 error = xfs_attr_rmtval_set(args); in xfs_attr_node_addname()
1031 if (!(args->op_flags & XFS_DA_OP_RENAME)) { in xfs_attr_node_addname()
1035 if (args->rmtblkno > 0) in xfs_attr_node_addname()
1036 error = xfs_attr3_leaf_clearflag(args); in xfs_attr_node_addname()
1050 error = xfs_attr3_leaf_flipflags(args); in xfs_attr_node_addname()
1056 error = xfs_trans_roll_inode(&args->trans, args->dp); in xfs_attr_node_addname()
1064 xfs_attr_restore_rmt_blk(args); in xfs_attr_node_addname()
1066 if (args->rmtblkno) { in xfs_attr_node_addname()
1067 error = xfs_attr_rmtval_invalidate(args); in xfs_attr_node_addname()
1071 error = xfs_attr_rmtval_remove(args); in xfs_attr_node_addname()
1080 args->attr_filter |= XFS_ATTR_INCOMPLETE; in xfs_attr_node_addname()
1081 state = xfs_da_state_alloc(args); in xfs_attr_node_addname()
1092 error = xfs_attr3_leaf_remove(blk->bp, args); in xfs_attr_node_addname()
1118 struct xfs_da_args *args, in xfs_attr_node_shrink() argument
1121 struct xfs_inode *dp = args->dp; in xfs_attr_node_shrink()
1132 error = xfs_attr3_leaf_read(args->trans, args->dp, 0, &bp); in xfs_attr_node_shrink()
1138 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_node_shrink()
1141 xfs_trans_brelse(args->trans, bp); in xfs_attr_node_shrink()
1152 struct xfs_da_args *args, in xfs_attr_leaf_mark_incomplete() argument
1169 return xfs_attr3_leaf_setflag(args); in xfs_attr_leaf_mark_incomplete()
1179 struct xfs_da_args *args, in xfs_attr_node_removename_setup() argument
1184 error = xfs_attr_node_hasname(args, state); in xfs_attr_node_removename_setup()
1192 if (args->rmtblkno > 0) { in xfs_attr_node_removename_setup()
1193 error = xfs_attr_leaf_mark_incomplete(args, *state); in xfs_attr_node_removename_setup()
1197 return xfs_attr_rmtval_invalidate(args); in xfs_attr_node_removename_setup()
1205 struct xfs_da_args *args, in xfs_attr_node_remove_rmt() argument
1210 error = xfs_attr_rmtval_remove(args); in xfs_attr_node_remove_rmt()
1230 struct xfs_da_args *args) in xfs_attr_node_removename() argument
1235 struct xfs_inode *dp = args->dp; in xfs_attr_node_removename()
1237 trace_xfs_attr_node_removename(args); in xfs_attr_node_removename()
1239 error = xfs_attr_node_removename_setup(args, &state); in xfs_attr_node_removename()
1248 if (args->rmtblkno > 0) { in xfs_attr_node_removename()
1249 error = xfs_attr_node_remove_rmt(args, state); in xfs_attr_node_removename()
1259 retval = xfs_attr3_leaf_remove(blk->bp, args); in xfs_attr_node_removename()
1269 error = xfs_defer_finish(&args->trans); in xfs_attr_node_removename()
1275 error = xfs_trans_roll_inode(&args->trans, dp); in xfs_attr_node_removename()
1284 error = xfs_attr_node_shrink(args, state); in xfs_attr_node_removename()
1305 trace_xfs_attr_fillstate(state->args); in xfs_attr_fillstate()
1353 trace_xfs_attr_refillstate(state->args); in xfs_attr_refillstate()
1363 error = xfs_da3_node_read_mapped(state->args->trans, in xfs_attr_refillstate()
1364 state->args->dp, blk->disk_blkno, in xfs_attr_refillstate()
1381 error = xfs_da3_node_read_mapped(state->args->trans, in xfs_attr_refillstate()
1382 state->args->dp, blk->disk_blkno, in xfs_attr_refillstate()
1405 struct xfs_da_args *args) in xfs_attr_node_get() argument
1412 trace_xfs_attr_node_get(args); in xfs_attr_node_get()
1417 error = xfs_attr_node_hasname(args, &state); in xfs_attr_node_get()
1425 error = xfs_attr3_leaf_getvalue(blk->bp, args); in xfs_attr_node_get()
1432 xfs_trans_brelse(args->trans, state->path.blk[i].bp); in xfs_attr_node_get()