diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-09-10 20:50:51 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-10-12 14:54:37 -0400 |
commit | 5eae5b96fc86e6c85f5f90e90fe9e6966f1fec63 (patch) | |
tree | f9ab0815a6b0ee9c181a17e304abb8386bd09843 /fs/ocfs2/dir.c | |
parent | 7e8536797d4508ddc790cc3af6a281db1582d485 (diff) |
ocfs2: Remove open coded readdir()
ocfs2_queue_orphans() has an open coded readdir loop which can easily just
use a directory accessor function.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Reviewed-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r-- | fs/ocfs2/dir.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index dbfa6f66291a..a75c340fc689 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -81,10 +81,10 @@ static int ocfs2_do_extend_dir(struct super_block *sb, | |||
81 | struct ocfs2_alloc_context *meta_ac, | 81 | struct ocfs2_alloc_context *meta_ac, |
82 | struct buffer_head **new_bh); | 82 | struct buffer_head **new_bh); |
83 | 83 | ||
84 | int ocfs2_check_dir_entry(struct inode * dir, | 84 | static int ocfs2_check_dir_entry(struct inode * dir, |
85 | struct ocfs2_dir_entry * de, | 85 | struct ocfs2_dir_entry * de, |
86 | struct buffer_head * bh, | 86 | struct buffer_head * bh, |
87 | unsigned long offset) | 87 | unsigned long offset) |
88 | { | 88 | { |
89 | const char *error_msg = NULL; | 89 | const char *error_msg = NULL; |
90 | const int rlen = le16_to_cpu(de->rec_len); | 90 | const int rlen = le16_to_cpu(de->rec_len); |
@@ -532,6 +532,26 @@ out: | |||
532 | } | 532 | } |
533 | 533 | ||
534 | /* | 534 | /* |
535 | * This is intended to be called from inside other kernel functions, | ||
536 | * so we fake some arguments. | ||
537 | */ | ||
538 | int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, | ||
539 | filldir_t filldir) | ||
540 | { | ||
541 | int ret = 0; | ||
542 | unsigned long version = inode->i_version; | ||
543 | |||
544 | while (*f_pos < i_size_read(inode)) { | ||
545 | ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv, | ||
546 | filldir); | ||
547 | if (ret) | ||
548 | break; | ||
549 | } | ||
550 | |||
551 | return 0; | ||
552 | } | ||
553 | |||
554 | /* | ||
535 | * ocfs2_readdir() | 555 | * ocfs2_readdir() |
536 | * | 556 | * |
537 | */ | 557 | */ |