Pull platform-drivers into test branch
[powerpc.git] / fs / ext4 / dir.c
index ec114d7..da80368 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <linux/fs.h>
-#include <linux/jbd.h>
+#include <linux/jbd2.h>
 #include <linux/ext4_fs.h>
 #include <linux/buffer_head.h>
 #include <linux/smp_lock.h>
@@ -103,7 +103,7 @@ static int ext4_readdir(struct file * filp,
        struct ext4_dir_entry_2 *de;
        struct super_block *sb;
        int err;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = filp->f_path.dentry->d_inode;
        int ret = 0;
 
        sb = inode->i_sb;
@@ -122,7 +122,7 @@ static int ext4_readdir(struct file * filp,
                 * We don't set the inode dirty flag since it's not
                 * critical that it get flushed back to the disk.
                 */
-               EXT4_I(filp->f_dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
+               EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
        }
 #endif
        stored = 0;
@@ -134,8 +134,7 @@ static int ext4_readdir(struct file * filp,
                struct buffer_head *bh = NULL;
 
                map_bh.b_state = 0;
-               err = ext4_get_blocks_handle(NULL, inode, blk, 1,
-                                               &map_bh, 0, 0);
+               err = ext4_get_blocks_wrap(NULL, inode, blk, 1, &map_bh, 0, 0);
                if (err > 0) {
                        page_cache_readahead(sb->s_bdev->bd_inode->i_mapping,
                                &filp->f_ra,
@@ -154,6 +153,9 @@ static int ext4_readdir(struct file * filp,
                        ext4_error (sb, "ext4_readdir",
                                "directory #%lu contains a hole at offset %lu",
                                inode->i_ino, (unsigned long)filp->f_pos);
+                       /* corrupt size?  Maybe no more blocks to read */
+                       if (filp->f_pos > inode->i_blocks << 9)
+                               break;
                        filp->f_pos += sb->s_blocksize - offset;
                        continue;
                }
@@ -189,8 +191,9 @@ revalidate:
                        de = (struct ext4_dir_entry_2 *) (bh->b_data + offset);
                        if (!ext4_check_dir_entry ("ext4_readdir", inode, de,
                                                   bh, offset)) {
-                               /* On error, skip the f_pos to the
-                                   next block. */
+                               /*
+                                * On error, skip the f_pos to the next block
+                                */
                                filp->f_pos = (filp->f_pos |
                                                (sb->s_blocksize - 1)) + 1;
                                brelse (bh);
@@ -399,7 +402,7 @@ static int call_filldir(struct file * filp, void * dirent,
 {
        struct dir_private_info *info = filp->private_data;
        loff_t  curr_pos;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = filp->f_path.dentry->d_inode;
        struct super_block * sb;
        int error;
 
@@ -429,7 +432,7 @@ static int ext4_dx_readdir(struct file * filp,
                         void * dirent, filldir_t filldir)
 {
        struct dir_private_info *info = filp->private_data;
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = filp->f_path.dentry->d_inode;
        struct fname *fname;
        int     ret;
 
@@ -509,7 +512,7 @@ finished:
 
 static int ext4_release_dir (struct inode * inode, struct file * filp)
 {
-       if (filp->private_data)
+       if (filp->private_data)
                ext4_htree_free_dir_info(filp->private_data);
 
        return 0;