simplify get_cramfs_inode()
simply don't hash the inodes that don't have real inumber instead of skipping them during iget5_locked(); as the result, simple iget_locked() would do and we can get rid of cramfs ->drop_inode() as well. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
b69257f250
commit
77b8a75f5b
1 changed files with 38 additions and 50 deletions
|
@ -39,29 +39,9 @@ static DEFINE_MUTEX(read_mutex);
|
||||||
#define CRAMINO(x) (((x)->offset && (x)->size)?(x)->offset<<2:1)
|
#define CRAMINO(x) (((x)->offset && (x)->size)?(x)->offset<<2:1)
|
||||||
#define OFFSET(x) ((x)->i_ino)
|
#define OFFSET(x) ((x)->i_ino)
|
||||||
|
|
||||||
|
static void setup_inode(struct inode *inode, struct cramfs_inode * cramfs_inode)
|
||||||
static int cramfs_iget5_test(struct inode *inode, void *opaque)
|
|
||||||
{
|
{
|
||||||
struct cramfs_inode *cramfs_inode = opaque;
|
|
||||||
return inode->i_ino == CRAMINO(cramfs_inode) && inode->i_ino != 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cramfs_iget5_set(struct inode *inode, void *opaque)
|
|
||||||
{
|
|
||||||
struct cramfs_inode *cramfs_inode = opaque;
|
|
||||||
inode->i_ino = CRAMINO(cramfs_inode);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct inode *get_cramfs_inode(struct super_block *sb,
|
|
||||||
struct cramfs_inode * cramfs_inode)
|
|
||||||
{
|
|
||||||
struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode),
|
|
||||||
cramfs_iget5_test, cramfs_iget5_set,
|
|
||||||
cramfs_inode);
|
|
||||||
static struct timespec zerotime;
|
static struct timespec zerotime;
|
||||||
|
|
||||||
if (inode && (inode->i_state & I_NEW)) {
|
|
||||||
inode->i_mode = cramfs_inode->mode;
|
inode->i_mode = cramfs_inode->mode;
|
||||||
inode->i_uid = cramfs_inode->uid;
|
inode->i_uid = cramfs_inode->uid;
|
||||||
inode->i_size = cramfs_inode->size;
|
inode->i_size = cramfs_inode->size;
|
||||||
|
@ -86,17 +66,26 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
|
||||||
init_special_inode(inode, inode->i_mode,
|
init_special_inode(inode, inode->i_mode,
|
||||||
old_decode_dev(cramfs_inode->size));
|
old_decode_dev(cramfs_inode->size));
|
||||||
}
|
}
|
||||||
unlock_new_inode(inode);
|
|
||||||
}
|
|
||||||
return inode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cramfs_drop_inode(struct inode *inode)
|
static struct inode *get_cramfs_inode(struct super_block *sb,
|
||||||
|
struct cramfs_inode * cramfs_inode)
|
||||||
{
|
{
|
||||||
if (inode->i_ino == 1)
|
struct inode *inode;
|
||||||
generic_delete_inode(inode);
|
if (CRAMINO(cramfs_inode) == 1) {
|
||||||
else
|
inode = new_inode(sb);
|
||||||
generic_drop_inode(inode);
|
if (inode) {
|
||||||
|
inode->i_ino = 1;
|
||||||
|
setup_inode(inode, cramfs_inode);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inode = iget_locked(sb, CRAMINO(cramfs_inode));
|
||||||
|
if (inode) {
|
||||||
|
setup_inode(inode, cramfs_inode);
|
||||||
|
unlock_new_inode(inode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -542,7 +531,6 @@ static const struct super_operations cramfs_ops = {
|
||||||
.put_super = cramfs_put_super,
|
.put_super = cramfs_put_super,
|
||||||
.remount_fs = cramfs_remount,
|
.remount_fs = cramfs_remount,
|
||||||
.statfs = cramfs_statfs,
|
.statfs = cramfs_statfs,
|
||||||
.drop_inode = cramfs_drop_inode,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cramfs_get_sb(struct file_system_type *fs_type,
|
static int cramfs_get_sb(struct file_system_type *fs_type,
|
||||||
|
|
Loading…
Reference in a new issue