Lines Matching full:args
46 STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args);
51 STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);
52 STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);
53 STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp);
58 STATIC int xfs_attr_node_get(xfs_da_args_t *args);
59 STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args);
63 STATIC int xfs_attr_node_lookup(struct xfs_da_args *args,
125 trace_xfs_attr_fillstate(state->args);
173 trace_xfs_attr_refillstate(state->args);
183 error = xfs_da3_node_read_mapped(state->args->trans,
184 state->args->dp, blk->disk_blkno,
201 error = xfs_da3_node_read_mapped(state->args->trans,
202 state->args->dp, blk->disk_blkno,
227 struct xfs_da_args *args) in xfs_attr_get_ilocked() argument
231 xfs_assert_ilocked(args->dp, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL); in xfs_attr_get_ilocked()
233 if (!xfs_inode_hasattr(args->dp)) in xfs_attr_get_ilocked()
240 error = xfs_iread_extents(args->trans, args->dp, XFS_ATTR_FORK); in xfs_attr_get_ilocked()
244 if (args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL) in xfs_attr_get_ilocked()
245 return xfs_attr_shortform_getvalue(args); in xfs_attr_get_ilocked()
246 if (xfs_attr_is_leaf(args->dp)) in xfs_attr_get_ilocked()
247 return xfs_attr_leaf_get(args); in xfs_attr_get_ilocked()
248 return xfs_attr_node_get(args); in xfs_attr_get_ilocked()
254 * If args->valuelen is zero, then the caller does not want the value, just an
256 * exists. The size is returned in args.valuelen.
258 * If args->value is NULL but args->valuelen is non-zero, allocate the buffer
260 * caller always has to free args->value if it is set, no matter if this
264 * args->valuelen, return -ERANGE with the size of the attribute that was found
265 * in args->valuelen.
269 struct xfs_da_args *args) in xfs_attr_get() argument
274 XFS_STATS_INC(args->dp->i_mount, xs_attr_get); in xfs_attr_get()
276 if (xfs_is_shutdown(args->dp->i_mount)) in xfs_attr_get()
279 if (!args->owner) in xfs_attr_get()
280 args->owner = args->dp->i_ino; in xfs_attr_get()
281 args->geo = args->dp->i_mount->m_attr_geo; in xfs_attr_get()
282 args->whichfork = XFS_ATTR_FORK; in xfs_attr_get()
283 xfs_attr_sethash(args); in xfs_attr_get()
286 args->op_flags = XFS_DA_OP_OKNOENT; in xfs_attr_get()
288 lock_mode = xfs_ilock_attr_map_shared(args->dp); in xfs_attr_get()
289 error = xfs_attr_get_ilocked(args); in xfs_attr_get()
290 xfs_iunlock(args->dp, lock_mode); in xfs_attr_get()
300 struct xfs_da_args *args, in xfs_attr_calc_size() argument
303 struct xfs_mount *mp = args->dp->i_mount; in xfs_attr_calc_size()
311 size = xfs_attr_leaf_newentsize(args, local); in xfs_attr_calc_size()
314 if (size > (args->geo->blksize / 2)) { in xfs_attr_calc_size()
323 uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen); in xfs_attr_calc_size()
334 const struct xfs_da_args *args) in xfs_attr_set_resv() argument
336 struct xfs_mount *mp = args->dp->i_mount; in xfs_attr_set_resv()
339 M_RES(mp)->tr_attrsetrt.tr_logres * args->total, in xfs_attr_set_resv()
355 struct xfs_da_args *args) in xfs_attr_try_sf_addname() argument
364 xfs_attr_shortform_create(args); in xfs_attr_try_sf_addname()
366 error = xfs_attr_shortform_addname(args); in xfs_attr_try_sf_addname()
375 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); in xfs_attr_try_sf_addname()
378 xfs_trans_set_sync(args->trans); in xfs_attr_try_sf_addname()
387 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_sf_addname() local
388 struct xfs_inode *dp = args->dp; in xfs_attr_sf_addname()
391 error = xfs_attr_try_sf_addname(dp, args); in xfs_attr_sf_addname()
402 error = xfs_attr_shortform_to_leaf(args); in xfs_attr_sf_addname()
408 trace_xfs_attr_sf_addname_return(attr->xattri_dela_state, args->dp); in xfs_attr_sf_addname()
442 struct xfs_da_args *args) in xfs_attr_save_rmt_blk() argument
444 args->blkno2 = args->blkno; in xfs_attr_save_rmt_blk()
445 args->index2 = args->index; in xfs_attr_save_rmt_blk()
446 args->rmtblkno2 = args->rmtblkno; in xfs_attr_save_rmt_blk()
447 args->rmtblkcnt2 = args->rmtblkcnt; in xfs_attr_save_rmt_blk()
448 args->rmtvaluelen2 = args->rmtvaluelen; in xfs_attr_save_rmt_blk()
449 args->rmtblkno = 0; in xfs_attr_save_rmt_blk()
450 args->rmtblkcnt = 0; in xfs_attr_save_rmt_blk()
451 args->rmtvaluelen = 0; in xfs_attr_save_rmt_blk()
457 struct xfs_da_args *args) in xfs_attr_restore_rmt_blk() argument
459 args->blkno = args->blkno2; in xfs_attr_restore_rmt_blk()
460 args->index = args->index2; in xfs_attr_restore_rmt_blk()
461 args->rmtblkno = args->rmtblkno2; in xfs_attr_restore_rmt_blk()
462 args->rmtblkcnt = args->rmtblkcnt2; in xfs_attr_restore_rmt_blk()
463 args->rmtvaluelen = args->rmtvaluelen2; in xfs_attr_restore_rmt_blk()
473 struct xfs_da_args *args) in xfs_attr_update_pptr_replace_args() argument
475 ASSERT(args->new_namelen > 0); in xfs_attr_update_pptr_replace_args()
476 args->name = args->new_name; in xfs_attr_update_pptr_replace_args()
477 args->namelen = args->new_namelen; in xfs_attr_update_pptr_replace_args()
478 args->value = args->new_value; in xfs_attr_update_pptr_replace_args()
479 args->valuelen = args->new_valuelen; in xfs_attr_update_pptr_replace_args()
480 xfs_attr_sethash(args); in xfs_attr_update_pptr_replace_args()
499 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_complete_op() local
501 if (!(args->op_flags & XFS_DA_OP_REPLACE)) in xfs_attr_complete_op()
504 xfs_attr_update_pptr_replace_args(args); in xfs_attr_complete_op()
506 args->op_flags &= ~XFS_DA_OP_REPLACE; in xfs_attr_complete_op()
507 args->attr_filter &= ~XFS_ATTR_INCOMPLETE; in xfs_attr_complete_op()
518 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_leaf_addname() local
522 ASSERT(xfs_attr_is_leaf(args->dp)); in xfs_attr_leaf_addname()
524 error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, &bp); in xfs_attr_leaf_addname()
531 error = xfs_attr3_leaf_lookup_int(bp, args); in xfs_attr_leaf_addname()
534 if (args->op_flags & XFS_DA_OP_REPLACE) in xfs_attr_leaf_addname()
538 if (!(args->op_flags & XFS_DA_OP_REPLACE)) in xfs_attr_leaf_addname()
541 trace_xfs_attr_leaf_replace(args); in xfs_attr_leaf_addname()
547 xfs_attr_save_rmt_blk(args); in xfs_attr_leaf_addname()
560 if (!xfs_attr3_leaf_add(bp, args)) { in xfs_attr_leaf_addname()
561 error = xfs_attr3_leaf_to_node(args); in xfs_attr_leaf_addname()
566 } else if (args->rmtblkno) { in xfs_attr_leaf_addname()
573 trace_xfs_attr_leaf_addname_return(attr->xattri_dela_state, args->dp); in xfs_attr_leaf_addname()
577 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_addname()
592 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_node_addname() local
601 error = xfs_attr3_leaf_to_node(args); in xfs_attr_node_addname()
613 if (args->rmtblkno) in xfs_attr_node_addname()
619 trace_xfs_attr_node_addname_return(attr->xattri_dela_state, args->dp); in xfs_attr_node_addname()
627 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_rmtval_alloc() local
645 error = xfs_attr_rmtval_set_value(args); in xfs_attr_rmtval_alloc()
657 error = xfs_attr3_leaf_clearflag(args); in xfs_attr_rmtval_alloc()
659 trace_xfs_attr_rmtval_alloc(attr->xattri_dela_state, args->dp); in xfs_attr_rmtval_alloc()
669 struct xfs_da_args *args, in xfs_attr_leaf_mark_incomplete() argument
686 return xfs_attr3_leaf_setflag(args); in xfs_attr_leaf_mark_incomplete()
694 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_item_init_da_state() local
697 attr->xattri_da_state = xfs_da_state_alloc(args); in xfs_attr_item_init_da_state()
699 xfs_da_state_reset(attr->xattri_da_state, args); in xfs_attr_item_init_da_state()
711 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_node_removename_setup() local
716 error = xfs_attr_node_lookup(args, attr->xattri_da_state); in xfs_attr_node_removename_setup()
726 error = xfs_attr_leaf_mark_incomplete(args, state); in xfs_attr_node_removename_setup()
729 if (args->rmtblkno > 0) in xfs_attr_node_removename_setup()
730 error = xfs_attr_rmtval_invalidate(args); in xfs_attr_node_removename_setup()
742 * original lookup and insert placing the old attr in args->blkno/args->index
743 * and the new attr in args->blkno2/args->index2.
749 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_leaf_remove_attr() local
750 struct xfs_inode *dp = args->dp; in xfs_attr_leaf_remove_attr()
755 error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, in xfs_attr_leaf_remove_attr()
756 args->blkno, &bp); in xfs_attr_leaf_remove_attr()
760 xfs_attr3_leaf_remove(bp, args); in xfs_attr_leaf_remove_attr()
764 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_leaf_remove_attr()
777 struct xfs_da_args *args) in xfs_attr_leaf_shrink() argument
779 struct xfs_inode *dp = args->dp; in xfs_attr_leaf_shrink()
787 error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, &bp); in xfs_attr_leaf_shrink()
793 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_leaf_shrink()
796 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_shrink()
814 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_set_iter() local
831 error = xfs_attr_sf_removename(args); in xfs_attr_set_iter()
833 xfs_attr_init_add_state(args)); in xfs_attr_set_iter()
836 error = xfs_attr_leaf_removename(args); in xfs_attr_set_iter()
838 xfs_attr_init_add_state(args)); in xfs_attr_set_iter()
843 (args->op_flags & XFS_DA_OP_RECOVERY)) { in xfs_attr_set_iter()
845 xfs_attr_init_add_state(args)); in xfs_attr_set_iter()
852 if (args->rmtblkno == 0) in xfs_attr_set_iter()
880 error = xfs_attr3_leaf_flipflags(args); in xfs_attr_set_iter()
899 xfs_attr_restore_rmt_blk(args); in xfs_attr_set_iter()
900 if (args->rmtblkno) { in xfs_attr_set_iter()
901 error = xfs_attr_rmtval_invalidate(args); in xfs_attr_set_iter()
935 xfs_attr_init_add_state(args)); in xfs_attr_set_iter()
941 error = xfs_attr_leaf_shrink(args); in xfs_attr_set_iter()
943 xfs_attr_init_add_state(args)); in xfs_attr_set_iter()
950 trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); in xfs_attr_set_iter()
960 struct xfs_da_args *args) in xfs_attr_lookup() argument
962 struct xfs_inode *dp = args->dp; in xfs_attr_lookup()
971 if (xfs_attr_sf_findname(args)) in xfs_attr_lookup()
977 error = xfs_iread_extents(args->trans, args->dp, XFS_ATTR_FORK); in xfs_attr_lookup()
982 error = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_lookup()
985 xfs_trans_brelse(args->trans, bp); in xfs_attr_lookup()
990 state = xfs_da_state_alloc(args); in xfs_attr_lookup()
991 error = xfs_attr_node_lookup(args, state); in xfs_attr_lookup()
1036 * The caller must have initialized @args, attached dquots, and must not hold
1045 struct xfs_da_args *args, in xfs_attr_set() argument
1049 struct xfs_inode *dp = args->dp; in xfs_attr_set()
1056 ASSERT(!args->trans); in xfs_attr_set()
1063 args->total = xfs_attr_calc_size(args, &local); in xfs_attr_set()
1071 xfs_attr_sf_entsize_byname(args->namelen, in xfs_attr_set()
1072 args->valuelen); in xfs_attr_set()
1080 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen); in xfs_attr_set()
1082 tres = xfs_attr_set_resv(args); in xfs_attr_set()
1083 total = args->total; in xfs_attr_set()
1097 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); in xfs_attr_set()
1102 error = xfs_iext_count_extend(args->trans, dp, XFS_ATTR_FORK, in xfs_attr_set()
1108 error = xfs_attr_lookup(args); in xfs_attr_set()
1113 xfs_attr_defer_add(args, XFS_ATTR_DEFER_REMOVE); in xfs_attr_set()
1120 xfs_attr_defer_add(args, XFS_ATTR_DEFER_REPLACE); in xfs_attr_set()
1130 xfs_attr_defer_add(args, XFS_ATTR_DEFER_SET); in xfs_attr_set()
1141 xfs_trans_set_sync(args->trans); in xfs_attr_set()
1143 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); in xfs_attr_set()
1148 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE); in xfs_attr_set()
1149 error = xfs_trans_commit(args->trans); in xfs_attr_set()
1152 args->trans = NULL; in xfs_attr_set()
1156 if (args->trans) in xfs_attr_set()
1157 xfs_trans_cancel(args->trans); in xfs_attr_set()
1178 struct xfs_da_args *args) in xfs_attr_shortform_addname() argument
1182 trace_xfs_attr_sf_addname(args); in xfs_attr_shortform_addname()
1184 if (xfs_attr_sf_findname(args)) { in xfs_attr_shortform_addname()
1187 ASSERT(args->op_flags & XFS_DA_OP_REPLACE); in xfs_attr_shortform_addname()
1189 error = xfs_attr_sf_removename(args); in xfs_attr_shortform_addname()
1199 args->op_flags &= ~XFS_DA_OP_REPLACE; in xfs_attr_shortform_addname()
1201 ASSERT(!(args->op_flags & XFS_DA_OP_REPLACE)); in xfs_attr_shortform_addname()
1204 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX || in xfs_attr_shortform_addname()
1205 args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX) in xfs_attr_shortform_addname()
1208 newsize = xfs_attr_sf_totsize(args->dp); in xfs_attr_shortform_addname()
1209 newsize += xfs_attr_sf_entsize_byname(args->namelen, args->valuelen); in xfs_attr_shortform_addname()
1211 forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize); in xfs_attr_shortform_addname()
1215 xfs_attr_shortform_add(args, forkoff); in xfs_attr_shortform_addname()
1229 struct xfs_da_args *args, in xfs_attr_leaf_hasname() argument
1234 error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, bp); in xfs_attr_leaf_hasname()
1238 error = xfs_attr3_leaf_lookup_int(*bp, args); in xfs_attr_leaf_hasname()
1240 xfs_trans_brelse(args->trans, *bp); in xfs_attr_leaf_hasname()
1253 struct xfs_da_args *args) in xfs_attr_leaf_removename() argument
1259 trace_xfs_attr_leaf_removename(args); in xfs_attr_leaf_removename()
1264 dp = args->dp; in xfs_attr_leaf_removename()
1266 error = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_leaf_removename()
1268 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_removename()
1269 if (args->op_flags & XFS_DA_OP_RECOVERY) in xfs_attr_leaf_removename()
1275 xfs_attr3_leaf_remove(bp, args); in xfs_attr_leaf_removename()
1282 return xfs_attr3_leaf_to_shortform(bp, args, forkoff); in xfs_attr_leaf_removename()
1297 xfs_attr_leaf_get(xfs_da_args_t *args) in xfs_attr_leaf_get() argument
1302 trace_xfs_attr_leaf_get(args); in xfs_attr_leaf_get()
1304 error = xfs_attr_leaf_hasname(args, &bp); in xfs_attr_leaf_get()
1307 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_get()
1313 error = xfs_attr3_leaf_getvalue(bp, args); in xfs_attr_leaf_get()
1314 xfs_trans_brelse(args->trans, bp); in xfs_attr_leaf_get()
1321 struct xfs_da_args *args, in xfs_attr_node_lookup() argument
1344 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_node_addname_find_attr() local
1352 error = xfs_attr_node_lookup(args, attr->xattri_da_state); in xfs_attr_node_addname_find_attr()
1355 if (args->op_flags & XFS_DA_OP_REPLACE) in xfs_attr_node_addname_find_attr()
1359 if (!(args->op_flags & XFS_DA_OP_REPLACE)) in xfs_attr_node_addname_find_attr()
1363 trace_xfs_attr_node_replace(args); in xfs_attr_node_addname_find_attr()
1369 xfs_attr_save_rmt_blk(args); in xfs_attr_node_addname_find_attr()
1404 trace_xfs_attr_node_addname(state->args); in xfs_attr_node_try_addname()
1409 if (!xfs_attr3_leaf_add(blk->bp, state->args)) { in xfs_attr_node_try_addname()
1444 struct xfs_da_args *args, in xfs_attr_node_removename() argument
1455 retval = xfs_attr3_leaf_remove(blk->bp, args); in xfs_attr_node_removename()
1465 struct xfs_da_args *args = attr->xattri_da_args; in xfs_attr_node_remove_attr() local
1466 struct xfs_da_state *state = xfs_da_state_alloc(args); in xfs_attr_node_remove_attr()
1475 args->attr_filter |= XFS_ATTR_INCOMPLETE; in xfs_attr_node_remove_attr()
1480 error = xfs_attr_node_removename(args, state); in xfs_attr_node_remove_attr()
1510 struct xfs_da_args *args) in xfs_attr_node_get() argument
1517 trace_xfs_attr_node_get(args); in xfs_attr_node_get()
1522 state = xfs_da_state_alloc(args); in xfs_attr_node_get()
1523 error = xfs_attr_node_lookup(args, state); in xfs_attr_node_get()
1531 error = xfs_attr3_leaf_getvalue(blk->bp, args); in xfs_attr_node_get()
1538 xfs_trans_brelse(args->trans, state->path.blk[i].bp); in xfs_attr_node_get()