]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ext4/dir.c
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[linux-2.6-omap-h63xx.git] / fs / ext4 / dir.c
index 3ca6a2b7632dcd987db185d3fbe40926628b3d78..2df2e40b01af0cc031d4546306079c0d4a6669ac 100644 (file)
@@ -64,7 +64,7 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
 int ext4_check_dir_entry(const char *function, struct inode *dir,
                         struct ext4_dir_entry_2 *de,
                         struct buffer_head *bh,
-                        unsigned long offset)
+                        unsigned int offset)
 {
        const char *error_msg = NULL;
        const int rlen = ext4_rec_len_from_disk(de->rec_len);
@@ -84,9 +84,9 @@ int ext4_check_dir_entry(const char *function, struct inode *dir,
        if (error_msg != NULL)
                ext4_error(dir->i_sb, function,
                        "bad entry in directory #%lu: %s - "
-                       "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
+                       "offset=%u, inode=%u, rec_len=%d, name_len=%d",
                        dir->i_ino, error_msg, offset,
-                       (unsigned long) le32_to_cpu(de->inode),
+                       le32_to_cpu(de->inode),
                        rlen, de->name_len);
        return error_msg == NULL ? 1 : 0;
 }
@@ -95,7 +95,7 @@ static int ext4_readdir(struct file *filp,
                         void *dirent, filldir_t filldir)
 {
        int error = 0;
-       unsigned long offset;
+       unsigned int offset;
        int i, stored;
        struct ext4_dir_entry_2 *de;
        struct super_block *sb;
@@ -405,7 +405,7 @@ static int call_filldir(struct file *filp, void *dirent,
        sb = inode->i_sb;
 
        if (!fname) {
-               printk(KERN_ERR "ext4: call_filldir: called with "
+               printk(KERN_ERR "EXT4-fs: call_filldir: called with "
                       "null fname?!?\n");
                return 0;
        }
@@ -459,17 +459,8 @@ static int ext4_dx_readdir(struct file *filp,
        if (info->extra_fname) {
                if (call_filldir(filp, dirent, filldir, info->extra_fname))
                        goto finished;
-
                info->extra_fname = NULL;
-               info->curr_node = rb_next(info->curr_node);
-               if (!info->curr_node) {
-                       if (info->next_hash == ~0) {
-                               filp->f_pos = EXT4_HTREE_EOF;
-                               goto finished;
-                       }
-                       info->curr_hash = info->next_hash;
-                       info->curr_minor_hash = 0;
-               }
+               goto next_node;
        } else if (!info->curr_node)
                info->curr_node = rb_first(&info->root);
 
@@ -501,9 +492,14 @@ static int ext4_dx_readdir(struct file *filp,
                info->curr_minor_hash = fname->minor_hash;
                if (call_filldir(filp, dirent, filldir, fname))
                        break;
-
+       next_node:
                info->curr_node = rb_next(info->curr_node);
-               if (!info->curr_node) {
+               if (info->curr_node) {
+                       fname = rb_entry(info->curr_node, struct fname,
+                                        rb_hash);
+                       info->curr_hash = fname->hash;
+                       info->curr_minor_hash = fname->minor_hash;
+               } else {
                        if (info->next_hash == ~0) {
                                filp->f_pos = EXT4_HTREE_EOF;
                                break;