diff options
author | Mark Fasheh <mfasheh@suse.com> | 2008-11-12 19:27:44 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-04-03 14:39:15 -0400 |
commit | 9b7895efac906d66d19856194e1ba61f37e231a4 (patch) | |
tree | 1ee6d2630cf3617251638170dcaceef41ddda8ec /fs/ocfs2/journal.c | |
parent | 4a12ca3a00a244e1fd1e673d151ea38b71e11d55 (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/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 4c8f3557fe93..a70d49da2ceb 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -484,6 +484,22 @@ static struct ocfs2_triggers dq_triggers = { | |||
484 | }, | 484 | }, |
485 | }; | 485 | }; |
486 | 486 | ||
487 | static struct ocfs2_triggers dr_triggers = { | ||
488 | .ot_triggers = { | ||
489 | .t_commit = ocfs2_commit_trigger, | ||
490 | .t_abort = ocfs2_abort_trigger, | ||
491 | }, | ||
492 | .ot_offset = offsetof(struct ocfs2_dx_root_block, dr_check), | ||
493 | }; | ||
494 | |||
495 | static struct ocfs2_triggers dl_triggers = { | ||
496 | .ot_triggers = { | ||
497 | .t_commit = ocfs2_commit_trigger, | ||
498 | .t_abort = ocfs2_abort_trigger, | ||
499 | }, | ||
500 | .ot_offset = offsetof(struct ocfs2_dx_leaf, dl_check), | ||
501 | }; | ||
502 | |||
487 | static int __ocfs2_journal_access(handle_t *handle, | 503 | static int __ocfs2_journal_access(handle_t *handle, |
488 | struct inode *inode, | 504 | struct inode *inode, |
489 | struct buffer_head *bh, | 505 | struct buffer_head *bh, |
@@ -588,6 +604,20 @@ int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, | |||
588 | type); | 604 | type); |
589 | } | 605 | } |
590 | 606 | ||
607 | int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, | ||
608 | struct buffer_head *bh, int type) | ||
609 | { | ||
610 | return __ocfs2_journal_access(handle, inode, bh, &dr_triggers, | ||
611 | type); | ||
612 | } | ||
613 | |||
614 | int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, | ||
615 | struct buffer_head *bh, int type) | ||
616 | { | ||
617 | return __ocfs2_journal_access(handle, inode, bh, &dl_triggers, | ||
618 | type); | ||
619 | } | ||
620 | |||
591 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, | 621 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, |
592 | struct buffer_head *bh, int type) | 622 | struct buffer_head *bh, int type) |
593 | { | 623 | { |