Whamcloud - gitweb
LU-4488 build: fix compilation with --enable-invariants 53/8853/10
authorDmitry Eremin <dmitry.eremin@intel.com>
Wed, 15 Jan 2014 08:46:04 +0000 (12:46 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 22 Feb 2014 08:02:16 +0000 (08:02 +0000)
Fix the build which was broken since the following commit:

    commit 0a259bd7dbac76d75b89a389bc317720153aa452
    Author: Jinshan Xiong <jinshan.xiong@intel.com>
    Date:   Mon Sep 30 15:00:38 2013 -0700

    LU-3321 clio: collapse layer of cl_page

    Move radix tree to osc layer to for performance improvement.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
    Change-Id: I93e3cb8352f7be41c23465b12945874316aa1809
    Reviewed-on: http://review.whamcloud.com/7892
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ie8543513852d98d0aa82bca0f227d286cdf8ebd2
Reviewed-on: http://review.whamcloud.com/8853
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/cl_lock.c
lustre/osc/osc_lock.c

index d440da9..58ca3f3 100644 (file)
@@ -2053,8 +2053,8 @@ void cl_lock_hold_add(const struct lu_env *env, struct cl_lock *lock,
         LASSERT(lock->cll_state != CLS_FREEING);
 
         ENTRY;
-        cl_lock_hold_mod(env, lock, +1);
         cl_lock_get(lock);
+       cl_lock_hold_mod(env, lock, +1);
         lu_ref_add(&lock->cll_holders, scope, source);
         lu_ref_add(&lock->cll_reference, scope, source);
         EXIT;
index e06a900..12b1984 100644 (file)
@@ -51,8 +51,8 @@
 
 #include "osc_cl_internal.h"
 
-/** \addtogroup osc 
- *  @{ 
+/** \addtogroup osc
+ *  @{
  */
 
 /*****************************************************************************
@@ -65,7 +65,7 @@ static const struct cl_lock_operations osc_lock_ops;
 static const struct cl_lock_operations osc_lock_lockless_ops;
 static void osc_lock_to_lockless(const struct lu_env *env,
                                  struct osc_lock *ols, int force);
-static int osc_lock_has_pages(struct osc_lock *olck);
+static bool osc_lock_has_pages(struct osc_lock *olck);
 
 int osc_lock_is_lockless(const struct osc_lock *olck)
 {
@@ -1455,7 +1455,7 @@ static int check_cb(const struct lu_env *env, struct cl_io *io,
  * Returns true iff there are pages under \a olck not protected by other
  * locks.
  */
-static int osc_lock_has_pages(struct osc_lock *olck)
+static bool osc_lock_has_pages(struct osc_lock *olck)
 {
         struct cl_lock       *lock;
         struct cl_lock_descr *descr;
@@ -1464,11 +1464,12 @@ static int osc_lock_has_pages(struct osc_lock *olck)
         struct cl_env_nest    nest;
         struct cl_io         *io;
         struct lu_env        *env;
-        int                   result;
+       bool                     has_pages;
+       int                      rc;
 
-        env = cl_env_nested_get(&nest);
-        if (IS_ERR(env))
-                return 0;
+       env = cl_env_nested_get(&nest);
+       if (IS_ERR(env))
+               return false;
 
         obj   = olck->ols_cl.cls_obj;
         oob   = cl2osc(obj);
@@ -1477,29 +1478,33 @@ static int osc_lock_has_pages(struct osc_lock *olck)
         descr = &lock->cll_descr;
 
        mutex_lock(&oob->oo_debug_mutex);
-
-        io->ci_obj = cl_object_top(obj);
+       io->ci_obj = cl_object_top(obj);
        io->ci_ignore_layout = 1;
-        cl_io_init(env, io, CIT_MISC, io->ci_obj);
+       rc = cl_io_init(env, io, CIT_MISC, io->ci_obj);
+       if (rc != 0)
+               GOTO(out, has_pages = false);
+
        do {
-               result = osc_page_gang_lookup(env, oob, io,
-                                             descr->cld_start, descr->cld_end,
-                                             check_cb, (void *)lock);
-               if (result == CLP_GANG_ABORT)
+               rc = osc_page_gang_lookup(env, io, oob,
+                                         descr->cld_start, descr->cld_end,
+                                         check_cb, (void *)lock);
+               if (rc == CLP_GANG_ABORT)
                        break;
-               if (result == CLP_GANG_RESCHED)
+               if (rc == CLP_GANG_RESCHED)
                        cond_resched();
-       } while (result != CLP_GANG_OKAY);
+       } while (rc != CLP_GANG_OKAY);
+       has_pages = (rc == CLP_GANG_ABORT);
+out:
        cl_io_fini(env, io);
        mutex_unlock(&oob->oo_debug_mutex);
        cl_env_nested_put(&nest, env);
 
-       return (result == CLP_GANG_ABORT);
+       return has_pages;
 }
 #else
-static int osc_lock_has_pages(struct osc_lock *olck)
+static bool osc_lock_has_pages(struct osc_lock *olck)
 {
-        return 0;
+       return false;
 }
 #endif /* CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */