X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fafs%2Fdir.c;h=4acd0413405568c6d6f9623bbdfd755637574b14;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=94afb7590ed233f8b4b6e4f27d0fb2eaf4c6d3ba;hpb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;p=linux-2.6.git diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 94afb7590..4acd04134 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -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 = kmap_atomic(page, KM_USER0); + dbuf = page_address(page); 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: - kunmap_atomic(dbuf, KM_USER0); + SetPageChecked(page); SetPageError(page); } /* end afs_dir_check_page() */ @@ -170,6 +170,7 @@ 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() */ @@ -187,9 +188,11 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index) 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; - afs_dir_check_page(dir, page); + if (!PageChecked(page)) + afs_dir_check_page(dir, page); if (PageError(page)) goto fail; } @@ -208,8 +211,8 @@ static int afs_dir_open(struct inode *inode, struct file *file) { _enter("{%lu}", inode->i_ino); - BUG_ON(sizeof(union afs_dir_block) != 2048); - BUG_ON(sizeof(union afs_dirent) != 32); + BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048); + BUILD_BUG_ON(sizeof(union afs_dirent) != 32); if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED) return -ENOENT; @@ -354,7 +357,7 @@ static int afs_dir_iterate(struct inode *dir, unsigned *fpos, void *cookie, limit = blkoff & ~(PAGE_SIZE - 1); - dbuf = kmap_atomic(page, KM_USER0); + dbuf = page_address(page); /* deal with the individual blocks stashed on this page */ do { @@ -363,7 +366,6 @@ 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; } @@ -372,7 +374,6 @@ 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; } @@ -391,10 +392,10 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir) unsigned fpos; int ret; - _enter("{%Ld,{%lu}}", file->f_pos, file->f_dentry->d_inode->i_ino); + _enter("{%Ld,{%lu}}", file->f_pos, file->f_path.dentry->d_inode->i_ino); fpos = file->f_pos; - ret = afs_dir_iterate(file->f_dentry->d_inode, &fpos, cookie, filldir); + ret = afs_dir_iterate(file->f_path.dentry->d_inode, &fpos, cookie, filldir); file->f_pos = fpos; _leave(" = %d", ret); @@ -445,8 +446,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry, _enter("{%lu},%p{%s}", dir->i_ino, dentry, dentry->d_name.name); /* insanity checks first */ - BUG_ON(sizeof(union afs_dir_block) != 2048); - BUG_ON(sizeof(union afs_dirent) != 32); + BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048); + BUILD_BUG_ON(sizeof(union afs_dirent) != 32); if (dentry->d_name.len > 255) { _leave(" = -ENAMETOOLONG");