Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / fs / afs / dir.c
index a6dff6a..94afb75 100644 (file)
@@ -30,7 +30,7 @@ static int afs_dir_readdir(struct file *file, void *dirent, filldir_t filldir);
 static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd);
 static int afs_d_delete(struct dentry *dentry);
 static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
-                                 loff_t fpos, ino_t ino, unsigned dtype);
+                                 loff_t fpos, u64 ino, unsigned dtype);
 
 const struct file_operations afs_dir_file_operations = {
        .open           = afs_dir_open,
@@ -145,7 +145,7 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
        qty /= sizeof(union afs_dir_block);
 
        /* check them */
-       dbuf = page_address(page);
+       dbuf = kmap_atomic(page, KM_USER0);
        for (tmp = 0; tmp < qty; tmp++) {
                if (dbuf->blocks[tmp].pagehdr.magic != AFS_DIR_MAGIC) {
                        printk("kAFS: %s(%lu): bad magic %d/%d is %04hx\n",
@@ -154,12 +154,12 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
                        goto error;
                }
        }
+       kunmap_atomic(dbuf, KM_USER0);
 
-       SetPageChecked(page);
        return;
 
  error:
-       SetPageChecked(page);
+       kunmap_atomic(dbuf, KM_USER0);
        SetPageError(page);
 
 } /* end afs_dir_check_page() */
@@ -170,7 +170,6 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
  */
 static inline void afs_dir_put_page(struct page *page)
 {
-       kunmap(page);
        page_cache_release(page);
 
 } /* end afs_dir_put_page() */
@@ -185,16 +184,12 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index)
 
        _enter("{%lu},%lu", dir->i_ino, index);
 
-       page = read_cache_page(dir->i_mapping,index,
-                              (filler_t *) dir->i_mapping->a_ops->readpage,
-                              NULL);
+       page = read_mapping_page(dir->i_mapping, index, NULL);
        if (!IS_ERR(page)) {
                wait_on_page_locked(page);
-               kmap(page);
                if (!PageUptodate(page))
                        goto fail;
-               if (!PageChecked(page))
-                       afs_dir_check_page(dir, page);
+               afs_dir_check_page(dir, page);
                if (PageError(page))
                        goto fail;
        }
@@ -359,7 +354,7 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
 
                limit = blkoff & ~(PAGE_SIZE - 1);
 
-               dbuf = page_address(page);
+               dbuf = kmap_atomic(page, KM_USER0);
 
                /* deal with the individual blocks stashed on this page */
                do {
@@ -368,6 +363,7 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
                        ret = afs_dir_iterate_block(fpos, dblock, blkoff,
                                                    cookie, filldir);
                        if (ret != 1) {
+                               kunmap_atomic(dbuf, KM_USER0);
                                afs_dir_put_page(page);
                                goto out;
                        }
@@ -376,6 +372,7 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie,
 
                } while (*fpos < dir->i_size && blkoff < limit);
 
+               kunmap_atomic(dbuf, KM_USER0);
                afs_dir_put_page(page);
                ret = 0;
        }
@@ -411,7 +408,7 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir)
  *   uniquifier through dtype
  */
 static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
-                                 loff_t fpos, ino_t ino, unsigned dtype)
+                                 loff_t fpos, u64 ino, unsigned dtype)
 {
        struct afs_dir_lookup_cookie *cookie = _cookie;