Lines Matching refs:args

45 STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args);
50 STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);
51 STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);
52 STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp);
53 STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args);
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,
123 trace_xfs_attr_fillstate(state->args);
171 trace_xfs_attr_refillstate(state->args);
181 error = xfs_da3_node_read_mapped(state->args->trans,
182 state->args->dp, blk->disk_blkno,
199 error = xfs_da3_node_read_mapped(state->args->trans,
200 state->args->dp, blk->disk_blkno,
225 struct xfs_da_args *args)
227 ASSERT(xfs_isilocked(args->dp, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL));
229 if (!xfs_inode_hasattr(args->dp))
232 if (args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL)
233 return xfs_attr_shortform_getvalue(args);
234 if (xfs_attr_is_leaf(args->dp))
235 return xfs_attr_leaf_get(args);
236 return xfs_attr_node_get(args);
242 * If args->valuelen is zero, then the caller does not want the value, just an
244 * exists. The size is returned in args.valuelen.
246 * If args->value is NULL but args->valuelen is non-zero, allocate the buffer
248 * caller always has to free args->value if it is set, no matter if this
252 * args->valuelen, return -ERANGE with the size of the attribute that was found
253 * in args->valuelen.
257 struct xfs_da_args *args)
262 XFS_STATS_INC(args->dp->i_mount, xs_attr_get);
264 if (xfs_is_shutdown(args->dp->i_mount))
267 args->geo = args->dp->i_mount->m_attr_geo;
268 args->whichfork = XFS_ATTR_FORK;
269 args->hashval = xfs_da_hashname(args->name, args->namelen);
272 args->op_flags = XFS_DA_OP_OKNOENT;
274 lock_mode = xfs_ilock_attr_map_shared(args->dp);
275 error = xfs_attr_get_ilocked(args);
276 xfs_iunlock(args->dp, lock_mode);
286 struct xfs_da_args *args,
289 struct xfs_mount *mp = args->dp->i_mount;
297 size = xfs_attr_leaf_newentsize(args, local);
300 if (size > (args->geo->blksize / 2)) {
309 uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen);
320 struct xfs_da_args *args,
324 struct xfs_mount *mp = args->dp->i_mount;
326 if (args->value) {
329 args->total;
332 *total = args->total;
347 struct xfs_da_args *args)
356 xfs_attr_shortform_create(args);
358 error = xfs_attr_shortform_addname(args);
366 if (!error && !(args->op_flags & XFS_DA_OP_NOTIME))
367 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
370 xfs_trans_set_sync(args->trans);
379 struct xfs_da_args *args = attr->xattri_da_args;
380 struct xfs_inode *dp = args->dp;
383 error = xfs_attr_try_sf_addname(dp, args);
394 error = xfs_attr_shortform_to_leaf(args);
400 trace_xfs_attr_sf_addname_return(attr->xattri_dela_state, args->dp);
420 struct xfs_da_args *args = attr->xattri_da_args;
421 bool do_replace = args->op_flags & XFS_DA_OP_REPLACE;
423 args->op_flags &= ~XFS_DA_OP_REPLACE;
425 args->attr_filter &= ~XFS_ATTR_INCOMPLETE;
435 struct xfs_da_args *args = attr->xattri_da_args;
438 ASSERT(xfs_attr_is_leaf(args->dp));
444 error = xfs_attr_leaf_try_add(args);
447 error = xfs_attr3_leaf_to_node(args);
466 if (args->rmtblkno)
472 trace_xfs_attr_leaf_addname_return(attr->xattri_dela_state, args->dp);
487 struct xfs_da_args *args = attr->xattri_da_args;
496 error = xfs_attr3_leaf_to_node(args);
508 if (args->rmtblkno)
514 trace_xfs_attr_node_addname_return(attr->xattri_dela_state, args->dp);
522 struct xfs_da_args *args = attr->xattri_da_args;
540 error = xfs_attr_rmtval_set_value(args);
552 error = xfs_attr3_leaf_clearflag(args);
554 trace_xfs_attr_rmtval_alloc(attr->xattri_dela_state, args->dp);
564 struct xfs_da_args *args,
581 return xfs_attr3_leaf_setflag(args);
589 struct xfs_da_args *args = attr->xattri_da_args;
592 attr->xattri_da_state = xfs_da_state_alloc(args);
594 xfs_da_state_reset(attr->xattri_da_state, args);
606 struct xfs_da_args *args = attr->xattri_da_args;
611 error = xfs_attr_node_lookup(args, attr->xattri_da_state);
621 error = xfs_attr_leaf_mark_incomplete(args, state);
624 if (args->rmtblkno > 0)
625 error = xfs_attr_rmtval_invalidate(args);
637 * original lookup and insert placing the old attr in args->blkno/args->index
638 * and the new attr in args->blkno2/args->index2.
644 struct xfs_da_args *args = attr->xattri_da_args;
645 struct xfs_inode *dp = args->dp;
650 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno,
655 xfs_attr3_leaf_remove(bp, args);
659 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
672 struct xfs_da_args *args)
674 struct xfs_inode *dp = args->dp;
682 error = xfs_attr3_leaf_read(args->trans, args->dp, 0, &bp);
688 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
691 xfs_trans_brelse(args->trans, bp);
709 struct xfs_da_args *args = attr->xattri_da_args;
726 error = xfs_attr_sf_removename(args);
728 xfs_attr_init_add_state(args));
731 error = xfs_attr_leaf_removename(args);
733 xfs_attr_init_add_state(args));
738 (args->op_flags & XFS_DA_OP_RECOVERY)) {
740 xfs_attr_init_add_state(args));
747 if (args->rmtblkno == 0)
775 error = xfs_attr3_leaf_flipflags(args);
794 xfs_attr_restore_rmt_blk(args);
795 if (args->rmtblkno) {
796 error = xfs_attr_rmtval_invalidate(args);
830 xfs_attr_init_add_state(args));
836 error = xfs_attr_leaf_shrink(args);
838 xfs_attr_init_add_state(args));
845 trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp);
855 struct xfs_da_args *args)
857 struct xfs_inode *dp = args->dp;
866 return xfs_attr_sf_findname(args, NULL, NULL);
869 error = xfs_attr_leaf_hasname(args, &bp);
872 xfs_trans_brelse(args->trans, bp);
877 state = xfs_da_state_alloc(args);
878 error = xfs_attr_node_lookup(args, state);
885 struct xfs_da_args *args,
894 new->xattri_da_args = args;
903 struct xfs_da_args *args)
908 error = xfs_attr_intent_init(args, XFS_ATTRI_OP_FLAGS_SET, &new);
912 new->xattri_dela_state = xfs_attr_init_add_state(args);
913 xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
914 trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp);
922 struct xfs_da_args *args)
927 error = xfs_attr_intent_init(args, XFS_ATTRI_OP_FLAGS_REPLACE, &new);
931 new->xattri_dela_state = xfs_attr_init_replace_state(args);
932 xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
933 trace_xfs_attr_defer_replace(new->xattri_dela_state, args->dp);
941 struct xfs_da_args *args)
947 error = xfs_attr_intent_init(args, XFS_ATTRI_OP_FLAGS_REMOVE, &new);
951 new->xattri_dela_state = xfs_attr_init_remove_state(args);
952 xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
953 trace_xfs_attr_defer_remove(new->xattri_dela_state, args->dp);
959 * Note: If args->value is NULL the attribute will be removed, just like the
964 struct xfs_da_args *args)
966 struct xfs_inode *dp = args->dp;
969 bool rsvd = (args->attr_filter & XFS_ATTR_ROOT);
981 args->geo = mp->m_attr_geo;
982 args->whichfork = XFS_ATTR_FORK;
983 args->hashval = xfs_da_hashname(args->name, args->namelen);
991 args->op_flags = XFS_DA_OP_OKNOENT |
992 (args->op_flags & XFS_DA_OP_LOGGED);
994 if (args->value) {
996 args->total = xfs_attr_calc_size(args, &local);
1004 xfs_attr_sf_entsize_byname(args->namelen,
1005 args->valuelen);
1013 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
1023 xfs_init_attr_trans(args, &tres, &total);
1024 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
1028 if (args->value || xfs_inode_hasattr(dp)) {
1032 error = xfs_iext_count_upgrade(args->trans, dp,
1038 error = xfs_attr_lookup(args);
1042 if (!args->value) {
1043 error = xfs_attr_defer_remove(args);
1047 if (args->attr_flags & XATTR_CREATE)
1050 error = xfs_attr_defer_replace(args);
1054 if (!args->value)
1058 if (args->attr_flags & XATTR_REPLACE)
1061 error = xfs_attr_defer_add(args);
1074 xfs_trans_set_sync(args->trans);
1076 if (!(args->op_flags & XFS_DA_OP_NOTIME))
1077 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
1082 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
1083 error = xfs_trans_commit(args->trans);
1089 if (args->trans)
1090 xfs_trans_cancel(args->trans);
1112 struct xfs_da_args *args)
1117 trace_xfs_attr_sf_addname(args);
1119 error = xfs_attr_shortform_lookup(args);
1122 if (args->op_flags & XFS_DA_OP_REPLACE)
1126 if (!(args->op_flags & XFS_DA_OP_REPLACE))
1129 error = xfs_attr_sf_removename(args);
1139 args->op_flags &= ~XFS_DA_OP_REPLACE;
1147 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
1148 args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX)
1151 newsize = xfs_attr_sf_totsize(args->dp);
1152 newsize += xfs_attr_sf_entsize_byname(args->namelen, args->valuelen);
1154 forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize);
1158 xfs_attr_shortform_add(args, forkoff);
1170 struct xfs_da_args *args)
1172 args->blkno2 = args->blkno;
1173 args->index2 = args->index;
1174 args->rmtblkno2 = args->rmtblkno;
1175 args->rmtblkcnt2 = args->rmtblkcnt;
1176 args->rmtvaluelen2 = args->rmtvaluelen;
1177 args->rmtblkno = 0;
1178 args->rmtblkcnt = 0;
1179 args->rmtvaluelen = 0;
1185 struct xfs_da_args *args)
1187 args->blkno = args->blkno2;
1188 args->index = args->index2;
1189 args->rmtblkno = args->rmtblkno2;
1190 args->rmtblkcnt = args->rmtblkcnt2;
1191 args->rmtvaluelen = args->rmtvaluelen2;
1206 struct xfs_da_args *args)
1211 error = xfs_attr3_leaf_read(args->trans, args->dp, 0, &bp);
1218 error = xfs_attr3_leaf_lookup_int(bp, args);
1221 if (args->op_flags & XFS_DA_OP_REPLACE)
1225 if (!(args->op_flags & XFS_DA_OP_REPLACE))
1228 trace_xfs_attr_leaf_replace(args);
1234 xfs_attr_save_rmt_blk(args);
1242 return xfs_attr3_leaf_add(bp, args);
1245 xfs_trans_brelse(args->trans, bp);
1254 struct xfs_da_args *args,
1259 error = xfs_attr3_leaf_read(args->trans, args->dp, 0, bp);
1263 error = xfs_attr3_leaf_lookup_int(*bp, args);
1265 xfs_trans_brelse(args->trans, *bp);
1278 struct xfs_da_args *args)
1284 trace_xfs_attr_leaf_removename(args);
1289 dp = args->dp;
1291 error = xfs_attr_leaf_hasname(args, &bp);
1293 xfs_trans_brelse(args->trans, bp);
1294 if (args->op_flags & XFS_DA_OP_RECOVERY)
1300 xfs_attr3_leaf_remove(bp, args);
1307 return xfs_attr3_leaf_to_shortform(bp, args, forkoff);
1322 xfs_attr_leaf_get(xfs_da_args_t *args)
1327 trace_xfs_attr_leaf_get(args);
1329 error = xfs_attr_leaf_hasname(args, &bp);
1332 xfs_trans_brelse(args->trans, bp);
1338 error = xfs_attr3_leaf_getvalue(bp, args);
1339 xfs_trans_brelse(args->trans, bp);
1346 struct xfs_da_args *args,
1369 struct xfs_da_args *args = attr->xattri_da_args;
1377 error = xfs_attr_node_lookup(args, attr->xattri_da_state);
1380 if (args->op_flags & XFS_DA_OP_REPLACE)
1384 if (!(args->op_flags & XFS_DA_OP_REPLACE))
1388 trace_xfs_attr_node_replace(args);
1394 xfs_attr_save_rmt_blk(args);
1426 trace_xfs_attr_node_addname(state->args);
1431 error = xfs_attr3_leaf_add(blk->bp, state->args);
1466 struct xfs_da_args *args,
1477 retval = xfs_attr3_leaf_remove(blk->bp, args);
1487 struct xfs_da_args *args = attr->xattri_da_args;
1488 struct xfs_da_state *state = xfs_da_state_alloc(args);
1497 args->attr_filter |= XFS_ATTR_INCOMPLETE;
1502 error = xfs_attr_node_removename(args, state);
1532 struct xfs_da_args *args)
1539 trace_xfs_attr_node_get(args);
1544 state = xfs_da_state_alloc(args);
1545 error = xfs_attr_node_lookup(args, state);
1553 error = xfs_attr3_leaf_getvalue(blk->bp, args);
1560 xfs_trans_brelse(args->trans, state->path.blk[i].bp);