diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 01b6a0102fbd..abda1124a70f 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -213,7 +213,7 @@ xfs_attr_calc_size( | |||
213 | * Out of line attribute, cannot double split, but | 213 | * Out of line attribute, cannot double split, but |
214 | * make room for the attribute value itself. | 214 | * make room for the attribute value itself. |
215 | */ | 215 | */ |
216 | uint dblocks = XFS_B_TO_FSB(mp, valuelen); | 216 | uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen); |
217 | nblks += dblocks; | 217 | nblks += dblocks; |
218 | nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); | 218 | nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); |
219 | } | 219 | } |
@@ -698,11 +698,22 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
698 | 698 | ||
699 | trace_xfs_attr_leaf_replace(args); | 699 | trace_xfs_attr_leaf_replace(args); |
700 | 700 | ||
701 | /* save the attribute state for later removal*/ | ||
701 | args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ | 702 | args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ |
702 | args->blkno2 = args->blkno; /* set 2nd entry info*/ | 703 | args->blkno2 = args->blkno; /* set 2nd entry info*/ |
703 | args->index2 = args->index; | 704 | args->index2 = args->index; |
704 | args->rmtblkno2 = args->rmtblkno; | 705 | args->rmtblkno2 = args->rmtblkno; |
705 | args->rmtblkcnt2 = args->rmtblkcnt; | 706 | args->rmtblkcnt2 = args->rmtblkcnt; |
707 | args->rmtvaluelen2 = args->rmtvaluelen; | ||
708 | |||
709 | /* | ||
710 | * clear the remote attr state now that it is saved so that the | ||
711 | * values reflect the state of the attribute we are about to | ||
712 | * add, not the attribute we just found and will remove later. | ||
713 | */ | ||
714 | args->rmtblkno = 0; | ||
715 | args->rmtblkcnt = 0; | ||
716 | args->rmtvaluelen = 0; | ||
706 | } | 717 | } |
707 | 718 | ||
708 | /* | 719 | /* |
@@ -794,6 +805,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
794 | args->blkno = args->blkno2; | 805 | args->blkno = args->blkno2; |
795 | args->rmtblkno = args->rmtblkno2; | 806 | args->rmtblkno = args->rmtblkno2; |
796 | args->rmtblkcnt = args->rmtblkcnt2; | 807 | args->rmtblkcnt = args->rmtblkcnt2; |
808 | args->rmtvaluelen = args->rmtvaluelen2; | ||
797 | if (args->rmtblkno) { | 809 | if (args->rmtblkno) { |
798 | error = xfs_attr_rmtval_remove(args); | 810 | error = xfs_attr_rmtval_remove(args); |
799 | if (error) | 811 | if (error) |
@@ -999,13 +1011,22 @@ restart: | |||
999 | 1011 | ||
1000 | trace_xfs_attr_node_replace(args); | 1012 | trace_xfs_attr_node_replace(args); |
1001 | 1013 | ||
1014 | /* save the attribute state for later removal*/ | ||
1002 | args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ | 1015 | args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ |
1003 | args->blkno2 = args->blkno; /* set 2nd entry info*/ | 1016 | args->blkno2 = args->blkno; /* set 2nd entry info*/ |
1004 | args->index2 = args->index; | 1017 | args->index2 = args->index; |
1005 | args->rmtblkno2 = args->rmtblkno; | 1018 | args->rmtblkno2 = args->rmtblkno; |
1006 | args->rmtblkcnt2 = args->rmtblkcnt; | 1019 | args->rmtblkcnt2 = args->rmtblkcnt; |
1020 | args->rmtvaluelen2 = args->rmtvaluelen; | ||
1021 | |||
1022 | /* | ||
1023 | * clear the remote attr state now that it is saved so that the | ||
1024 | * values reflect the state of the attribute we are about to | ||
1025 | * add, not the attribute we just found and will remove later. | ||
1026 | */ | ||
1007 | args->rmtblkno = 0; | 1027 | args->rmtblkno = 0; |
1008 | args->rmtblkcnt = 0; | 1028 | args->rmtblkcnt = 0; |
1029 | args->rmtvaluelen = 0; | ||
1009 | } | 1030 | } |
1010 | 1031 | ||
1011 | retval = xfs_attr3_leaf_add(blk->bp, state->args); | 1032 | retval = xfs_attr3_leaf_add(blk->bp, state->args); |
@@ -1133,6 +1154,7 @@ restart: | |||
1133 | args->blkno = args->blkno2; | 1154 | args->blkno = args->blkno2; |
1134 | args->rmtblkno = args->rmtblkno2; | 1155 | args->rmtblkno = args->rmtblkno2; |
1135 | args->rmtblkcnt = args->rmtblkcnt2; | 1156 | args->rmtblkcnt = args->rmtblkcnt2; |
1157 | args->rmtvaluelen = args->rmtvaluelen2; | ||
1136 | if (args->rmtblkno) { | 1158 | if (args->rmtblkno) { |
1137 | error = xfs_attr_rmtval_remove(args); | 1159 | error = xfs_attr_rmtval_remove(args); |
1138 | if (error) | 1160 | if (error) |