diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 9ada7bdbae52..9d358ffce4e5 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -57,9 +57,9 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #define ATTR_SYSCOUNT 2 | 59 | #define ATTR_SYSCOUNT 2 |
60 | STATIC struct attrnames posix_acl_access; | 60 | static struct attrnames posix_acl_access; |
61 | STATIC struct attrnames posix_acl_default; | 61 | static struct attrnames posix_acl_default; |
62 | STATIC struct attrnames *attr_system_names[ATTR_SYSCOUNT]; | 62 | static struct attrnames *attr_system_names[ATTR_SYSCOUNT]; |
63 | 63 | ||
64 | /*======================================================================== | 64 | /*======================================================================== |
65 | * Function prototypes for the kernel. | 65 | * Function prototypes for the kernel. |
@@ -199,18 +199,14 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen, | |||
199 | return (error); | 199 | return (error); |
200 | 200 | ||
201 | /* | 201 | /* |
202 | * Determine space new attribute will use, and if it would be | ||
203 | * "local" or "remote" (note: local != inline). | ||
204 | */ | ||
205 | size = xfs_attr_leaf_newentsize(namelen, valuelen, | ||
206 | mp->m_sb.sb_blocksize, &local); | ||
207 | |||
208 | /* | ||
209 | * If the inode doesn't have an attribute fork, add one. | 202 | * If the inode doesn't have an attribute fork, add one. |
210 | * (inode must not be locked when we call this routine) | 203 | * (inode must not be locked when we call this routine) |
211 | */ | 204 | */ |
212 | if (XFS_IFORK_Q(dp) == 0) { | 205 | if (XFS_IFORK_Q(dp) == 0) { |
213 | if ((error = xfs_bmap_add_attrfork(dp, size, rsvd))) | 206 | int sf_size = sizeof(xfs_attr_sf_hdr_t) + |
207 | XFS_ATTR_SF_ENTSIZE_BYNAME(namelen, valuelen); | ||
208 | |||
209 | if ((error = xfs_bmap_add_attrfork(dp, sf_size, rsvd))) | ||
214 | return(error); | 210 | return(error); |
215 | } | 211 | } |
216 | 212 | ||
@@ -231,6 +227,13 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen, | |||
231 | args.addname = 1; | 227 | args.addname = 1; |
232 | args.oknoent = 1; | 228 | args.oknoent = 1; |
233 | 229 | ||
230 | /* | ||
231 | * Determine space new attribute will use, and if it would be | ||
232 | * "local" or "remote" (note: local != inline). | ||
233 | */ | ||
234 | size = xfs_attr_leaf_newentsize(namelen, valuelen, | ||
235 | mp->m_sb.sb_blocksize, &local); | ||
236 | |||
234 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); | 237 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); |
235 | if (local) { | 238 | if (local) { |
236 | if (size > (mp->m_sb.sb_blocksize >> 1)) { | 239 | if (size > (mp->m_sb.sb_blocksize >> 1)) { |
@@ -346,7 +349,7 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen, | |||
346 | error = xfs_attr_shortform_to_leaf(&args); | 349 | error = xfs_attr_shortform_to_leaf(&args); |
347 | if (!error) { | 350 | if (!error) { |
348 | error = xfs_bmap_finish(&args.trans, args.flist, | 351 | error = xfs_bmap_finish(&args.trans, args.flist, |
349 | *args.firstblock, &committed); | 352 | &committed); |
350 | } | 353 | } |
351 | if (error) { | 354 | if (error) { |
352 | ASSERT(committed); | 355 | ASSERT(committed); |
@@ -973,7 +976,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
973 | error = xfs_attr_leaf_to_node(args); | 976 | error = xfs_attr_leaf_to_node(args); |
974 | if (!error) { | 977 | if (!error) { |
975 | error = xfs_bmap_finish(&args->trans, args->flist, | 978 | error = xfs_bmap_finish(&args->trans, args->flist, |
976 | *args->firstblock, &committed); | 979 | &committed); |
977 | } | 980 | } |
978 | if (error) { | 981 | if (error) { |
979 | ASSERT(committed); | 982 | ASSERT(committed); |
@@ -1074,7 +1077,6 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
1074 | if (!error) { | 1077 | if (!error) { |
1075 | error = xfs_bmap_finish(&args->trans, | 1078 | error = xfs_bmap_finish(&args->trans, |
1076 | args->flist, | 1079 | args->flist, |
1077 | *args->firstblock, | ||
1078 | &committed); | 1080 | &committed); |
1079 | } | 1081 | } |
1080 | if (error) { | 1082 | if (error) { |
@@ -1152,7 +1154,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) | |||
1152 | /* bp is gone due to xfs_da_shrink_inode */ | 1154 | /* bp is gone due to xfs_da_shrink_inode */ |
1153 | if (!error) { | 1155 | if (!error) { |
1154 | error = xfs_bmap_finish(&args->trans, args->flist, | 1156 | error = xfs_bmap_finish(&args->trans, args->flist, |
1155 | *args->firstblock, &committed); | 1157 | &committed); |
1156 | } | 1158 | } |
1157 | if (error) { | 1159 | if (error) { |
1158 | ASSERT(committed); | 1160 | ASSERT(committed); |
@@ -1307,7 +1309,6 @@ restart: | |||
1307 | if (!error) { | 1309 | if (!error) { |
1308 | error = xfs_bmap_finish(&args->trans, | 1310 | error = xfs_bmap_finish(&args->trans, |
1309 | args->flist, | 1311 | args->flist, |
1310 | *args->firstblock, | ||
1311 | &committed); | 1312 | &committed); |
1312 | } | 1313 | } |
1313 | if (error) { | 1314 | if (error) { |
@@ -1347,7 +1348,7 @@ restart: | |||
1347 | error = xfs_da_split(state); | 1348 | error = xfs_da_split(state); |
1348 | if (!error) { | 1349 | if (!error) { |
1349 | error = xfs_bmap_finish(&args->trans, args->flist, | 1350 | error = xfs_bmap_finish(&args->trans, args->flist, |
1350 | *args->firstblock, &committed); | 1351 | &committed); |
1351 | } | 1352 | } |
1352 | if (error) { | 1353 | if (error) { |
1353 | ASSERT(committed); | 1354 | ASSERT(committed); |
@@ -1459,7 +1460,6 @@ restart: | |||
1459 | if (!error) { | 1460 | if (!error) { |
1460 | error = xfs_bmap_finish(&args->trans, | 1461 | error = xfs_bmap_finish(&args->trans, |
1461 | args->flist, | 1462 | args->flist, |
1462 | *args->firstblock, | ||
1463 | &committed); | 1463 | &committed); |
1464 | } | 1464 | } |
1465 | if (error) { | 1465 | if (error) { |
@@ -1594,7 +1594,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1594 | error = xfs_da_join(state); | 1594 | error = xfs_da_join(state); |
1595 | if (!error) { | 1595 | if (!error) { |
1596 | error = xfs_bmap_finish(&args->trans, args->flist, | 1596 | error = xfs_bmap_finish(&args->trans, args->flist, |
1597 | *args->firstblock, &committed); | 1597 | &committed); |
1598 | } | 1598 | } |
1599 | if (error) { | 1599 | if (error) { |
1600 | ASSERT(committed); | 1600 | ASSERT(committed); |
@@ -1646,7 +1646,6 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1646 | if (!error) { | 1646 | if (!error) { |
1647 | error = xfs_bmap_finish(&args->trans, | 1647 | error = xfs_bmap_finish(&args->trans, |
1648 | args->flist, | 1648 | args->flist, |
1649 | *args->firstblock, | ||
1650 | &committed); | 1649 | &committed); |
1651 | } | 1650 | } |
1652 | if (error) { | 1651 | if (error) { |
@@ -2090,7 +2089,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2090 | args->flist, NULL); | 2089 | args->flist, NULL); |
2091 | if (!error) { | 2090 | if (!error) { |
2092 | error = xfs_bmap_finish(&args->trans, args->flist, | 2091 | error = xfs_bmap_finish(&args->trans, args->flist, |
2093 | *args->firstblock, &committed); | 2092 | &committed); |
2094 | } | 2093 | } |
2095 | if (error) { | 2094 | if (error) { |
2096 | ASSERT(committed); | 2095 | ASSERT(committed); |
@@ -2246,7 +2245,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2246 | NULL, &done); | 2245 | NULL, &done); |
2247 | if (!error) { | 2246 | if (!error) { |
2248 | error = xfs_bmap_finish(&args->trans, args->flist, | 2247 | error = xfs_bmap_finish(&args->trans, args->flist, |
2249 | *args->firstblock, &committed); | 2248 | &committed); |
2250 | } | 2249 | } |
2251 | if (error) { | 2250 | if (error) { |
2252 | ASSERT(committed); | 2251 | ASSERT(committed); |
@@ -2477,7 +2476,7 @@ posix_acl_default_exists( | |||
2477 | return xfs_acl_vhasacl_default(vp); | 2476 | return xfs_acl_vhasacl_default(vp); |
2478 | } | 2477 | } |
2479 | 2478 | ||
2480 | STATIC struct attrnames posix_acl_access = { | 2479 | static struct attrnames posix_acl_access = { |
2481 | .attr_name = "posix_acl_access", | 2480 | .attr_name = "posix_acl_access", |
2482 | .attr_namelen = sizeof("posix_acl_access") - 1, | 2481 | .attr_namelen = sizeof("posix_acl_access") - 1, |
2483 | .attr_get = posix_acl_access_get, | 2482 | .attr_get = posix_acl_access_get, |
@@ -2486,7 +2485,7 @@ STATIC struct attrnames posix_acl_access = { | |||
2486 | .attr_exists = posix_acl_access_exists, | 2485 | .attr_exists = posix_acl_access_exists, |
2487 | }; | 2486 | }; |
2488 | 2487 | ||
2489 | STATIC struct attrnames posix_acl_default = { | 2488 | static struct attrnames posix_acl_default = { |
2490 | .attr_name = "posix_acl_default", | 2489 | .attr_name = "posix_acl_default", |
2491 | .attr_namelen = sizeof("posix_acl_default") - 1, | 2490 | .attr_namelen = sizeof("posix_acl_default") - 1, |
2492 | .attr_get = posix_acl_default_get, | 2491 | .attr_get = posix_acl_default_get, |
@@ -2495,7 +2494,7 @@ STATIC struct attrnames posix_acl_default = { | |||
2495 | .attr_exists = posix_acl_default_exists, | 2494 | .attr_exists = posix_acl_default_exists, |
2496 | }; | 2495 | }; |
2497 | 2496 | ||
2498 | STATIC struct attrnames *attr_system_names[] = | 2497 | static struct attrnames *attr_system_names[] = |
2499 | { &posix_acl_access, &posix_acl_default }; | 2498 | { &posix_acl_access, &posix_acl_default }; |
2500 | 2499 | ||
2501 | 2500 | ||