diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:58:11 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:58:11 -0400 |
commit | 8cc938fe4237e50bea4aa557ed53b06de2319d49 (patch) | |
tree | 1b9dd352d423a573d96d5b1b311286a39232ef5b /fs/xfs/xfs_ialloc_btree.c | |
parent | 91cca5df9bc85efdabfa645f51d54259ed09f4bf (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_ialloc_btree.c')
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c index 6c0a07d1fed3..9f4e33c945c2 100644 --- a/fs/xfs/xfs_ialloc_btree.c +++ b/fs/xfs/xfs_ialloc_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 | */ | ||
47 | int /* error */ | ||
48 | xfs_inobt_get_rec( | ||
49 | xfs_btree_cur_t *cur, /* btree cursor */ | ||
50 | xfs_agino_t *ino, /* output: starting inode of chunk */ | ||
51 | __int32_t *fcnt, /* output: number of free inodes */ | ||
52 | xfs_inofree_t *free, /* output: free inode mask */ | ||
53 | int *stat) /* output: success/failure */ | ||
54 | { | ||
55 | xfs_inobt_block_t *block; /* btree block */ | ||
56 | xfs_buf_t *bp; /* buffer containing btree block */ | ||
57 | #ifdef DEBUG | ||
58 | int error; /* error return value */ | ||
59 | #endif | ||
60 | int ptr; /* record number */ | ||
61 | xfs_inobt_rec_t *rec; /* record data */ | ||
62 | |||
63 | bp = cur->bc_bufs[0]; | ||
64 | ptr = cur->bc_ptrs[0]; | ||
65 | block = XFS_BUF_TO_INOBT_BLOCK(bp); | ||
66 | #ifdef DEBUG | ||
67 | if ((error = xfs_btree_check_sblock(cur, block, 0, bp))) | ||
68 | return error; | ||
69 | #endif | ||
70 | /* | ||
71 | * Off the right end or left end, return failure. | ||
72 | */ | ||
73 | if (ptr > be16_to_cpu(block->bb_numrecs) || ptr <= 0) { | ||
74 | *stat = 0; | ||
75 | return 0; | ||
76 | } | ||
77 | /* | ||
78 | * Point to the record and extract its data. | ||
79 | */ | ||
80 | rec = XFS_INOBT_REC_ADDR(block, ptr, cur); | ||
81 | *ino = be32_to_cpu(rec->ir_startino); | ||
82 | *fcnt = be32_to_cpu(rec->ir_freecount); | ||
83 | *free = be64_to_cpu(rec->ir_free); | ||
84 | *stat = 1; | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | STATIC int | 44 | STATIC int |
89 | xfs_inobt_get_minrecs( | 45 | xfs_inobt_get_minrecs( |
90 | struct xfs_btree_cur *cur, | 46 | struct xfs_btree_cur *cur, |