From cef4a7fdb1183deaf2cbb34849a3f9f7b9037da1 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 25 Mar 2015 01:21:33 +0800 Subject: [PATCH] LU-6378 osd-ldiskfs: unlock inode before attr_init The ldiskfs_create_inode() returns a locked inode to the caller (OSD) that with I_NEW state, before further initializing the inode's attr via osd_attr_init(), we should unlock the inode, otherwise, it will cause some unnecessary dqget operations and affect the performance. Signed-off-by: Fan Yong Change-Id: I36755cacc4895775130377da4ca486da08ede895 Reviewed-on: http://review.whamcloud.com/14102 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_handler.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index c771ac5..2105a26 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2201,17 +2201,19 @@ static int __osd_object_create(struct osd_thread_info *info, result = osd_create_type_f(dof->dof_type)(info, obj, attr, hint, dof, th); - if (result == 0) { - osd_attr_init(info, obj, attr, dof); - osd_object_init0(obj); - } - - if (obj->oo_inode != NULL) { + if (likely(obj->oo_inode != NULL)) { LASSERT(obj->oo_inode->i_state & I_NEW); + /* Unlock the inode before attr initialization to avoid + * unnecessary dqget operations. LU-6378 */ unlock_new_inode(obj->oo_inode); } + if (likely(result == 0)) { + osd_attr_init(info, obj, attr, dof); + osd_object_init0(obj); + } + /* restore previous umask value */ current->fs->umask = umask; -- 1.8.3.1