summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-05 12:13:21 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-05 12:13:21 -0400
commit7fcde0e3298c00ee18e2ae7f01c67f99133ef7be (patch)
tree61aea37ce9e0e78762459e6fd4b3a2155d892e7f /fs/btrfs/ctree.h
parent5f26f772e5c4e833ffcb0599f54deda466d2a3e5 (diff)
downloadop-kernel-dev-7fcde0e3298c00ee18e2ae7f01c67f99133ef7be.zip
op-kernel-dev-7fcde0e3298c00ee18e2ae7f01c67f99133ef7be.tar.gz
Btrfs: finish off inode indexing in dirs, add overflows
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 61d7b47..794f7e4 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -270,6 +270,10 @@ struct btrfs_root {
#define BTRFS_KEY_TYPE_MAX 256
#define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
+#define BTRFS_KEY_OVERFLOW_MAX 128
+#define BTRFS_KEY_OVERFLOW_SHIFT 8
+#define BTRFS_KEY_OVERFLOW_MASK (0x7FULL << BTRFS_KEY_OVERFLOW_SHIFT)
+
/*
* inode items have the data typically returned from stat and store other
* info about object characteristics. There is one for every file and dir in
@@ -588,6 +592,19 @@ static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key *disk,
disk->flags = cpu_to_le32(val);
}
+static inline u32 btrfs_key_overflow(struct btrfs_key *key)
+{
+ u32 over = key->flags & BTRFS_KEY_OVERFLOW_MASK;
+ return over >> BTRFS_KEY_OVERFLOW_SHIFT;
+}
+
+static inline void btrfs_set_key_overflow(struct btrfs_key *key, u32 over)
+{
+ BUG_ON(over > BTRFS_KEY_OVERFLOW_MAX);
+ over = over << BTRFS_KEY_OVERFLOW_SHIFT;
+ key->flags = (key->flags & ~((u64)BTRFS_KEY_OVERFLOW_MASK)) | over;
+}
+
static inline u32 btrfs_key_type(struct btrfs_key *key)
{
return key->flags & BTRFS_KEY_TYPE_MASK;
@@ -612,6 +629,22 @@ static inline void btrfs_set_disk_key_type(struct btrfs_disk_key *key, u32 type)
btrfs_set_disk_key_flags(key, flags);
}
+static inline u32 btrfs_disk_key_overflow(struct btrfs_disk_key *key)
+{
+ u32 over = le32_to_cpu(key->flags) & BTRFS_KEY_OVERFLOW_MASK;
+ return over >> BTRFS_KEY_OVERFLOW_SHIFT;
+}
+
+static inline void btrfs_set_disK_key_overflow(struct btrfs_disk_key *key,
+ u32 over)
+{
+ u32 flags = btrfs_disk_key_flags(key);
+ BUG_ON(over > BTRFS_KEY_OVERFLOW_MAX);
+ over = over << BTRFS_KEY_OVERFLOW_SHIFT;
+ flags = (flags & ~((u64)BTRFS_KEY_OVERFLOW_MASK)) | over;
+ btrfs_set_disk_key_flags(key, flags);
+}
+
static inline u64 btrfs_header_blocknr(struct btrfs_header *h)
{
return le64_to_cpu(h->blocknr);
OpenPOWER on IntegriCloud