#define CACHES_MASK CACHES_SIZE - 1
static struct list_head presto_caches[CACHES_SIZE];
-static inline int presto_cache_hash(kdev_t dev)
+static inline int presto_cache_hash(struct super_block *sb)
{
- return (CACHES_MASK) & ((0x000F & (kdev_val(dev))) + ((0x0F00 & (kdev_val(dev))) >>8));
+ return (CACHES_MASK) & ((unsigned long)sb / L1_CACHE_BYTES);
}
-inline void presto_cache_add(struct presto_cache *cache, kdev_t dev)
+inline void presto_cache_add(struct presto_cache *cache, struct super_block *sb)
{
list_add(&cache->cache_chain,
- &presto_caches[presto_cache_hash(dev)]);
- cache->cache_dev = dev;
+ &presto_caches[presto_cache_hash(sb)]);
}
inline void presto_init_cache_hash(void)
}
/* map a device to a cache */
-struct presto_cache *presto_find_cache(kdev_t dev)
+struct presto_cache *presto_find_cache(struct super_block *sb)
{
struct presto_cache *cache;
struct list_head *lh, *tmp;
- lh = tmp = &(presto_caches[presto_cache_hash(dev)]);
+ lh = tmp = &(presto_caches[presto_cache_hash(sb)]);
while ( (tmp = lh->next) != lh ) {
cache = list_entry(tmp, struct presto_cache, cache_chain);
- if ( kdev_same(cache->cache_dev, dev) ) {
+ if (cache->cache_sb == sb)
return cache;
- }
}
return NULL;
}
struct presto_cache *cache;
/* find the correct presto_cache here, based on the device */
- cache = presto_find_cache(inode->i_dev);
+ cache = presto_find_cache(inode->i_sb);
if ( !cache ) {
- printk("WARNING: no presto cache for dev %x, ino %ld\n",
- kdev_val(inode->i_dev), inode->i_ino);
+ printk("WARNING: no presto cache for dev %s, ino %ld\n",
+ inode->i_sb->s_id, inode->i_ino);
EXIT;
return NULL;
}
cache = presto_get_cache(inode);
if ( !cache )
return 0;
- return (kdev_same(inode->i_dev, cache->cache_dev));
+ return (inode->i_sb == cache->cache_sb);
}
/* setup a cache structure when we need one */
#endif
extern struct presto_cache *presto_init_cache(void);
-extern inline void presto_cache_add(struct presto_cache *cache, kdev_t dev);
+extern inline void presto_cache_add(struct presto_cache *cache, struct super_block *sb);
extern inline void presto_init_cache_hash(void);
int presto_remount(struct super_block *, int *, char *);
filter_setup_journal_ops(cache->cache_filter, cache->cache_type);
/* we now know the dev of the cache: hash the cache */
- presto_cache_add(cache, mysb->s_dev);
+ presto_cache_add(cache, mysb);
/* make sure we have our own super operations: mysb
still contains the cache operations */
}
}
- cache = presto_find_cache(sb->s_dev);
+ cache = presto_find_cache(sb);
if (!cache) {
printk(__FUNCTION__ ": cannot find cache on remount\n");
err = -ENODEV;
goto exit_lock;
error = -EXDEV;
- if (!kdev_same(dir->d_inode->i_dev, inode->i_dev))
+ if (dir->d_inode->i_sb != inode->i_sb)
goto exit_lock;
/*
if (error)
return error;
- if (!kdev_same(new_dir->i_dev, old_dir->i_dev))
+ if (new_dir->i_sb != old_dir->i_sb)
return -EXDEV;
if (!new_dentry->d_inode)
if (error)
return error;
- if (!kdev_same(new_dir->i_dev, old_dir->i_dev))
+ if (new_dir->i_sb != old_dir->i_sb)
return -EXDEV;
if (!new_dentry->d_inode)
};
/* super.c */
-struct presto_cache *presto_find_cache(kdev_t dev) ;
+struct presto_cache *presto_find_cache(struct super_block *sb) ;
extern struct file_system_type presto_fs_type;
extern int init_intermezzo_fs(void);
int cache_flags;
char *cache_root_fileset; /* fileset mounted on cache "/" */
- kdev_t cache_dev; /* underlying block device */
struct super_block *cache_sb;
struct dentry *cache_mtde; /* unix mtpt of cache XXX NOT VALID XXX */
char *cache_mtpt; /* again */