diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:53:59 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:53:59 -0400 |
commit | 561f7d17390d00444e6cd0b02b7516c91528082e (patch) | |
tree | 59359b995320bf79a55c2f23305960b5ffe74d8f /fs/xfs/xfs_btree.h | |
parent | f2277f06e626d694e61bb356524ff536ced24acf (diff) |
[XFS] split up xfs_btree_init_cursor
xfs_btree_init_cursor contains close to little shared code for the
different btrees and will get even more non-common code in the future.
Split it up into one routine per btree type.
Because xfs_btree_dup_cursor needs to call the init routine for a generic
btree cursor add a new btree operation vector that contains a dup_cursor
method that initializes a new cursor based on an existing one.
The btree operations vector is based on an idea and code from Dave Chinner
and will grow more entries later during this series.
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32176a
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 | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h index 332b9f1da203..d30ee7498606 100644 --- a/fs/xfs/xfs_btree.h +++ b/fs/xfs/xfs_btree.h | |||
@@ -131,6 +131,11 @@ extern const __uint32_t xfs_magics[]; | |||
131 | 131 | ||
132 | #define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */ | 132 | #define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */ |
133 | 133 | ||
134 | struct xfs_btree_ops { | ||
135 | /* cursor operations */ | ||
136 | struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *); | ||
137 | }; | ||
138 | |||
134 | /* | 139 | /* |
135 | * Btree cursor structure. | 140 | * Btree cursor structure. |
136 | * This collects all information needed by the btree code in one place. | 141 | * This collects all information needed by the btree code in one place. |
@@ -139,6 +144,7 @@ typedef struct xfs_btree_cur | |||
139 | { | 144 | { |
140 | struct xfs_trans *bc_tp; /* transaction we're in, if any */ | 145 | struct xfs_trans *bc_tp; /* transaction we're in, if any */ |
141 | struct xfs_mount *bc_mp; /* file system mount struct */ | 146 | struct xfs_mount *bc_mp; /* file system mount struct */ |
147 | const struct xfs_btree_ops *bc_ops; | ||
142 | union { | 148 | union { |
143 | xfs_alloc_rec_incore_t a; | 149 | xfs_alloc_rec_incore_t a; |
144 | xfs_bmbt_irec_t b; | 150 | xfs_bmbt_irec_t b; |
@@ -308,20 +314,6 @@ xfs_btree_get_bufs( | |||
308 | uint lock); /* lock flags for get_buf */ | 314 | uint lock); /* lock flags for get_buf */ |
309 | 315 | ||
310 | /* | 316 | /* |
311 | * Allocate a new btree cursor. | ||
312 | * The cursor is either for allocation (A) or bmap (B). | ||
313 | */ | ||
314 | xfs_btree_cur_t * /* new btree cursor */ | ||
315 | xfs_btree_init_cursor( | ||
316 | struct xfs_mount *mp, /* file system mount point */ | ||
317 | struct xfs_trans *tp, /* transaction pointer */ | ||
318 | struct xfs_buf *agbp, /* (A only) buffer for agf structure */ | ||
319 | xfs_agnumber_t agno, /* (A only) allocation group number */ | ||
320 | xfs_btnum_t btnum, /* btree identifier */ | ||
321 | struct xfs_inode *ip, /* (B only) inode owning the btree */ | ||
322 | int whichfork); /* (B only) data/attr fork */ | ||
323 | |||
324 | /* | ||
325 | * Check for the cursor referring to the last block at the given level. | 317 | * Check for the cursor referring to the last block at the given level. |
326 | */ | 318 | */ |
327 | int /* 1=is last block, 0=not last block */ | 319 | int /* 1=is last block, 0=not last block */ |