diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 107 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.h | 8 |
2 files changed, 0 insertions, 115 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 2d702e4a74a3..d384e489705f 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -3467,113 +3467,6 @@ done: | |||
3467 | return error; | 3467 | return error; |
3468 | } | 3468 | } |
3469 | 3469 | ||
3470 | xfs_bmbt_rec_t * /* pointer to found extent entry */ | ||
3471 | xfs_bmap_do_search_extents( | ||
3472 | xfs_bmbt_rec_t *base, /* base of extent list */ | ||
3473 | xfs_extnum_t lastx, /* last extent index used */ | ||
3474 | xfs_extnum_t nextents, /* number of file extents */ | ||
3475 | xfs_fileoff_t bno, /* block number searched for */ | ||
3476 | int *eofp, /* out: end of file found */ | ||
3477 | xfs_extnum_t *lastxp, /* out: last extent index */ | ||
3478 | xfs_bmbt_irec_t *gotp, /* out: extent entry found */ | ||
3479 | xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ | ||
3480 | { | ||
3481 | xfs_bmbt_rec_t *ep; /* extent list entry pointer */ | ||
3482 | xfs_bmbt_irec_t got; /* extent list entry, decoded */ | ||
3483 | int high; /* high index of binary search */ | ||
3484 | int low; /* low index of binary search */ | ||
3485 | |||
3486 | /* | ||
3487 | * Initialize the extent entry structure to catch access to | ||
3488 | * uninitialized br_startblock field. | ||
3489 | */ | ||
3490 | got.br_startoff = 0xffa5a5a5a5a5a5a5LL; | ||
3491 | got.br_blockcount = 0xa55a5a5a5a5a5a5aLL; | ||
3492 | got.br_state = XFS_EXT_INVALID; | ||
3493 | |||
3494 | #if XFS_BIG_BLKNOS | ||
3495 | got.br_startblock = 0xffffa5a5a5a5a5a5LL; | ||
3496 | #else | ||
3497 | got.br_startblock = 0xffffa5a5; | ||
3498 | #endif | ||
3499 | |||
3500 | if (lastx != NULLEXTNUM && lastx < nextents) | ||
3501 | ep = base + lastx; | ||
3502 | else | ||
3503 | ep = NULL; | ||
3504 | prevp->br_startoff = NULLFILEOFF; | ||
3505 | if (ep && bno >= (got.br_startoff = xfs_bmbt_get_startoff(ep)) && | ||
3506 | bno < got.br_startoff + | ||
3507 | (got.br_blockcount = xfs_bmbt_get_blockcount(ep))) | ||
3508 | *eofp = 0; | ||
3509 | else if (ep && lastx < nextents - 1 && | ||
3510 | bno >= (got.br_startoff = xfs_bmbt_get_startoff(ep + 1)) && | ||
3511 | bno < got.br_startoff + | ||
3512 | (got.br_blockcount = xfs_bmbt_get_blockcount(ep + 1))) { | ||
3513 | lastx++; | ||
3514 | ep++; | ||
3515 | *eofp = 0; | ||
3516 | } else if (nextents == 0) | ||
3517 | *eofp = 1; | ||
3518 | else if (bno == 0 && | ||
3519 | (got.br_startoff = xfs_bmbt_get_startoff(base)) == 0) { | ||
3520 | ep = base; | ||
3521 | lastx = 0; | ||
3522 | got.br_blockcount = xfs_bmbt_get_blockcount(ep); | ||
3523 | *eofp = 0; | ||
3524 | } else { | ||
3525 | low = 0; | ||
3526 | high = nextents - 1; | ||
3527 | /* binary search the extents array */ | ||
3528 | while (low <= high) { | ||
3529 | XFS_STATS_INC(xs_cmp_exlist); | ||
3530 | lastx = (low + high) >> 1; | ||
3531 | ep = base + lastx; | ||
3532 | got.br_startoff = xfs_bmbt_get_startoff(ep); | ||
3533 | got.br_blockcount = xfs_bmbt_get_blockcount(ep); | ||
3534 | if (bno < got.br_startoff) | ||
3535 | high = lastx - 1; | ||
3536 | else if (bno >= got.br_startoff + got.br_blockcount) | ||
3537 | low = lastx + 1; | ||
3538 | else { | ||
3539 | got.br_startblock = xfs_bmbt_get_startblock(ep); | ||
3540 | got.br_state = xfs_bmbt_get_state(ep); | ||
3541 | *eofp = 0; | ||
3542 | *lastxp = lastx; | ||
3543 | *gotp = got; | ||
3544 | return ep; | ||
3545 | } | ||
3546 | } | ||
3547 | if (bno >= got.br_startoff + got.br_blockcount) { | ||
3548 | lastx++; | ||
3549 | if (lastx == nextents) { | ||
3550 | *eofp = 1; | ||
3551 | got.br_startblock = xfs_bmbt_get_startblock(ep); | ||
3552 | got.br_state = xfs_bmbt_get_state(ep); | ||
3553 | *prevp = got; | ||
3554 | ep = NULL; | ||
3555 | } else { | ||
3556 | *eofp = 0; | ||
3557 | xfs_bmbt_get_all(ep, prevp); | ||
3558 | ep++; | ||
3559 | got.br_startoff = xfs_bmbt_get_startoff(ep); | ||
3560 | got.br_blockcount = xfs_bmbt_get_blockcount(ep); | ||
3561 | } | ||
3562 | } else { | ||
3563 | *eofp = 0; | ||
3564 | if (ep > base) | ||
3565 | xfs_bmbt_get_all(ep - 1, prevp); | ||
3566 | } | ||
3567 | } | ||
3568 | if (ep) { | ||
3569 | got.br_startblock = xfs_bmbt_get_startblock(ep); | ||
3570 | got.br_state = xfs_bmbt_get_state(ep); | ||
3571 | } | ||
3572 | *lastxp = lastx; | ||
3573 | *gotp = got; | ||
3574 | return ep; | ||
3575 | } | ||
3576 | |||
3577 | /* | 3470 | /* |
3578 | * Search the extent records for the entry containing block bno. | 3471 | * Search the extent records for the entry containing block bno. |
3579 | * If bno lies in a hole, point to the next entry. If bno lies | 3472 | * If bno lies in a hole, point to the next entry. If bno lies |
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h index 011ccaa9a1c0..f83399c89ce3 100644 --- a/fs/xfs/xfs_bmap.h +++ b/fs/xfs/xfs_bmap.h | |||
@@ -362,14 +362,6 @@ xfs_bmbt_rec_t * | |||
362 | xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *, | 362 | xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *, |
363 | xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); | 363 | xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); |
364 | 364 | ||
365 | /* | ||
366 | * Search an extent list for the extent which includes block | ||
367 | * bno. | ||
368 | */ | ||
369 | xfs_bmbt_rec_t *xfs_bmap_do_search_extents(xfs_bmbt_rec_t *, | ||
370 | xfs_extnum_t, xfs_extnum_t, xfs_fileoff_t, int *, | ||
371 | xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); | ||
372 | |||
373 | #endif /* __KERNEL__ */ | 365 | #endif /* __KERNEL__ */ |
374 | 366 | ||
375 | #endif /* __XFS_BMAP_H__ */ | 367 | #endif /* __XFS_BMAP_H__ */ |