diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:57:40 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:57:40 -0400 |
commit | 4b22a57188d87e873346b73c227607715be96399 (patch) | |
tree | 4cf2d0deede695968b7a32b098c0c64fac8610e5 /fs/xfs/xfs_btree.h | |
parent | ea77b0a66e6c910ef265d9af522d6303ea6b3055 (diff) |
[XFS] implement generic xfs_btree_insert/insrec
Make the btree insert code generic. Based on a patch from David Chinner
with lots of changes to follow the original btree implementations more
closely. While this loses some of the generic helper routines for
inserting/moving/removing records it also solves some of the one off bugs
in the original code and makes it easier to verify.
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32202a
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_btree.h')
-rw-r--r-- | fs/xfs/xfs_btree.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h index 21eec863f00f..6f03871f5995 100644 --- a/fs/xfs/xfs_btree.h +++ b/fs/xfs/xfs_btree.h | |||
@@ -186,6 +186,8 @@ struct xfs_btree_ops { | |||
186 | 186 | ||
187 | /* cursor operations */ | 187 | /* cursor operations */ |
188 | struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *); | 188 | struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *); |
189 | void (*update_cursor)(struct xfs_btree_cur *src, | ||
190 | struct xfs_btree_cur *dst); | ||
189 | 191 | ||
190 | /* update btree root pointer */ | 192 | /* update btree root pointer */ |
191 | void (*set_root)(struct xfs_btree_cur *cur, | 193 | void (*set_root)(struct xfs_btree_cur *cur, |
@@ -206,9 +208,16 @@ struct xfs_btree_ops { | |||
206 | /* records in block/level */ | 208 | /* records in block/level */ |
207 | int (*get_maxrecs)(struct xfs_btree_cur *cur, int level); | 209 | int (*get_maxrecs)(struct xfs_btree_cur *cur, int level); |
208 | 210 | ||
211 | /* records on disk. Matter for the root in inode case. */ | ||
212 | int (*get_dmaxrecs)(struct xfs_btree_cur *cur, int level); | ||
213 | |||
209 | /* init values of btree structures */ | 214 | /* init values of btree structures */ |
210 | void (*init_key_from_rec)(union xfs_btree_key *key, | 215 | void (*init_key_from_rec)(union xfs_btree_key *key, |
211 | union xfs_btree_rec *rec); | 216 | union xfs_btree_rec *rec); |
217 | void (*init_rec_from_key)(union xfs_btree_key *key, | ||
218 | union xfs_btree_rec *rec); | ||
219 | void (*init_rec_from_cur)(struct xfs_btree_cur *cur, | ||
220 | union xfs_btree_rec *rec); | ||
212 | void (*init_ptr_from_cur)(struct xfs_btree_cur *cur, | 221 | void (*init_ptr_from_cur)(struct xfs_btree_cur *cur, |
213 | union xfs_btree_ptr *ptr); | 222 | union xfs_btree_ptr *ptr); |
214 | 223 | ||
@@ -240,6 +249,7 @@ struct xfs_btree_ops { | |||
240 | * Reasons for the update_lastrec method to be called. | 249 | * Reasons for the update_lastrec method to be called. |
241 | */ | 250 | */ |
242 | #define LASTREC_UPDATE 0 | 251 | #define LASTREC_UPDATE 0 |
252 | #define LASTREC_INSREC 1 | ||
243 | 253 | ||
244 | 254 | ||
245 | /* | 255 | /* |
@@ -549,6 +559,7 @@ int xfs_btree_split(struct xfs_btree_cur *, int, union xfs_btree_ptr *, | |||
549 | union xfs_btree_key *, struct xfs_btree_cur **, int *); | 559 | union xfs_btree_key *, struct xfs_btree_cur **, int *); |
550 | int xfs_btree_new_root(struct xfs_btree_cur *, int *); | 560 | int xfs_btree_new_root(struct xfs_btree_cur *, int *); |
551 | int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *); | 561 | int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *); |
562 | int xfs_btree_insert(struct xfs_btree_cur *, int *); | ||
552 | 563 | ||
553 | /* | 564 | /* |
554 | * Helpers. | 565 | * Helpers. |