Commit 21b41646 authored by Boaz Harrosh's avatar Boaz Harrosh

exofs: refactor exofs_i_info initialization into common helper

There are two places that initialize inodes: exofs_iget() and
exofs_new_inode()

As more members of exofs_i_info that need initialization are
added this code will grow. (soon)
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
parent fd5cf19d
...@@ -906,6 +906,12 @@ out: ...@@ -906,6 +906,12 @@ out:
return ret; return ret;
} }
static void __oi_init(struct exofs_i_info *oi)
{
init_waitqueue_head(&oi->i_wq);
oi->i_flags = 0;
}
/* /*
* Fill in an inode read from the OSD and set it up for use * Fill in an inode read from the OSD and set it up for use
*/ */
...@@ -923,13 +929,13 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino) ...@@ -923,13 +929,13 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
if (!(inode->i_state & I_NEW)) if (!(inode->i_state & I_NEW))
return inode; return inode;
oi = exofs_i(inode); oi = exofs_i(inode);
__oi_init(oi);
/* read the inode from the osd */ /* read the inode from the osd */
ret = exofs_get_inode(sb, oi, &fcb, &sanity); ret = exofs_get_inode(sb, oi, &fcb, &sanity);
if (ret) if (ret)
goto bad_inode; goto bad_inode;
init_waitqueue_head(&oi->i_wq);
set_obj_created(oi); set_obj_created(oi);
/* copy stuff from on-disk struct to in-memory struct */ /* copy stuff from on-disk struct to in-memory struct */
...@@ -1060,8 +1066,8 @@ struct inode *exofs_new_inode(struct inode *dir, int mode) ...@@ -1060,8 +1066,8 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
oi = exofs_i(inode); oi = exofs_i(inode);
__oi_init(oi);
init_waitqueue_head(&oi->i_wq);
set_obj_2bcreated(oi); set_obj_2bcreated(oi);
sbi = sb->s_fs_info; sbi = sb->s_fs_info;
......
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