Skip to content

Commit 9cfdc7a

Browse files
author
Boaz Harrosh
committed
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: Boaz Harrosh <[email protected]>
1 parent fe33cc1 commit 9cfdc7a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/exofs/inode.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,12 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
908908
return ret;
909909
}
910910

911+
912+
static void __oi_init(struct exofs_i_info *oi)
913+
{
914+
init_waitqueue_head(&oi->i_wq);
915+
oi->i_flags = 0;
916+
}
911917
/*
912918
* Fill in an inode read from the OSD and set it up for use
913919
*/
@@ -925,13 +931,13 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
925931
if (!(inode->i_state & I_NEW))
926932
return inode;
927933
oi = exofs_i(inode);
934+
__oi_init(oi);
928935

929936
/* read the inode from the osd */
930937
ret = exofs_get_inode(sb, oi, &fcb, &sanity);
931938
if (ret)
932939
goto bad_inode;
933940

934-
init_waitqueue_head(&oi->i_wq);
935941
set_obj_created(oi);
936942

937943
/* copy stuff from on-disk struct to in-memory struct */
@@ -1062,8 +1068,8 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
10621068
return ERR_PTR(-ENOMEM);
10631069

10641070
oi = exofs_i(inode);
1071+
__oi_init(oi);
10651072

1066-
init_waitqueue_head(&oi->i_wq);
10671073
set_obj_2bcreated(oi);
10681074

10691075
sbi = sb->s_fs_info;

0 commit comments

Comments
 (0)