public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: xfs@oss.sgi.com
Subject: [PATCH 02/21] add generic btree types
Date: Tue, 29 Jul 2008 21:30:12 +0200	[thread overview]
Message-ID: <20080729193012.GC19104@lst.de> (raw)

[-- Attachment #1: xfs-btree-add-generic-types --]
[-- Type: text/plain, Size: 1580 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-07-14 17:26:11.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_btree.h	2008-07-14 17:27:59.000000000 +0200
@@ -70,6 +70,12 @@ typedef struct xfs_btree_hdr
 	__be16		bb_numrecs;	/* current # of data records */
 } xfs_btree_hdr_t;
 
+/*
+ * Generic block, key, ptr and record wrapper structures
+ * These are disk format structures, and are converted where
+ * necessary be the btree specific code that needs to interpret
+ * them.
+ */
 typedef struct xfs_btree_block {
 	xfs_btree_hdr_t	bb_h;		/* header */
 	union {
@@ -84,6 +90,25 @@ typedef struct xfs_btree_block {
 	} bb_u;				/* rest */
 } xfs_btree_block_t;
 
+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.
  */

-- 

                 reply	other threads:[~2008-07-29 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080729193012.GC19104@lst.de \
    --to=hch@lst.de \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox