diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:56:32 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:56:32 -0400 |
commit | 278d0ca14e889c3932a05d1a68675252a12b3466 (patch) | |
tree | a228d171d4aded60b27639e30eca1bf58ed7daa6 /fs/xfs/xfs_alloc.c | |
parent | 38bb74237d2d94c1aced2ec626d7d0f317e360da (diff) |
[XFS] implement generic xfs_btree_update
From: Dave Chinner <dgc@sgi.com>
The most complicated part here is the lastrec tracking for the alloc
btree. Most logic is in the update_lastrec method which has to do some
hopefully good enough dirty magic to maintain it.
[hch: split out from bigger patch and a rework of the lastrec
logic]
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32194a
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 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 6bda0ae26c2a..875e1bae1941 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -136,6 +136,23 @@ xfs_alloc_lookup_le( | |||
136 | return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat); | 136 | return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat); |
137 | } | 137 | } |
138 | 138 | ||
139 | /* | ||
140 | * Update the record referred to by cur to the value given | ||
141 | * by [bno, len]. | ||
142 | * This either works (return 0) or gets an EFSCORRUPTED error. | ||
143 | */ | ||
144 | STATIC int /* error */ | ||
145 | xfs_alloc_update( | ||
146 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
147 | xfs_agblock_t bno, /* starting block of extent */ | ||
148 | xfs_extlen_t len) /* length of extent */ | ||
149 | { | ||
150 | union xfs_btree_rec rec; | ||
151 | |||
152 | rec.alloc.ar_startblock = cpu_to_be32(bno); | ||
153 | rec.alloc.ar_blockcount = cpu_to_be32(len); | ||
154 | return xfs_btree_update(cur, &rec); | ||
155 | } | ||
139 | 156 | ||
140 | /* | 157 | /* |
141 | * Compute aligned version of the found extent. | 158 | * Compute aligned version of the found extent. |