aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 01:58:11 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 01:58:11 -0400
commit8cc938fe4237e50bea4aa557ed53b06de2319d49 (patch)
tree1b9dd352d423a573d96d5b1b311286a39232ef5b /fs/xfs/xfs_alloc_btree.c
parent91cca5df9bc85efdabfa645f51d54259ed09f4bf (diff)
[XFS] implement generic xfs_btree_get_rec
Not really much reason to make it generic given that it's so small, but this is the last non-method in xfs_alloc_btree.c and xfs_ialloc_btree.c, so it makes the whole btree implementation more structured. SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32206a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Bill O'Donnell <billodo@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_alloc_btree.c')
-rw-r--r--fs/xfs/xfs_alloc_btree.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index d256b51f913d..4d44f03858b0 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -41,50 +41,6 @@
41#include "xfs_error.h" 41#include "xfs_error.h"
42 42
43 43
44/*
45 * Get the data from the pointed-to record.
46 */
47int /* error */
48xfs_alloc_get_rec(
49 xfs_btree_cur_t *cur, /* btree cursor */
50 xfs_agblock_t *bno, /* output: starting block of extent */
51 xfs_extlen_t *len, /* output: length of extent */
52 int *stat) /* output: success/failure */
53{
54 xfs_alloc_block_t *block; /* btree block */
55#ifdef DEBUG
56 int error; /* error return value */
57#endif
58 int ptr; /* record number */
59
60 ptr = cur->bc_ptrs[0];
61 block = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[0]);
62#ifdef DEBUG
63 if ((error = xfs_btree_check_sblock(cur, block, 0, cur->bc_bufs[0])))
64 return error;
65#endif
66 /*
67 * Off the right end or left end, return failure.
68 */
69 if (ptr > be16_to_cpu(block->bb_numrecs) || ptr <= 0) {
70 *stat = 0;
71 return 0;
72 }
73 /*
74 * Point to the record and extract its data.
75 */
76 {
77 xfs_alloc_rec_t *rec; /* record data */
78
79 rec = XFS_ALLOC_REC_ADDR(block, ptr, cur);
80 *bno = be32_to_cpu(rec->ar_startblock);
81 *len = be32_to_cpu(rec->ar_blockcount);
82 }
83 *stat = 1;
84 return 0;
85}
86
87
88STATIC struct xfs_btree_cur * 44STATIC struct xfs_btree_cur *
89xfs_allocbt_dup_cursor( 45xfs_allocbt_dup_cursor(
90 struct xfs_btree_cur *cur) 46 struct xfs_btree_cur *cur)