summaryrefslogtreecommitdiff
path: root/fs/ocfs2/ocfs2_fs.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-25 04:02:08 +0300
committerMark Fasheh <mfasheh@suse.com>2009-04-03 22:39:16 +0400
commit4ed8a6bb083bfcc21f1ed66a474b03c0386e4b34 (patch)
tree89cc2629bed3949e980edcae3d807e71718a9028 /fs/ocfs2/ocfs2_fs.h
parent9b7895efac906d66d19856194e1ba61f37e231a4 (diff)
downloadlinux-4ed8a6bb083bfcc21f1ed66a474b03c0386e4b34.tar.xz
ocfs2: Store dir index records inline
Allow us to store a small number of directory index records in the ocfs2_dx_root_block. This saves us a disk read on small to medium sized directories (less than about 250 entries). The inline root is automatically turned into a root block with extents if the directory size increases beyond it's capacity. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r--fs/ocfs2/ocfs2_fs.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 036eb03950a3..1d1c54ea5bc4 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -815,6 +815,8 @@ struct ocfs2_dx_entry_list {
* length de_num_used */
};
+#define OCFS2_DX_FLAG_INLINE 0x01
+
/*
* A directory indexing block. Each indexed directory has one of these,
* pointed to by ocfs2_dinode.
@@ -835,13 +837,21 @@ struct ocfs2_dx_root_block {
* extent block */
__le32 dr_clusters; /* Clusters allocated
* to the indexed tree. */
- __le32 dr_reserved1;
+ __u8 dr_flags; /* OCFS2_DX_FLAG_* flags */
+ __u8 dr_reserved0;
+ __le16 dr_reserved1;
__le64 dr_dir_blkno; /* Pointer to parent inode */
__le64 dr_reserved2;
__le64 dr_reserved3[16];
- struct ocfs2_extent_list dr_list; /* Keep this aligned to 128
- * bits for maximum space
- * efficiency. */
+ union {
+ struct ocfs2_extent_list dr_list; /* Keep this aligned to 128
+ * bits for maximum space
+ * efficiency. */
+ struct ocfs2_dx_entry_list dr_entries; /* In-root-block list of
+ * entries. We grow out
+ * to extents if this
+ * gets too big. */
+ };
};
/*
@@ -1228,6 +1238,16 @@ static inline int ocfs2_dx_entries_per_leaf(struct super_block *sb)
return size / sizeof(struct ocfs2_dx_entry);
}
+static inline int ocfs2_dx_entries_per_root(struct super_block *sb)
+{
+ int size;
+
+ size = sb->s_blocksize -
+ offsetof(struct ocfs2_dx_root_block, dr_entries.de_entries);
+
+ return size / sizeof(struct ocfs2_dx_entry);
+}
+
static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
{
u16 size;