Whamcloud - gitweb
LU-1214 ptlrpc: removes client lu_target.h/target.c dependency
[fs/lustre-release.git] / lustre / lov / lovsub_lock.c
index 2b495da..f15662a 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -205,7 +207,6 @@ int lov_sublock_modify(const struct lu_env *env, struct lov_lock *lov,
                        const struct cl_lock_descr *d, int idx)
 {
         struct cl_lock       *parent;
-        struct cl_lock       *child;
         struct lovsub_object *subobj;
         struct cl_lock_descr *pd;
         struct cl_lock_descr *parent_descr;
@@ -215,7 +216,6 @@ int lov_sublock_modify(const struct lu_env *env, struct lov_lock *lov,
         parent_descr = &parent->cll_descr;
         LASSERT(cl_lock_mode_match(d->cld_mode, parent_descr->cld_mode));
 
-        child  = sublock->lss_cl.cls_lock;
         subobj = cl2lovsub(sublock->lss_cl.cls_obj);
         pd     = &lov_env_info(env)->lti_ldescr;
 
@@ -301,9 +301,7 @@ static int lovsub_lock_delete_one(const struct lu_env *env,
 
         result = 0;
         switch (parent->cll_state) {
-        case CLS_NEW:
         case CLS_QUEUING:
-        case CLS_ENQUEUED:
         case CLS_FREEING:
                 cl_lock_signal(env, parent);
                 break;
@@ -337,6 +335,8 @@ static int lovsub_lock_delete_one(const struct lu_env *env,
                  * enqueues missing sub-lock.
                  */
                 cl_lock_state_set(env, parent, CLS_NEW);
+                /* fall through */
+        case CLS_NEW:
                 /*
                  * if last sub-lock is canceled, destroy the top-lock (which
                  * is now `empty') proactively.
@@ -376,10 +376,11 @@ static int lovsub_lock_delete_one(const struct lu_env *env,
                         }
                 }
                 break;
+        case CLS_ENQUEUED:
         case CLS_HELD:
                 CL_LOCK_DEBUG(D_ERROR, env, parent, "Delete CLS_HELD lock\n");
         default:
-                CERROR("Impossible state: %i\n", parent->cll_state);
+                CERROR("Impossible state: %d\n", parent->cll_state);
                 LBUG();
                 break;
         }