aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2_fs.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-24 20:02:08 -0500
committerMark Fasheh <mfasheh@suse.com>2009-04-03 14:39:16 -0400
commit4ed8a6bb083bfcc21f1ed66a474b03c0386e4b34 (patch)
tree89cc2629bed3949e980edcae3d807e71718a9028 /fs/ocfs2/ocfs2_fs.h
parent9b7895efac906d66d19856194e1ba61f37e231a4 (diff)
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 {
815 * length de_num_used */ 815 * length de_num_used */
816}; 816};
817 817
818#define OCFS2_DX_FLAG_INLINE 0x01
819
818/* 820/*
819 * A directory indexing block. Each indexed directory has one of these, 821 * A directory indexing block. Each indexed directory has one of these,
820 * pointed to by ocfs2_dinode. 822 * pointed to by ocfs2_dinode.
@@ -835,13 +837,21 @@ struct ocfs2_dx_root_block {
835 * extent block */ 837 * extent block */
836 __le32 dr_clusters; /* Clusters allocated 838 __le32 dr_clusters; /* Clusters allocated
837 * to the indexed tree. */ 839 * to the indexed tree. */
838 __le32 dr_reserved1; 840 __u8 dr_flags; /* OCFS2_DX_FLAG_* flags */
841 __u8 dr_reserved0;
842 __le16 dr_reserved1;
839 __le64 dr_dir_blkno; /* Pointer to parent inode */ 843 __le64 dr_dir_blkno; /* Pointer to parent inode */
840 __le64 dr_reserved2; 844 __le64 dr_reserved2;
841 __le64 dr_reserved3[16]; 845 __le64 dr_reserved3[16];
842 struct ocfs2_extent_list dr_list; /* Keep this aligned to 128 846 union {
843 * bits for maximum space 847 struct ocfs2_extent_list dr_list; /* Keep this aligned to 128
844 * efficiency. */ 848 * bits for maximum space
849 * efficiency. */
850 struct ocfs2_dx_entry_list dr_entries; /* In-root-block list of
851 * entries. We grow out
852 * to extents if this
853 * gets too big. */
854 };
845}; 855};
846 856
847/* 857/*
@@ -1228,6 +1238,16 @@ static inline int ocfs2_dx_entries_per_leaf(struct super_block *sb)
1228 return size / sizeof(struct ocfs2_dx_entry); 1238 return size / sizeof(struct ocfs2_dx_entry);
1229} 1239}
1230 1240
1241static inline int ocfs2_dx_entries_per_root(struct super_block *sb)
1242{
1243 int size;
1244
1245 size = sb->s_blocksize -
1246 offsetof(struct ocfs2_dx_root_block, dr_entries.de_entries);
1247
1248 return size / sizeof(struct ocfs2_dx_entry);
1249}
1250
1231static inline u16 ocfs2_local_alloc_size(struct super_block *sb) 1251static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
1232{ 1252{
1233 u16 size; 1253 u16 size;