Commit 94982b1e authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (6/7) kdev_t removals

* in intermezzo a bunch of places where we are comparing ->s_dev
  are replaced with comparing pointers to superblocks.
parent 6c4971a8
...@@ -44,16 +44,15 @@ ...@@ -44,16 +44,15 @@
#define CACHES_MASK CACHES_SIZE - 1 #define CACHES_MASK CACHES_SIZE - 1
static struct list_head presto_caches[CACHES_SIZE]; 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, list_add(&cache->cache_chain,
&presto_caches[presto_cache_hash(dev)]); &presto_caches[presto_cache_hash(sb)]);
cache->cache_dev = dev;
} }
inline void presto_init_cache_hash(void) inline void presto_init_cache_hash(void)
...@@ -65,18 +64,17 @@ inline void presto_init_cache_hash(void) ...@@ -65,18 +64,17 @@ inline void presto_init_cache_hash(void)
} }
/* map a device to a cache */ /* 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 presto_cache *cache;
struct list_head *lh, *tmp; 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 ) { while ( (tmp = lh->next) != lh ) {
cache = list_entry(tmp, struct presto_cache, cache_chain); cache = list_entry(tmp, struct presto_cache, cache_chain);
if ( kdev_same(cache->cache_dev, dev) ) { if (cache->cache_sb == sb)
return cache; return cache;
} }
}
return NULL; return NULL;
} }
...@@ -87,10 +85,10 @@ struct presto_cache *presto_get_cache(struct inode *inode) ...@@ -87,10 +85,10 @@ struct presto_cache *presto_get_cache(struct inode *inode)
struct presto_cache *cache; struct presto_cache *cache;
/* find the correct presto_cache here, based on the device */ /* 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 ) { if ( !cache ) {
printk("WARNING: no presto cache for dev %x, ino %ld\n", printk("WARNING: no presto cache for dev %s, ino %ld\n",
kdev_val(inode->i_dev), inode->i_ino); inode->i_sb->s_id, inode->i_ino);
EXIT; EXIT;
return NULL; return NULL;
} }
...@@ -174,7 +172,7 @@ int presto_ispresto(struct inode *inode) ...@@ -174,7 +172,7 @@ int presto_ispresto(struct inode *inode)
cache = presto_get_cache(inode); cache = presto_get_cache(inode);
if ( !cache ) if ( !cache )
return 0; 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 */ /* setup a cache structure when we need one */
......
...@@ -113,7 +113,7 @@ void presto_put_super(struct super_block *sb) ...@@ -113,7 +113,7 @@ void presto_put_super(struct super_block *sb)
struct list_head *lh; struct list_head *lh;
ENTRY; ENTRY;
cache = presto_find_cache(sb->s_dev); cache = presto_find_cache(sb);
if (!cache) { if (!cache) {
EXIT; EXIT;
goto exit; goto exit;
......
...@@ -71,8 +71,8 @@ int presto_i2m(struct inode *inode) ...@@ -71,8 +71,8 @@ int presto_i2m(struct inode *inode)
cache = presto_get_cache(inode); cache = presto_get_cache(inode);
CDEBUG(D_PSDEV, "\n"); CDEBUG(D_PSDEV, "\n");
if ( !cache ) { if ( !cache ) {
printk("PRESTO: BAD: cannot find cache for dev %x, ino %ld\n", printk("PRESTO: BAD: cannot find cache for dev %s, ino %ld\n",
kdev_val(inode->i_dev), inode->i_ino); inode->i_sb->s_id, inode->i_ino);
EXIT; EXIT;
return -1; return -1;
} }
......
...@@ -39,7 +39,7 @@ long presto_kmemory = 0; ...@@ -39,7 +39,7 @@ long presto_kmemory = 0;
#endif #endif
extern struct presto_cache *presto_init_cache(void); 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); extern inline void presto_init_cache_hash(void);
int presto_remount(struct super_block *, int *, char *); int presto_remount(struct super_block *, int *, char *);
...@@ -325,7 +325,7 @@ struct super_block * presto_read_super(struct super_block * presto_sb, ...@@ -325,7 +325,7 @@ struct super_block * presto_read_super(struct super_block * presto_sb,
filter_setup_journal_ops(cache->cache_filter, cache->cache_type); filter_setup_journal_ops(cache->cache_filter, cache->cache_type);
/* we now know the dev of the cache: hash the cache */ /* 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 /* make sure we have our own super operations: mysb
still contains the cache operations */ still contains the cache operations */
...@@ -402,7 +402,7 @@ int presto_remount(struct super_block * sb, int *flags, char *data) ...@@ -402,7 +402,7 @@ int presto_remount(struct super_block * sb, int *flags, char *data)
} }
} }
cache = presto_find_cache(sb->s_dev); cache = presto_find_cache(sb);
if (!cache) { if (!cache) {
printk(__FUNCTION__ ": cannot find cache on remount\n"); printk(__FUNCTION__ ": cannot find cache on remount\n");
err = -ENODEV; err = -ENODEV;
......
...@@ -602,7 +602,7 @@ int presto_do_link(struct presto_file_set *fset, struct dentry *old_dentry, ...@@ -602,7 +602,7 @@ int presto_do_link(struct presto_file_set *fset, struct dentry *old_dentry,
goto exit_lock; goto exit_lock;
error = -EXDEV; 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; goto exit_lock;
/* /*
...@@ -1609,7 +1609,7 @@ int presto_rename_dir(struct presto_file_set *fset, struct dentry *old_parent, ...@@ -1609,7 +1609,7 @@ int presto_rename_dir(struct presto_file_set *fset, struct dentry *old_parent,
if (error) if (error)
return 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; return -EXDEV;
if (!new_dentry->d_inode) if (!new_dentry->d_inode)
...@@ -1690,7 +1690,7 @@ int presto_rename_other(struct presto_file_set *fset, struct dentry *old_parent, ...@@ -1690,7 +1690,7 @@ int presto_rename_other(struct presto_file_set *fset, struct dentry *old_parent,
if (error) if (error)
return 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; return -EXDEV;
if (!new_dentry->d_inode) if (!new_dentry->d_inode)
......
...@@ -68,7 +68,7 @@ struct kml_fsdata ...@@ -68,7 +68,7 @@ struct kml_fsdata
}; };
/* super.c */ /* 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 struct file_system_type presto_fs_type;
extern int init_intermezzo_fs(void); extern int init_intermezzo_fs(void);
...@@ -89,7 +89,6 @@ struct presto_cache { ...@@ -89,7 +89,6 @@ struct presto_cache {
int cache_flags; int cache_flags;
char *cache_root_fileset; /* fileset mounted on cache "/" */ char *cache_root_fileset; /* fileset mounted on cache "/" */
kdev_t cache_dev; /* underlying block device */
struct super_block *cache_sb; struct super_block *cache_sb;
struct dentry *cache_mtde; /* unix mtpt of cache XXX NOT VALID XXX */ struct dentry *cache_mtde; /* unix mtpt of cache XXX NOT VALID XXX */
char *cache_mtpt; /* again */ char *cache_mtpt; /* again */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment