patch-2.3.24 linux/fs/smbfs/cache.c
Next file: linux/include/asm-i386/io.h
Previous file: linux/fs/romfs/inode.c
Back to the patch index
Back to the overall index
- Lines: 107
- Date:
Tue Oct 26 13:59:41 1999
- Orig file:
v2.3.23/linux/fs/smbfs/cache.c
- Orig date:
Fri Oct 15 15:25:14 1999
diff -u --recursive --new-file v2.3.23/linux/fs/smbfs/cache.c linux/fs/smbfs/cache.c
@@ -43,16 +43,16 @@
* the page if it isn't in memory. As I understand it the rest of the
* smb-cache code assumes we return a locked page.
*/
-unsigned long
-get_cached_page(struct inode * inode, unsigned long offset, int new)
+static unsigned long
+get_cached_page(struct address_space *mapping, unsigned long offset, int new)
{
struct page * page;
struct page ** hash;
unsigned long new_page;
again:
- hash = page_hash(inode, offset);
- page = __find_lock_page(inode, offset, hash);
+ hash = page_hash(mapping, offset);
+ page = __find_lock_page(mapping, offset, hash);
if(!page && new) {
/* not in cache, alloc a new page */
new_page = page_cache_alloc();
@@ -60,7 +60,7 @@
return 0;
clear_page(new_page); /* smb code assumes pages are zeroed */
page = page_cache_entry(new_page);
- if (add_to_page_cache_unique(page, inode, offset, hash)) {
+ if (add_to_page_cache_unique(page, mapping, offset, hash)) {
/* Hmm, a page has materialized in the
cache. Fine. Go back and get that page
instead ... throwing away this one first. */
@@ -75,10 +75,10 @@
return page_address(page);
}
-static inline struct inode *
+static inline struct address_space *
get_cache_inode(struct cache_head *cachep)
{
- return (mem_map + MAP_NR((unsigned long) cachep))->inode;
+ return (mem_map + MAP_NR((unsigned long) cachep))->mapping;
}
/*
@@ -89,14 +89,14 @@
struct cache_head *
smb_get_dircache(struct dentry * dentry)
{
- struct inode * inode = dentry->d_inode;
+ struct address_space * mapping = &dentry->d_inode->i_data;
struct cache_head * cachep;
#ifdef SMBFS_DEBUG_VERBOSE
printk("smb_get_dircache: finding cache for %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
#endif
- cachep = (struct cache_head *) get_cached_page(inode, 0, 1);
+ cachep = (struct cache_head *) get_cached_page(mapping, 0, 1);
if (!cachep)
goto out;
if (cachep->valid)
@@ -118,7 +118,7 @@
dentry->d_parent->d_name.name, dentry->d_name.name);
#endif
offset = PAGE_SIZE + (i << PAGE_SHIFT);
- block = (struct cache_block *) get_cached_page(inode,
+ block = (struct cache_block *) get_cached_page(mapping,
offset, 0);
if (!block)
goto out;
@@ -187,7 +187,7 @@
smb_add_to_cache(struct cache_head * cachep, struct cache_dirent *entry,
off_t fpos)
{
- struct inode * inode = get_cache_inode(cachep);
+ struct address_space * mapping = get_cache_inode(cachep);
struct cache_index * index;
struct cache_block * block;
unsigned long page_off;
@@ -195,8 +195,8 @@
unsigned int needed = len + sizeof(struct cache_entry);
#ifdef SMBFS_DEBUG_VERBOSE
-printk("smb_add_to_cache: cache inode %p, status %d, adding ",
- inode, cachep->status);
+printk("smb_add_to_cache: cache %p, status %d, adding ",
+ mapping, cachep->status);
printk_name(entry->name, entry->len);
printk(" at %ld\n", fpos);
#endif
@@ -251,14 +251,14 @@
get_block:
cachep->pages++;
page_off = PAGE_SIZE + (cachep->idx << PAGE_SHIFT);
- block = (struct cache_block *) get_cached_page(inode, page_off, 1);
+ block = (struct cache_block *) get_cached_page(mapping, page_off, 1);
if (block)
{
index->block = block;
index->space = PAGE_SIZE;
#ifdef SMBFS_DEBUG_VERBOSE
-printk("smb_add_to_cache: inode=%p, pages=%d, block at %ld\n",
-inode, cachep->pages, page_off);
+printk("smb_add_to_cache: mapping=%p, pages=%d, block at %ld\n",
+mapping, cachep->pages, page_off);
#endif
goto add_entry;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)