diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:56:09 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:56:09 -0400 |
commit | fe033cc848489851f0c7de48f0b1bab5d744ad8a (patch) | |
tree | f69709f4e9c125c528a699c32f439b53ea0969f3 /fs/xfs/xfs_alloc.c | |
parent | 8df4da4a0a642d3a016028c0d922bcb4d5a4a6d7 (diff) |
[XFS] implement generic xfs_btree_lookup
From: Dave Chinner <dgc@sgi.com>
[hch: split out from bigger patch and minor adaptions]
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32192a
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 | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 7ca6903e2354..6bda0ae26c2a 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -90,6 +90,54 @@ STATIC int xfs_alloc_ag_vextent_small(xfs_alloc_arg_t *, | |||
90 | */ | 90 | */ |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Lookup the record equal to [bno, len] in the btree given by cur. | ||
94 | */ | ||
95 | STATIC int /* error */ | ||
96 | xfs_alloc_lookup_eq( | ||
97 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
98 | xfs_agblock_t bno, /* starting block of extent */ | ||
99 | xfs_extlen_t len, /* length of extent */ | ||
100 | int *stat) /* success/failure */ | ||
101 | { | ||
102 | cur->bc_rec.a.ar_startblock = bno; | ||
103 | cur->bc_rec.a.ar_blockcount = len; | ||
104 | return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Lookup the first record greater than or equal to [bno, len] | ||
109 | * in the btree given by cur. | ||
110 | */ | ||
111 | STATIC int /* error */ | ||
112 | xfs_alloc_lookup_ge( | ||
113 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
114 | xfs_agblock_t bno, /* starting block of extent */ | ||
115 | xfs_extlen_t len, /* length of extent */ | ||
116 | int *stat) /* success/failure */ | ||
117 | { | ||
118 | cur->bc_rec.a.ar_startblock = bno; | ||
119 | cur->bc_rec.a.ar_blockcount = len; | ||
120 | return xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * Lookup the first record less than or equal to [bno, len] | ||
125 | * in the btree given by cur. | ||
126 | */ | ||
127 | STATIC int /* error */ | ||
128 | xfs_alloc_lookup_le( | ||
129 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
130 | xfs_agblock_t bno, /* starting block of extent */ | ||
131 | xfs_extlen_t len, /* length of extent */ | ||
132 | int *stat) /* success/failure */ | ||
133 | { | ||
134 | cur->bc_rec.a.ar_startblock = bno; | ||
135 | cur->bc_rec.a.ar_blockcount = len; | ||
136 | return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat); | ||
137 | } | ||
138 | |||
139 | |||
140 | /* | ||
93 | * Compute aligned version of the found extent. | 141 | * Compute aligned version of the found extent. |
94 | * Takes alignment and min length into account. | 142 | * Takes alignment and min length into account. |
95 | */ | 143 | */ |