public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/26] add generic btree types
@ 2008-08-04  1:32 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2008-08-04  1:32 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-btree-add-generic-types --]
[-- Type: text/plain, Size: 1374 bytes --]

Add generic union types for btree pointers, keys and records.  The generic
btree pointer contains a 32 and 64bit big endian type for short and long
form btrees, and the key and record contain the relevant type for each
possible btree.

Split out from a bigger patch from Dave Chinner and simplified a little
further.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6-xfs/fs/xfs/xfs_btree.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_btree.h	2008-08-02 04:01:46.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_btree.h	2008-08-02 04:04:16.000000000 +0200
@@ -79,6 +79,31 @@ typedef struct xfs_btree_block {
 	} bb_u;				/* rest */
 } xfs_btree_block_t;
 
+ /*
+  * Generic key, ptr and record wrapper structures.
+  *
+  * These are disk format structures, and are converted where necessary
+  * by the btree specific code that needs to interpret them.
+  */
+union xfs_btree_ptr {
+	__be32			s;	/* short form ptr */
+	__be64			l;	/* long form ptr */
+};
+
+union xfs_btree_key {
+	xfs_bmbt_key_t		bmbt;
+	xfs_bmdr_key_t		bmbr;	/* bmbt root block */
+	xfs_alloc_key_t		alloc;
+	xfs_inobt_key_t		inobt;
+};
+
+union xfs_btree_rec {
+	xfs_bmbt_rec_t		bmbt;
+	xfs_bmdr_rec_t		bmbr;	/* bmbt root block */
+	xfs_alloc_rec_t		alloc;
+	xfs_inobt_rec_t		inobt;
+};
+
 /*
  * For logging record fields.
  */

-- 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-04  1:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-04  1:32 [PATCH 03/26] add generic btree types Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox