diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_attr.c | 117 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 39 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 28 |
4 files changed, 90 insertions, 99 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index a41ad3a5e554..ce9f673f2b4c 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -200,40 +200,18 @@ xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp, | |||
200 | return(error); | 200 | return(error); |
201 | } | 201 | } |
202 | 202 | ||
203 | /*ARGSUSED*/ | 203 | int |
204 | int /* error */ | 204 | xfs_attr_set_int(xfs_inode_t *dp, char *name, int namelen, |
205 | xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags, | 205 | char *value, int valuelen, int flags) |
206 | struct cred *cred) | ||
207 | { | 206 | { |
208 | xfs_da_args_t args; | 207 | xfs_da_args_t args; |
209 | xfs_inode_t *dp; | ||
210 | xfs_fsblock_t firstblock; | 208 | xfs_fsblock_t firstblock; |
211 | xfs_bmap_free_t flist; | 209 | xfs_bmap_free_t flist; |
212 | int error, err2, committed; | 210 | int error, err2, committed; |
213 | int local, size; | 211 | int local, size; |
214 | uint nblks; | 212 | uint nblks; |
215 | xfs_mount_t *mp; | 213 | xfs_mount_t *mp = dp->i_mount; |
216 | int rsvd = (flags & ATTR_ROOT) != 0; | 214 | int rsvd = (flags & ATTR_ROOT) != 0; |
217 | int namelen; | ||
218 | |||
219 | namelen = strlen(name); | ||
220 | if (namelen >= MAXNAMELEN) | ||
221 | return EFAULT; /* match IRIX behaviour */ | ||
222 | |||
223 | XFS_STATS_INC(xs_attr_set); | ||
224 | |||
225 | dp = XFS_BHVTOI(bdp); | ||
226 | mp = dp->i_mount; | ||
227 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
228 | return (EIO); | ||
229 | |||
230 | xfs_ilock(dp, XFS_ILOCK_SHARED); | ||
231 | if (!(flags & ATTR_SECURE) && | ||
232 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
233 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
234 | return(XFS_ERROR(error)); | ||
235 | } | ||
236 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
237 | 215 | ||
238 | /* | 216 | /* |
239 | * Attach the dquots to the inode. | 217 | * Attach the dquots to the inode. |
@@ -270,7 +248,8 @@ xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags, | |||
270 | /* Determine space new attribute will use, and if it will be inline | 248 | /* Determine space new attribute will use, and if it will be inline |
271 | * or out of line. | 249 | * or out of line. |
272 | */ | 250 | */ |
273 | size = xfs_attr_leaf_newentsize(&args, mp->m_sb.sb_blocksize, &local); | 251 | size = xfs_attr_leaf_newentsize(namelen, valuelen, |
252 | mp->m_sb.sb_blocksize, &local); | ||
274 | 253 | ||
275 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); | 254 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); |
276 | if (local) { | 255 | if (local) { |
@@ -456,32 +435,21 @@ out: | |||
456 | return(error); | 435 | return(error); |
457 | } | 436 | } |
458 | 437 | ||
459 | /* | 438 | int |
460 | * Generic handler routine to remove a name from an attribute list. | 439 | xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags, |
461 | * Transitions attribute list from Btree to shortform as necessary. | 440 | struct cred *cred) |
462 | */ | ||
463 | /*ARGSUSED*/ | ||
464 | int /* error */ | ||
465 | xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred) | ||
466 | { | 441 | { |
467 | xfs_da_args_t args; | 442 | xfs_inode_t *dp; |
468 | xfs_inode_t *dp; | 443 | int namelen, error; |
469 | xfs_fsblock_t firstblock; | ||
470 | xfs_bmap_free_t flist; | ||
471 | int error; | ||
472 | xfs_mount_t *mp; | ||
473 | int namelen; | ||
474 | 444 | ||
475 | ASSERT(MAXNAMELEN-1<=0xff); /* length is stored in uint8 */ | ||
476 | namelen = strlen(name); | 445 | namelen = strlen(name); |
477 | if (namelen>=MAXNAMELEN) | 446 | if (namelen >= MAXNAMELEN) |
478 | return EFAULT; /* match irix behaviour */ | 447 | return EFAULT; /* match IRIX behaviour */ |
479 | 448 | ||
480 | XFS_STATS_INC(xs_attr_remove); | 449 | XFS_STATS_INC(xs_attr_set); |
481 | 450 | ||
482 | dp = XFS_BHVTOI(bdp); | 451 | dp = XFS_BHVTOI(bdp); |
483 | mp = dp->i_mount; | 452 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
484 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
485 | return (EIO); | 453 | return (EIO); |
486 | 454 | ||
487 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 455 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
@@ -489,14 +457,25 @@ xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred) | |||
489 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | 457 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { |
490 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 458 | xfs_iunlock(dp, XFS_ILOCK_SHARED); |
491 | return(XFS_ERROR(error)); | 459 | return(XFS_ERROR(error)); |
492 | } else if (XFS_IFORK_Q(dp) == 0 || | ||
493 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && | ||
494 | dp->i_d.di_anextents == 0)) { | ||
495 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
496 | return(XFS_ERROR(ENOATTR)); | ||
497 | } | 460 | } |
498 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 461 | xfs_iunlock(dp, XFS_ILOCK_SHARED); |
499 | 462 | ||
463 | return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); | ||
464 | } | ||
465 | |||
466 | /* | ||
467 | * Generic handler routine to remove a name from an attribute list. | ||
468 | * Transitions attribute list from Btree to shortform as necessary. | ||
469 | */ | ||
470 | int | ||
471 | xfs_attr_remove_int(xfs_inode_t *dp, char *name, int namelen, int flags) | ||
472 | { | ||
473 | xfs_da_args_t args; | ||
474 | xfs_fsblock_t firstblock; | ||
475 | xfs_bmap_free_t flist; | ||
476 | int error; | ||
477 | xfs_mount_t *mp = dp->i_mount; | ||
478 | |||
500 | /* | 479 | /* |
501 | * Fill in the arg structure for this request. | 480 | * Fill in the arg structure for this request. |
502 | */ | 481 | */ |
@@ -612,6 +591,38 @@ out: | |||
612 | return(error); | 591 | return(error); |
613 | } | 592 | } |
614 | 593 | ||
594 | int | ||
595 | xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred) | ||
596 | { | ||
597 | xfs_inode_t *dp; | ||
598 | int namelen, error; | ||
599 | |||
600 | namelen = strlen(name); | ||
601 | if (namelen >= MAXNAMELEN) | ||
602 | return EFAULT; /* match IRIX behaviour */ | ||
603 | |||
604 | XFS_STATS_INC(xs_attr_remove); | ||
605 | |||
606 | dp = XFS_BHVTOI(bdp); | ||
607 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | ||
608 | return (EIO); | ||
609 | |||
610 | xfs_ilock(dp, XFS_ILOCK_SHARED); | ||
611 | if (!(flags & ATTR_SECURE) && | ||
612 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
613 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
614 | return(XFS_ERROR(error)); | ||
615 | } else if (XFS_IFORK_Q(dp) == 0 || | ||
616 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && | ||
617 | dp->i_d.di_anextents == 0)) { | ||
618 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
619 | return(XFS_ERROR(ENOATTR)); | ||
620 | } | ||
621 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
622 | |||
623 | return xfs_attr_remove_int(dp, name, namelen, flags); | ||
624 | } | ||
625 | |||
615 | /* | 626 | /* |
616 | * Generate a list of extended attribute names and optionally | 627 | * Generate a list of extended attribute names and optionally |
617 | * also value lengths. Positive return value follows the XFS | 628 | * also value lengths. Positive return value follows the XFS |
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 1cdd574c63a9..e13eaa521436 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -898,7 +898,7 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
898 | ASSERT((args->index >= 0) | 898 | ASSERT((args->index >= 0) |
899 | && (args->index <= INT_GET(leaf->hdr.count, ARCH_CONVERT))); | 899 | && (args->index <= INT_GET(leaf->hdr.count, ARCH_CONVERT))); |
900 | hdr = &leaf->hdr; | 900 | hdr = &leaf->hdr; |
901 | entsize = xfs_attr_leaf_newentsize(args, | 901 | entsize = xfs_attr_leaf_newentsize(args->namelen, args->valuelen, |
902 | args->trans->t_mountp->m_sb.sb_blocksize, NULL); | 902 | args->trans->t_mountp->m_sb.sb_blocksize, NULL); |
903 | 903 | ||
904 | /* | 904 | /* |
@@ -995,13 +995,14 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
995 | mp = args->trans->t_mountp; | 995 | mp = args->trans->t_mountp; |
996 | ASSERT(INT_GET(map->base, ARCH_CONVERT) < XFS_LBSIZE(mp)); | 996 | ASSERT(INT_GET(map->base, ARCH_CONVERT) < XFS_LBSIZE(mp)); |
997 | ASSERT((INT_GET(map->base, ARCH_CONVERT) & 0x3) == 0); | 997 | ASSERT((INT_GET(map->base, ARCH_CONVERT) & 0x3) == 0); |
998 | ASSERT(INT_GET(map->size, ARCH_CONVERT) | 998 | ASSERT(INT_GET(map->size, ARCH_CONVERT) >= |
999 | >= xfs_attr_leaf_newentsize(args, | 999 | xfs_attr_leaf_newentsize(args->namelen, args->valuelen, |
1000 | mp->m_sb.sb_blocksize, NULL)); | 1000 | mp->m_sb.sb_blocksize, NULL)); |
1001 | ASSERT(INT_GET(map->size, ARCH_CONVERT) < XFS_LBSIZE(mp)); | 1001 | ASSERT(INT_GET(map->size, ARCH_CONVERT) < XFS_LBSIZE(mp)); |
1002 | ASSERT((INT_GET(map->size, ARCH_CONVERT) & 0x3) == 0); | 1002 | ASSERT((INT_GET(map->size, ARCH_CONVERT) & 0x3) == 0); |
1003 | INT_MOD(map->size, ARCH_CONVERT, | 1003 | INT_MOD(map->size, ARCH_CONVERT, |
1004 | -xfs_attr_leaf_newentsize(args, mp->m_sb.sb_blocksize, &tmp)); | 1004 | -xfs_attr_leaf_newentsize(args->namelen, args->valuelen, |
1005 | mp->m_sb.sb_blocksize, &tmp)); | ||
1005 | INT_SET(entry->nameidx, ARCH_CONVERT, | 1006 | INT_SET(entry->nameidx, ARCH_CONVERT, |
1006 | INT_GET(map->base, ARCH_CONVERT) | 1007 | INT_GET(map->base, ARCH_CONVERT) |
1007 | + INT_GET(map->size, ARCH_CONVERT)); | 1008 | + INT_GET(map->size, ARCH_CONVERT)); |
@@ -1357,8 +1358,10 @@ xfs_attr_leaf_figure_balance(xfs_da_state_t *state, | |||
1357 | half = (max+1) * sizeof(*entry); | 1358 | half = (max+1) * sizeof(*entry); |
1358 | half += INT_GET(hdr1->usedbytes, ARCH_CONVERT) | 1359 | half += INT_GET(hdr1->usedbytes, ARCH_CONVERT) |
1359 | + INT_GET(hdr2->usedbytes, ARCH_CONVERT) | 1360 | + INT_GET(hdr2->usedbytes, ARCH_CONVERT) |
1360 | + xfs_attr_leaf_newentsize(state->args, | 1361 | + xfs_attr_leaf_newentsize( |
1361 | state->blocksize, NULL); | 1362 | state->args->namelen, |
1363 | state->args->valuelen, | ||
1364 | state->blocksize, NULL); | ||
1362 | half /= 2; | 1365 | half /= 2; |
1363 | lastdelta = state->blocksize; | 1366 | lastdelta = state->blocksize; |
1364 | entry = &leaf1->entries[0]; | 1367 | entry = &leaf1->entries[0]; |
@@ -1370,9 +1373,10 @@ xfs_attr_leaf_figure_balance(xfs_da_state_t *state, | |||
1370 | */ | 1373 | */ |
1371 | if (count == blk1->index) { | 1374 | if (count == blk1->index) { |
1372 | tmp = totallen + sizeof(*entry) + | 1375 | tmp = totallen + sizeof(*entry) + |
1373 | xfs_attr_leaf_newentsize(state->args, | 1376 | xfs_attr_leaf_newentsize( |
1374 | state->blocksize, | 1377 | state->args->namelen, |
1375 | NULL); | 1378 | state->args->valuelen, |
1379 | state->blocksize, NULL); | ||
1376 | if (XFS_ATTR_ABS(half - tmp) > lastdelta) | 1380 | if (XFS_ATTR_ABS(half - tmp) > lastdelta) |
1377 | break; | 1381 | break; |
1378 | lastdelta = XFS_ATTR_ABS(half - tmp); | 1382 | lastdelta = XFS_ATTR_ABS(half - tmp); |
@@ -1408,9 +1412,10 @@ xfs_attr_leaf_figure_balance(xfs_da_state_t *state, | |||
1408 | totallen -= count * sizeof(*entry); | 1412 | totallen -= count * sizeof(*entry); |
1409 | if (foundit) { | 1413 | if (foundit) { |
1410 | totallen -= sizeof(*entry) + | 1414 | totallen -= sizeof(*entry) + |
1411 | xfs_attr_leaf_newentsize(state->args, | 1415 | xfs_attr_leaf_newentsize( |
1412 | state->blocksize, | 1416 | state->args->namelen, |
1413 | NULL); | 1417 | state->args->valuelen, |
1418 | state->blocksize, NULL); | ||
1414 | } | 1419 | } |
1415 | 1420 | ||
1416 | *countarg = count; | 1421 | *countarg = count; |
@@ -2253,17 +2258,17 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) | |||
2253 | * a "local" or a "remote" attribute. | 2258 | * a "local" or a "remote" attribute. |
2254 | */ | 2259 | */ |
2255 | int | 2260 | int |
2256 | xfs_attr_leaf_newentsize(xfs_da_args_t *args, int blocksize, int *local) | 2261 | xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) |
2257 | { | 2262 | { |
2258 | int size; | 2263 | int size; |
2259 | 2264 | ||
2260 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(args->namelen, args->valuelen); | 2265 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(namelen, valuelen); |
2261 | if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) { | 2266 | if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) { |
2262 | if (local) { | 2267 | if (local) { |
2263 | *local = 1; | 2268 | *local = 1; |
2264 | } | 2269 | } |
2265 | } else { | 2270 | } else { |
2266 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(args->namelen); | 2271 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(namelen); |
2267 | if (local) { | 2272 | if (local) { |
2268 | *local = 0; | 2273 | *local = 0; |
2269 | } | 2274 | } |
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 0a4cfad6df91..b99f0491061c 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000, 2002-2003, 2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * under the terms of version 2 of the GNU General Public License as |
@@ -289,7 +290,7 @@ int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); | |||
289 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); | 290 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); |
290 | int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, | 291 | int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, |
291 | struct xfs_dabuf *leaf2_bp); | 292 | struct xfs_dabuf *leaf2_bp); |
292 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int blocksize, | 293 | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, |
293 | int *local); | 294 | int *local); |
294 | int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); | 295 | int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); |
295 | 296 | ||
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 8b792ddf2164..8e2597b1a029 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License as | 5 | * under the terms of version 2 of the GNU General Public License as |
@@ -190,9 +190,6 @@ xfs_da_split(xfs_da_state_t *state) | |||
190 | */ | 190 | */ |
191 | switch (oldblk->magic) { | 191 | switch (oldblk->magic) { |
192 | case XFS_ATTR_LEAF_MAGIC: | 192 | case XFS_ATTR_LEAF_MAGIC: |
193 | #ifndef __KERNEL__ | ||
194 | return(ENOTTY); | ||
195 | #else | ||
196 | error = xfs_attr_leaf_split(state, oldblk, newblk); | 193 | error = xfs_attr_leaf_split(state, oldblk, newblk); |
197 | if ((error != 0) && (error != ENOSPC)) { | 194 | if ((error != 0) && (error != ENOSPC)) { |
198 | return(error); /* GROT: attr is inconsistent */ | 195 | return(error); /* GROT: attr is inconsistent */ |
@@ -218,7 +215,6 @@ xfs_da_split(xfs_da_state_t *state) | |||
218 | return(error); /* GROT: attr inconsistent */ | 215 | return(error); /* GROT: attr inconsistent */ |
219 | addblk = newblk; | 216 | addblk = newblk; |
220 | break; | 217 | break; |
221 | #endif | ||
222 | case XFS_DIR_LEAF_MAGIC: | 218 | case XFS_DIR_LEAF_MAGIC: |
223 | ASSERT(XFS_DIR_IS_V1(state->mp)); | 219 | ASSERT(XFS_DIR_IS_V1(state->mp)); |
224 | error = xfs_dir_leaf_split(state, oldblk, newblk); | 220 | error = xfs_dir_leaf_split(state, oldblk, newblk); |
@@ -706,18 +702,12 @@ xfs_da_join(xfs_da_state_t *state) | |||
706 | */ | 702 | */ |
707 | switch (drop_blk->magic) { | 703 | switch (drop_blk->magic) { |
708 | case XFS_ATTR_LEAF_MAGIC: | 704 | case XFS_ATTR_LEAF_MAGIC: |
709 | #ifndef __KERNEL__ | ||
710 | error = ENOTTY; | ||
711 | #else | ||
712 | error = xfs_attr_leaf_toosmall(state, &action); | 705 | error = xfs_attr_leaf_toosmall(state, &action); |
713 | #endif | ||
714 | if (error) | 706 | if (error) |
715 | return(error); | 707 | return(error); |
716 | if (action == 0) | 708 | if (action == 0) |
717 | return(0); | 709 | return(0); |
718 | #ifdef __KERNEL__ | ||
719 | xfs_attr_leaf_unbalance(state, drop_blk, save_blk); | 710 | xfs_attr_leaf_unbalance(state, drop_blk, save_blk); |
720 | #endif | ||
721 | break; | 711 | break; |
722 | case XFS_DIR_LEAF_MAGIC: | 712 | case XFS_DIR_LEAF_MAGIC: |
723 | ASSERT(XFS_DIR_IS_V1(state->mp)); | 713 | ASSERT(XFS_DIR_IS_V1(state->mp)); |
@@ -973,13 +963,11 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) | |||
973 | level = path->active-1; | 963 | level = path->active-1; |
974 | blk = &path->blk[ level ]; | 964 | blk = &path->blk[ level ]; |
975 | switch (blk->magic) { | 965 | switch (blk->magic) { |
976 | #ifdef __KERNEL__ | ||
977 | case XFS_ATTR_LEAF_MAGIC: | 966 | case XFS_ATTR_LEAF_MAGIC: |
978 | lasthash = xfs_attr_leaf_lasthash(blk->bp, &count); | 967 | lasthash = xfs_attr_leaf_lasthash(blk->bp, &count); |
979 | if (count == 0) | 968 | if (count == 0) |
980 | return; | 969 | return; |
981 | break; | 970 | break; |
982 | #endif | ||
983 | case XFS_DIR_LEAF_MAGIC: | 971 | case XFS_DIR_LEAF_MAGIC: |
984 | ASSERT(XFS_DIR_IS_V1(state->mp)); | 972 | ASSERT(XFS_DIR_IS_V1(state->mp)); |
985 | lasthash = xfs_dir_leaf_lasthash(blk->bp, &count); | 973 | lasthash = xfs_dir_leaf_lasthash(blk->bp, &count); |
@@ -1220,12 +1208,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1220 | blkno = INT_GET(btree->before, ARCH_CONVERT); | 1208 | blkno = INT_GET(btree->before, ARCH_CONVERT); |
1221 | } | 1209 | } |
1222 | } | 1210 | } |
1223 | #ifdef __KERNEL__ | ||
1224 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) { | 1211 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) { |
1225 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); | 1212 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); |
1226 | break; | 1213 | break; |
1227 | } | 1214 | } |
1228 | #endif | ||
1229 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) { | 1215 | else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) { |
1230 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL); | 1216 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL); |
1231 | break; | 1217 | break; |
@@ -1252,13 +1238,11 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1252 | retval = xfs_dir2_leafn_lookup_int(blk->bp, args, | 1238 | retval = xfs_dir2_leafn_lookup_int(blk->bp, args, |
1253 | &blk->index, state); | 1239 | &blk->index, state); |
1254 | } | 1240 | } |
1255 | #ifdef __KERNEL__ | ||
1256 | else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { | 1241 | else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { |
1257 | retval = xfs_attr_leaf_lookup_int(blk->bp, args); | 1242 | retval = xfs_attr_leaf_lookup_int(blk->bp, args); |
1258 | blk->index = args->index; | 1243 | blk->index = args->index; |
1259 | args->blkno = blk->blkno; | 1244 | args->blkno = blk->blkno; |
1260 | } | 1245 | } |
1261 | #endif | ||
1262 | if (((retval == ENOENT) || (retval == ENOATTR)) && | 1246 | if (((retval == ENOENT) || (retval == ENOATTR)) && |
1263 | (blk->hashval == args->hashval)) { | 1247 | (blk->hashval == args->hashval)) { |
1264 | error = xfs_da_path_shift(state, &state->path, 1, 1, | 1248 | error = xfs_da_path_shift(state, &state->path, 1, 1, |
@@ -1268,12 +1252,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) | |||
1268 | if (retval == 0) { | 1252 | if (retval == 0) { |
1269 | continue; | 1253 | continue; |
1270 | } | 1254 | } |
1271 | #ifdef __KERNEL__ | ||
1272 | else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { | 1255 | else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { |
1273 | /* path_shift() gives ENOENT */ | 1256 | /* path_shift() gives ENOENT */ |
1274 | retval = XFS_ERROR(ENOATTR); | 1257 | retval = XFS_ERROR(ENOATTR); |
1275 | } | 1258 | } |
1276 | #endif | ||
1277 | } | 1259 | } |
1278 | break; | 1260 | break; |
1279 | } | 1261 | } |
@@ -1312,11 +1294,9 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, | |||
1312 | ASSERT(old_blk->magic == new_blk->magic); | 1294 | ASSERT(old_blk->magic == new_blk->magic); |
1313 | 1295 | ||
1314 | switch (old_blk->magic) { | 1296 | switch (old_blk->magic) { |
1315 | #ifdef __KERNEL__ | ||
1316 | case XFS_ATTR_LEAF_MAGIC: | 1297 | case XFS_ATTR_LEAF_MAGIC: |
1317 | before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp); | 1298 | before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp); |
1318 | break; | 1299 | break; |
1319 | #endif | ||
1320 | case XFS_DIR_LEAF_MAGIC: | 1300 | case XFS_DIR_LEAF_MAGIC: |
1321 | ASSERT(XFS_DIR_IS_V1(state->mp)); | 1301 | ASSERT(XFS_DIR_IS_V1(state->mp)); |
1322 | before = xfs_dir_leaf_order(old_blk->bp, new_blk->bp); | 1302 | before = xfs_dir_leaf_order(old_blk->bp, new_blk->bp); |
@@ -1587,12 +1567,10 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |||
1587 | ASSERT(level == path->active-1); | 1567 | ASSERT(level == path->active-1); |
1588 | blk->index = 0; | 1568 | blk->index = 0; |
1589 | switch(blk->magic) { | 1569 | switch(blk->magic) { |
1590 | #ifdef __KERNEL__ | ||
1591 | case XFS_ATTR_LEAF_MAGIC: | 1570 | case XFS_ATTR_LEAF_MAGIC: |
1592 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, | 1571 | blk->hashval = xfs_attr_leaf_lasthash(blk->bp, |
1593 | NULL); | 1572 | NULL); |
1594 | break; | 1573 | break; |
1595 | #endif | ||
1596 | case XFS_DIR_LEAF_MAGIC: | 1574 | case XFS_DIR_LEAF_MAGIC: |
1597 | ASSERT(XFS_DIR_IS_V1(state->mp)); | 1575 | ASSERT(XFS_DIR_IS_V1(state->mp)); |
1598 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, | 1576 | blk->hashval = xfs_dir_leaf_lasthash(blk->bp, |
@@ -2200,20 +2178,16 @@ xfs_da_do_buf( | |||
2200 | error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); | 2178 | error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); |
2201 | break; | 2179 | break; |
2202 | case 1: | 2180 | case 1: |
2203 | #ifndef __KERNEL__ | ||
2204 | case 2: | 2181 | case 2: |
2205 | #endif | ||
2206 | bp = NULL; | 2182 | bp = NULL; |
2207 | error = xfs_trans_read_buf(mp, trans, mp->m_ddev_targp, | 2183 | error = xfs_trans_read_buf(mp, trans, mp->m_ddev_targp, |
2208 | mappedbno, nmapped, 0, &bp); | 2184 | mappedbno, nmapped, 0, &bp); |
2209 | break; | 2185 | break; |
2210 | #ifdef __KERNEL__ | ||
2211 | case 3: | 2186 | case 3: |
2212 | xfs_baread(mp->m_ddev_targp, mappedbno, nmapped); | 2187 | xfs_baread(mp->m_ddev_targp, mappedbno, nmapped); |
2213 | error = 0; | 2188 | error = 0; |
2214 | bp = NULL; | 2189 | bp = NULL; |
2215 | break; | 2190 | break; |
2216 | #endif | ||
2217 | } | 2191 | } |
2218 | if (error) { | 2192 | if (error) { |
2219 | if (bp) | 2193 | if (bp) |