Whamcloud - gitweb
Make previously optional ->oti_{w,r}_locks sanity checks mandatory to simplify
authornikita <nikita>
Sat, 18 Oct 2008 15:20:34 +0000 (15:20 +0000)
committernikita <nikita>
Sat, 18 Oct 2008 15:20:34 +0000 (15:20 +0000)
the code.
b=16450

lustre/ChangeLog
lustre/osd/osd_handler.c
lustre/osd/osd_internal.h

index 02b268d..a7f1479 100644 (file)
@@ -1453,6 +1453,12 @@ Bugzilla   : 16450
 Description: Grammar fixes.
 Details    : A couple of trivial spelling fixes.
 
+Severity   : normal
+Bugzilla   : 16450
+Description: OSD_COUNTERS-mandatory
+Details    : Make previously optional ->oti_{w,r}_locks sanity checks mandatory
+            to simplify the code.
+       
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
index fe921e4..7c6994b 100644 (file)
@@ -262,7 +262,6 @@ static inline struct osd_thread_info *osd_oti_get(const struct lu_env *env)
         return lu_context_key_get(&env->le_ctx, &osd_key);
 }
 
-#if OSD_COUNTERS
 /*
  * Concurrency: doesn't matter
  */
@@ -280,15 +279,6 @@ static int osd_write_locked(const struct lu_env *env, struct osd_object *o)
         return oti->oti_w_locks > 0 && o->oo_owner == env;
 }
 
-#define OSD_COUNTERS_DO(exp) exp
-#else
-
-
-#define osd_read_locked(env, o) (1)
-#define osd_write_locked(env, o) (1)
-#define OSD_COUNTERS_DO(exp) ((void)0)
-#endif
-
 /*
  * Concurrency: doesn't access mutable data
  */
@@ -675,35 +665,25 @@ static void osd_trans_stop(const struct lu_env *env, struct thandle *th)
 {
         int result;
         struct osd_thandle *oh;
+        struct osd_thread_info *oti = osd_oti_get(env);
 
         ENTRY;
 
         oh = container_of0(th, struct osd_thandle, ot_super);
         if (oh->ot_handle != NULL) {
                 handle_t *hdl = oh->ot_handle;
-                /*
-                 * XXX temporary stuff. Some abstraction layer should be used.
-                 */
+
+                LASSERT(oti->oti_txns == 1);
+                oti->oti_txns--;
+                LASSERT(oti->oti_r_locks == 0);
+                LASSERT(oti->oti_w_locks == 0);
                 result = dt_txn_hook_stop(env, th);
                 if (result != 0)
                         CERROR("Failure in transaction hook: %d\n", result);
-
-                /**/
                 oh->ot_handle = NULL;
                 result = journal_stop(hdl);
                 if (result != 0)
                         CERROR("Failure to stop transaction: %d\n", result);
-
-#if OSD_COUNTERS
-                {
-                        struct osd_thread_info *oti = osd_oti_get(env);
-
-                        LASSERT(oti->oti_txns == 1);
-                        LASSERT(oti->oti_r_locks == 0);
-                        LASSERT(oti->oti_w_locks == 0);
-                        oti->oti_txns--;
-                }
-#endif
         }
         EXIT;
 }
@@ -2231,13 +2211,11 @@ LU_KEY_FINI(osd, struct osd_thread_info);
 static void osd_key_exit(const struct lu_context *ctx,
                          struct lu_context_key *key, void *data)
 {
-#if OSD_COUNTERS
         struct osd_thread_info *info = data;
 
         LASSERT(info->oti_r_locks == 0);
         LASSERT(info->oti_w_locks == 0);
         LASSERT(info->oti_txns    == 0);
-#endif
 }
 
 static int osd_device_init(const struct lu_env *env, struct lu_device *d,
index f325119..4a476db 100644 (file)
@@ -66,8 +66,6 @@
 
 struct inode;
 
-#define OSD_COUNTERS (0)
-
 /*
  * osd device.
  */
@@ -144,11 +142,9 @@ struct osd_thread_info {
         char                   oti_ipd[DX_IPD_MAX_SIZE];
                 long long      oti_alignment_lieutenant;
         };
-#if OSD_COUNTERS
         int                    oti_r_locks;
         int                    oti_w_locks;
         int                    oti_txns;
-#endif
 };
 
 #ifdef LPROCFS