aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-12 19:27:44 -0500
committerMark Fasheh <mfasheh@suse.com>2009-04-03 14:39:15 -0400
commit9b7895efac906d66d19856194e1ba61f37e231a4 (patch)
tree1ee6d2630cf3617251638170dcaceef41ddda8ec /fs/ocfs2/dir.h
parent4a12ca3a00a244e1fd1e673d151ea38b71e11d55 (diff)
ocfs2: Add a name indexed b-tree to directory inodes
This patch makes use of Ocfs2's flexible btree code to add an additional tree to directory inodes. The new tree stores an array of small, fixed-length records in each leaf block. Each record stores a hash value, and pointer to a block in the traditional (unindexed) directory tree where a dirent with the given name hash resides. Lookup exclusively uses this tree to find dirents, thus providing us with constant time name lookups. Some of the hashing code was copied from ext3. Unfortunately, it has lots of unfixed checkpatch errors. I left that as-is so that tracking changes would be easier. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.h')
-rw-r--r--fs/ocfs2/dir.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h
index 505d3af9bba5..d273aaef2ec2 100644
--- a/fs/ocfs2/dir.h
+++ b/fs/ocfs2/dir.h
@@ -26,9 +26,21 @@
26#ifndef OCFS2_DIR_H 26#ifndef OCFS2_DIR_H
27#define OCFS2_DIR_H 27#define OCFS2_DIR_H
28 28
29struct ocfs2_dx_hinfo {
30 u32 major_hash;
31 u32 minor_hash;
32};
33
29struct ocfs2_dir_lookup_result { 34struct ocfs2_dir_lookup_result {
30 struct buffer_head *dl_leaf_bh; 35 struct buffer_head *dl_leaf_bh; /* Unindexed leaf
31 struct ocfs2_dir_entry *dl_entry; 36 * block */
37 struct ocfs2_dir_entry *dl_entry; /* Target dirent in
38 * unindexed leaf */
39
40 struct buffer_head *dl_dx_leaf_bh; /* Indexed leaf block */
41 struct ocfs2_dx_entry *dl_dx_entry; /* Target dx_entry in
42 * indexed leaf */
43 struct ocfs2_dx_hinfo dl_hinfo; /* Name hash results */
32}; 44};
33void ocfs2_free_dir_lookup_result(struct ocfs2_dir_lookup_result *res); 45void ocfs2_free_dir_lookup_result(struct ocfs2_dir_lookup_result *res);
34 46
@@ -85,7 +97,10 @@ int ocfs2_fill_new_dir(struct ocfs2_super *osb,
85 struct inode *parent, 97 struct inode *parent,
86 struct inode *inode, 98 struct inode *inode,
87 struct buffer_head *fe_bh, 99 struct buffer_head *fe_bh,
88 struct ocfs2_alloc_context *data_ac); 100 struct ocfs2_alloc_context *data_ac,
101 struct ocfs2_alloc_context *meta_ac);
102
103int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh);
89 104
90struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize, 105struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize,
91 void *data); 106 void *data);