Whamcloud - gitweb
b=20094
[fs/lustre-release.git] / lustre / obdclass / lu_object.c
index 4aa0443..0c07d53 100644 (file)
@@ -1094,7 +1094,10 @@ void lu_context_key_degister(struct lu_context_key *key)
         ++key_set_version;
         spin_lock(&lu_keys_guard);
         key_fini(&lu_shrink_env.le_ctx, key->lct_index);
-        lu_keys[key->lct_index] = NULL;
+        if (lu_keys[key->lct_index]) {
+                lu_keys[key->lct_index] = NULL;
+                lu_ref_fini(&key->lct_reference);
+        }
         spin_unlock(&lu_keys_guard);
 
         LASSERTF(atomic_read(&key->lct_used) == 1, "key has instances: %d\n",
@@ -1473,7 +1476,7 @@ struct lu_env lu_debugging_env;
  * Debugging printer function using printk().
  */
 int lu_printk_printer(const struct lu_env *env,
-                      void *_, const char *format, ...)
+                      void *unused, const char *format, ...)
 {
         va_list args;
 
@@ -1535,6 +1538,10 @@ int lu_global_init(void)
 
         CDEBUG(D_CONSOLE, "Lustre LU module (%p).\n", &lu_keys);
 
+        result = lu_ref_global_init();
+        if (result != 0)
+                return result;
+
         LU_CONTEXT_KEY_INIT(&lu_global_key);
         result = lu_context_key_register(&lu_global_key);
         if (result != 0)
@@ -1550,9 +1557,6 @@ int lu_global_init(void)
         if (result != 0)
                 return result;
 
-        result = lu_ref_global_init();
-        if (result != 0)
-                return result;
         /*
          * seeks estimation: 3 seeks to read a record from oi, one to read
          * inode, one for ea. Unfortunately setting this high value results in
@@ -1685,6 +1689,11 @@ void fid_pack(struct lu_fid_pack *pack, const struct lu_fid *fid,
         } else {
                 unsigned char *small_befider;
 
+                /* as lower 24 bits of FID_SEQ_START are zero, no need to
+                 * subtract its value from seq */
+
+                CLASSERT((FID_SEQ_START & 0xffffff) == 0);
+
                 small_befider = (unsigned char *)befider;
 
                 small_befider[0] = seq >> 16;