From ee78987810b09e294e89b42321139dd06af03441 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 18 Oct 2008 15:20:34 +0000 Subject: [PATCH] Make previously optional ->oti_{w,r}_locks sanity checks mandatory to simplify the code. b=16450 --- lustre/ChangeLog | 6 ++++++ lustre/osd/osd_handler.c | 34 ++++++---------------------------- lustre/osd/osd_internal.h | 4 ---- 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 02b268d..a7f1479 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -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. diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index fe921e4..7c6994b 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -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, diff --git a/lustre/osd/osd_internal.h b/lustre/osd/osd_internal.h index f325119..4a476db 100644 --- a/lustre/osd/osd_internal.h +++ b/lustre/osd/osd_internal.h @@ -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 -- 1.8.3.1