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_ialloc.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_ialloc.c')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index bbf537f64c41..138651afd44f 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -172,6 +172,26 @@ xfs_inobt_lookup_le( | |||
172 | } | 172 | } |
173 | 173 | ||
174 | /* | 174 | /* |
175 | * Update the record referred to by cur to the value given | ||
176 | * by [ino, fcnt, free]. | ||
177 | * This either works (return 0) or gets an EFSCORRUPTED error. | ||
178 | */ | ||
179 | STATIC int /* error */ | ||
180 | xfs_inobt_update( | ||
181 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
182 | xfs_agino_t ino, /* starting inode of chunk */ | ||
183 | __int32_t fcnt, /* free inode count */ | ||
184 | xfs_inofree_t free) /* free inode mask */ | ||
185 | { | ||
186 | union xfs_btree_rec rec; | ||
187 | |||
188 | rec.inobt.ir_startino = cpu_to_be32(ino); | ||
189 | rec.inobt.ir_freecount = cpu_to_be32(fcnt); | ||
190 | rec.inobt.ir_free = cpu_to_be64(free); | ||
191 | return xfs_btree_update(cur, &rec); | ||
192 | } | ||
193 | |||
194 | /* | ||
175 | * Allocate new inodes in the allocation group specified by agbp. | 195 | * Allocate new inodes in the allocation group specified by agbp. |
176 | * Return 0 for success, else error code. | 196 | * Return 0 for success, else error code. |
177 | */ | 197 | */ |