Whamcloud - gitweb
LU-2279 osp: do not spin awaiting for connection
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Tue, 18 Dec 2012 05:23:46 +0000 (09:23 +0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 9 Jan 2013 00:31:52 +0000 (19:31 -0500)
modify ready condition for osp_precreate_reserve() so that
it ignores -ENODEV and instead rely on expiration mechanism.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Change-Id: Id59e75bb17c603140616f34e08c98a6f31f10a8d
Reviewed-on: http://review.whamcloud.com/4847
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Li Wei <wei.g.li@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osp/osp_precreate.c

index 1e29d08..eafd24c 100644 (file)
@@ -672,7 +672,7 @@ static int osp_precreate_ready_condition(struct osp_device *d)
 
        /* ready if OST reported no space and no destoys in progress */
        if (d->opd_syn_changes + d->opd_syn_rpc_in_progress == 0 &&
 
        /* ready if OST reported no space and no destoys in progress */
        if (d->opd_syn_changes + d->opd_syn_rpc_in_progress == 0 &&
-           d->opd_pre_status != 0)
+           d->opd_pre_status == -ENOSPC)
                return 1;
 
        return 0;
                return 1;
 
        return 0;
@@ -711,9 +711,6 @@ int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d)
 
        LASSERT(d->opd_pre_last_created >= d->opd_pre_used_id);
 
 
        LASSERT(d->opd_pre_last_created >= d->opd_pre_used_id);
 
-       lwi = LWI_TIMEOUT(cfs_time_seconds(obd_timeout),
-                         osp_precreate_timeout_condition, d);
-
        /*
         * wait till:
         *  - preallocation is done
        /*
         * wait till:
         *  - preallocation is done
@@ -722,10 +719,6 @@ int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d)
         */
        while ((rc = d->opd_pre_status) == 0 || rc == -ENOSPC ||
                rc == -ENODEV) {
         */
        while ((rc = d->opd_pre_status) == 0 || rc == -ENOSPC ||
                rc == -ENODEV) {
-               if (unlikely(rc == -ENODEV)) {
-                       if (cfs_time_aftereq(cfs_time_current(), expire))
-                               break;
-               }
 
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
                /*
 
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
                /*
@@ -792,6 +785,11 @@ int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d)
                /* XXX: don't wake up if precreation is in progress */
                cfs_waitq_signal(&d->opd_pre_waitq);
 
                /* XXX: don't wake up if precreation is in progress */
                cfs_waitq_signal(&d->opd_pre_waitq);
 
+               lwi = LWI_TIMEOUT(expire - cfs_time_current(),
+                               osp_precreate_timeout_condition, d);
+               if (cfs_time_aftereq(cfs_time_current(), expire))
+                       break;
+
                l_wait_event(d->opd_pre_user_waitq,
                             osp_precreate_ready_condition(d), &lwi);
        }
                l_wait_event(d->opd_pre_user_waitq,
                             osp_precreate_ready_condition(d), &lwi);
        }