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_alloc.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_alloc.c')
-rw-r--r-- | fs/xfs/xfs_alloc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index e9c70249d2c5..54fa69e27761 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -155,6 +155,27 @@ xfs_alloc_update( | |||
155 | } | 155 | } |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * Get the data from the pointed-to record. | ||
159 | */ | ||
160 | STATIC int /* error */ | ||
161 | xfs_alloc_get_rec( | ||
162 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
163 | xfs_agblock_t *bno, /* output: starting block of extent */ | ||
164 | xfs_extlen_t *len, /* output: length of extent */ | ||
165 | int *stat) /* output: success/failure */ | ||
166 | { | ||
167 | union xfs_btree_rec *rec; | ||
168 | int error; | ||
169 | |||
170 | error = xfs_btree_get_rec(cur, &rec, stat); | ||
171 | if (!error && *stat == 1) { | ||
172 | *bno = be32_to_cpu(rec->alloc.ar_startblock); | ||
173 | *len = be32_to_cpu(rec->alloc.ar_blockcount); | ||
174 | } | ||
175 | return error; | ||
176 | } | ||
177 | |||
178 | /* | ||
158 | * Compute aligned version of the found extent. | 179 | * Compute aligned version of the found extent. |
159 | * Takes alignment and min length into account. | 180 | * Takes alignment and min length into account. |
160 | */ | 181 | */ |