Skip to content
Snippets Groups Projects
Commit 7f6ea0a7 authored by huanghua's avatar huanghua
Browse files

Branch HEAD

b=15556
i=nikita.danilov
i=yury.umanets

- do not produce zero inode number;
- hash VFS inode by FID;
- start FID sequence from 0x100000400.
parent aa725876
No related branches found
No related tags found
No related merge requests found
......@@ -49,8 +49,8 @@
* Those fids are reserved for special purposes (igifs, etc.).
*/
const struct lu_range LUSTRE_SEQ_SPACE_RANGE = {
(0x400),
((__u64)~0ULL)
0x100000400ULL,
(__u64)~0ULL
};
EXPORT_SYMBOL(LUSTRE_SEQ_SPACE_RANGE);
......
......@@ -48,5 +48,10 @@ ino_t ll_fid_build_ino(struct ll_sb_info *sbi,
* based on fid.
*/
ino = fid_flatten(fid);
RETURN(ino & 0x7fffffff);
ino = ino & 0x7fffffff;
if (unlikely(ino == 0))
/* the first result ino is 0xFFC001, so this is rarely used */
ino = 0xffbcde;
RETURN(ino);
}
......@@ -1697,6 +1697,8 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
spin_unlock(&lli->lli_lock);
}
#endif
inode->i_ino = ll_fid_build_ino(sbi, &body->fid1);
if (body->valid & OBD_MD_FLATIME &&
body->atime > LTIME_S(inode->i_atime))
LTIME_S(inode->i_atime) = body->atime;
......
......@@ -70,6 +70,30 @@ int ll_unlock(__u32 mode, struct lustre_handle *lockh)
RETURN(0);
}
/* called from iget5_locked->find_inode() under inode_lock spinlock */
static int ll_test_inode(struct inode *inode, void *opaque)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct lustre_md *md = opaque;
if (unlikely(!(md->body->valid & OBD_MD_FLID))) {
CERROR("MDS body missing FID\n");
return 0;
}
if (!lu_fid_eq(&lli->lli_fid, &md->body->fid1))
return 0;
return 1;
}
static int ll_set_inode(struct inode *inode, void *opaque)
{
return 0;
}
/*
* Get an inode by inode number (already instantiated by the intent lookup).
* Returns inode or NULL
......@@ -78,24 +102,27 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
struct lustre_md *md)
{
struct ll_inode_info *lli;
struct inode *inode;
struct inode *inode;
ENTRY;
LASSERT(hash != 0);
inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md);
inode = iget_locked(sb, hash);
if (inode) {
lli = ll_i2info(inode);
if (inode->i_state & I_NEW) {
lli = ll_i2info(inode);
ll_read_inode2(inode, md);
unlock_new_inode(inode);
} else {
if (!(inode->i_state & (I_FREEING | I_CLEAR)))
ll_update_inode(inode, md);
}
CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n",
inode->i_ino, inode->i_generation, inode);
CDEBUG(D_VFSTRACE, "got inode: %lu/%u(%p) for "DFID"\n",
inode->i_ino, inode->i_generation, inode,
PFID(&lli->lli_fid));
}
return inode;
RETURN(inode);
}
static void ll_drop_negative_dentry(struct inode *dir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment