umode_t erofs_ftype_to_mode(unsigned int ftype, unsigned int perm);
unsigned char erofs_ftype_to_dtype(unsigned int filetype);
void erofs_inode_manager_init(void);
-void erofs_insert_ihash(struct erofs_inode *inode, dev_t dev, ino_t ino);
+void erofs_insert_ihash(struct erofs_inode *inode);
struct erofs_inode *erofs_iget(dev_t dev, ino_t ino);
struct erofs_inode *erofs_iget_by_nid(erofs_nid_t nid);
unsigned int erofs_iput(struct erofs_inode *inode);
init_list_head(&inode_hashtable[i]);
}
-void erofs_insert_ihash(struct erofs_inode *inode, dev_t dev, ino_t ino)
+void erofs_insert_ihash(struct erofs_inode *inode)
{
- list_add(&inode->i_hash,
- &inode_hashtable[(ino ^ dev) % NR_INODE_HASHTABLE]);
+ unsigned int nr = (inode->i_ino[1] ^ inode->dev) % NR_INODE_HASHTABLE;
+
+ list_add(&inode->i_hash, &inode_hashtable[nr]);
}
/* get the inode from the (source) inode # */
if (!inode->i_srcpath)
return -ENOMEM;
- if (!S_ISDIR(inode->i_mode)) {
- inode->dev = st->st_dev;
- inode->i_ino[1] = st->st_ino;
- }
-
if (erofs_should_use_inode_extended(inode)) {
if (cfg.c_force_inodeversion == FORCE_INODE_COMPACT) {
erofs_err("file %s cannot be in compact form",
inode->inode_isize = sizeof(struct erofs_inode_compact);
}
- erofs_insert_ihash(inode, st->st_dev, st->st_ino);
+ inode->dev = st->st_dev;
+ inode->i_ino[1] = st->st_ino;
+ erofs_insert_ihash(inode);
return 0;
}