xfs_attr.c (ea0b3e814741fb64e7785b564ea619578058e0b0) | xfs_attr.c (9713dc88773d066413ae23aa474b13241507a89e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 887 unchanged lines hidden (view full) --- 896 } 897 898 state = xfs_da_state_alloc(args); 899 error = xfs_attr_node_lookup(args, state); 900 xfs_da_state_free(state); 901 return error; 902} 903 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 887 unchanged lines hidden (view full) --- 896 } 897 898 state = xfs_da_state_alloc(args); 899 error = xfs_attr_node_lookup(args, state); 900 xfs_da_state_free(state); 901 return error; 902} 903 |
904static void 905xfs_attr_defer_add( 906 struct xfs_da_args *args, 907 unsigned int op_flags) 908{ 909 910 struct xfs_attr_intent *new; 911 912 new = kmem_cache_zalloc(xfs_attr_intent_cache, 913 GFP_KERNEL | __GFP_NOFAIL); 914 new->xattri_op_flags = op_flags; 915 new->xattri_da_args = args; 916 917 switch (op_flags) { 918 case XFS_ATTRI_OP_FLAGS_SET: 919 new->xattri_dela_state = xfs_attr_init_add_state(args); 920 break; 921 case XFS_ATTRI_OP_FLAGS_REPLACE: 922 new->xattri_dela_state = xfs_attr_init_replace_state(args); 923 break; 924 case XFS_ATTRI_OP_FLAGS_REMOVE: 925 new->xattri_dela_state = xfs_attr_init_remove_state(args); 926 break; 927 default: 928 ASSERT(0); 929 } 930 931 xfs_defer_add(args->trans, &new->xattri_list, &xfs_attr_defer_type); 932 trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp); 933} 934 | |
935int 936xfs_attr_set( 937 struct xfs_da_args *args, 938 enum xfs_attr_update op) 939{ 940 struct xfs_inode *dp = args->dp; 941 struct xfs_mount *mp = dp->i_mount; 942 struct xfs_trans_res tres; --- 73 unchanged lines hidden (view full) --- 1016 goto out_trans_cancel; 1017 } 1018 1019 error = xfs_attr_lookup(args); 1020 switch (error) { 1021 case -EEXIST: 1022 if (op == XFS_ATTRUPDATE_REMOVE) { 1023 /* if no value, we are performing a remove operation */ | 904int 905xfs_attr_set( 906 struct xfs_da_args *args, 907 enum xfs_attr_update op) 908{ 909 struct xfs_inode *dp = args->dp; 910 struct xfs_mount *mp = dp->i_mount; 911 struct xfs_trans_res tres; --- 73 unchanged lines hidden (view full) --- 985 goto out_trans_cancel; 986 } 987 988 error = xfs_attr_lookup(args); 989 switch (error) { 990 case -EEXIST: 991 if (op == XFS_ATTRUPDATE_REMOVE) { 992 /* if no value, we are performing a remove operation */ |
1024 xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REMOVE); | 993 xfs_attr_defer_add(args, XFS_ATTR_DEFER_REMOVE); |
1025 break; 1026 } 1027 1028 /* Pure create fails if the attr already exists */ 1029 if (op == XFS_ATTRUPDATE_CREATE) 1030 goto out_trans_cancel; | 994 break; 995 } 996 997 /* Pure create fails if the attr already exists */ 998 if (op == XFS_ATTRUPDATE_CREATE) 999 goto out_trans_cancel; |
1031 xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REPLACE); | 1000 xfs_attr_defer_add(args, XFS_ATTR_DEFER_REPLACE); |
1032 break; 1033 case -ENOATTR: 1034 /* Can't remove what isn't there. */ 1035 if (op == XFS_ATTRUPDATE_REMOVE) 1036 goto out_trans_cancel; 1037 1038 /* Pure replace fails if no existing attr to replace. */ 1039 if (op == XFS_ATTRUPDATE_REPLACE) 1040 goto out_trans_cancel; | 1001 break; 1002 case -ENOATTR: 1003 /* Can't remove what isn't there. */ 1004 if (op == XFS_ATTRUPDATE_REMOVE) 1005 goto out_trans_cancel; 1006 1007 /* Pure replace fails if no existing attr to replace. */ 1008 if (op == XFS_ATTRUPDATE_REPLACE) 1009 goto out_trans_cancel; |
1041 xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_SET); | 1010 xfs_attr_defer_add(args, XFS_ATTR_DEFER_SET); |
1042 break; 1043 default: 1044 goto out_trans_cancel; 1045 } 1046 1047 /* 1048 * If this is a synchronous mount, make sure that the 1049 * transaction goes to disk before returning to the user. --- 529 unchanged lines hidden --- | 1011 break; 1012 default: 1013 goto out_trans_cancel; 1014 } 1015 1016 /* 1017 * If this is a synchronous mount, make sure that the 1018 * transaction goes to disk before returning to the user. --- 529 unchanged lines hidden --- |