]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ext3/dir.c
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / fs / ext3 / dir.c
index 665adee99b311fbfce6ada8fb94ee163b4969bc4..c8e4ee3af1d0a7ead446bb5dcf34040db7690138 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/jbd.h>
 #include <linux/ext3_fs.h>
 #include <linux/buffer_head.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/rbtree.h>
 
@@ -48,9 +47,7 @@ const struct file_operations ext3_dir_operations = {
        .compat_ioctl   = ext3_compat_ioctl,
 #endif
        .fsync          = ext3_sync_file,       /* BKL held */
-#ifdef CONFIG_EXT3_INDEX
        .release        = ext3_release_dir,
-#endif
 };
 
 
@@ -108,7 +105,6 @@ static int ext3_readdir(struct file * filp,
 
        sb = inode->i_sb;
 
-#ifdef CONFIG_EXT3_INDEX
        if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
                                    EXT3_FEATURE_COMPAT_DIR_INDEX) &&
            ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
@@ -124,7 +120,6 @@ static int ext3_readdir(struct file * filp,
                 */
                EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
        }
-#endif
        stored = 0;
        offset = filp->f_pos & (sb->s_blocksize - 1);
 
@@ -137,12 +132,14 @@ static int ext3_readdir(struct file * filp,
                err = ext3_get_blocks_handle(NULL, inode, blk, 1,
                                                &map_bh, 0, 0);
                if (err > 0) {
-                       page_cache_readahead(sb->s_bdev->bd_inode->i_mapping,
-                               &filp->f_ra,
-                               filp,
-                               map_bh.b_blocknr >>
-                                       (PAGE_CACHE_SHIFT - inode->i_blkbits),
-                               1);
+                       pgoff_t index = map_bh.b_blocknr >>
+                                       (PAGE_CACHE_SHIFT - inode->i_blkbits);
+                       if (!ra_has_index(&filp->f_ra, index))
+                               page_cache_sync_readahead(
+                                       sb->s_bdev->bd_inode->i_mapping,
+                                       &filp->f_ra, filp,
+                                       index, 1);
+                       filp->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
                        bh = ext3_bread(NULL, inode, blk, 0, &err);
                }
 
@@ -209,7 +206,7 @@ revalidate:
                                 * not the directory has been modified
                                 * during the copy operation.
                                 */
-                               unsigned long version = filp->f_version;
+                               u64 version = filp->f_version;
 
                                error = filldir(dirent, de->name,
                                                de->name_len,
@@ -231,7 +228,6 @@ out:
        return ret;
 }
 
-#ifdef CONFIG_EXT3_INDEX
 /*
  * These functions convert from the major/minor hash to an f_pos
  * value.
@@ -517,5 +513,3 @@ static int ext3_release_dir (struct inode * inode, struct file * filp)
 
        return 0;
 }
-
-#endif