X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_log.h;h=54f3f047419a1badaa169a75a3c20f4920901192;hb=87b7907d39425a47f6bc7a908f0bb48b5b329bf5;hp=a4cd24d6c94f4e1125ab19de0f5d2d62a71fe337;hpb=0a859380c36ac24871f221b35042f76c56b04438;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index a4cd24d..54f3f04 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -26,7 +26,7 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* @@ -329,7 +329,6 @@ struct llog_commit_master { static inline struct llog_commit_master *lcm_get(struct llog_commit_master *lcm) { - LASSERT(cfs_atomic_read(&lcm->lcm_refcount) > 0); cfs_atomic_inc(&lcm->lcm_refcount); return lcm; } @@ -337,10 +336,9 @@ static inline struct llog_commit_master static inline void lcm_put(struct llog_commit_master *lcm) { - if (!cfs_atomic_dec_and_test(&lcm->lcm_refcount)) { - return ; - } - OBD_FREE_PTR(lcm); + LASSERT_ATOMIC_POS(&lcm->lcm_refcount); + if (cfs_atomic_dec_and_test(&lcm->lcm_refcount)) + OBD_FREE_PTR(lcm); } struct llog_canceld_ctxt { @@ -389,6 +387,9 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt) { struct obd_device *obd = ctxt->loc_exp->exp_obd; + LASSERTF(obd->u.obt.obt_magic == OBT_MAGIC, + "%s: wrong obt magic %#x\n", + obd->obd_name, obd->u.obt.obt_magic); ctxt->loc_gen.mnt_cnt = obd->u.obt.obt_mount_count; ctxt->loc_gen.conn_cnt++; } @@ -434,7 +435,6 @@ static inline int llog_data_len(int len) static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt) { - LASSERT(cfs_atomic_read(&ctxt->loc_refcount) > 0); cfs_atomic_inc(&ctxt->loc_refcount); CDEBUG(D_INFO, "GETting ctxt %p : new refcount %d\n", ctxt, cfs_atomic_read(&ctxt->loc_refcount)); @@ -445,8 +445,7 @@ static inline void llog_ctxt_put(struct llog_ctxt *ctxt) { if (ctxt == NULL) return; - LASSERT(cfs_atomic_read(&ctxt->loc_refcount) > 0); - LASSERT(cfs_atomic_read(&ctxt->loc_refcount) < 0x5a5a5a); + LASSERT_ATOMIC_GT_LT(&ctxt->loc_refcount, 0, 0x5a5a5a); CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", ctxt, cfs_atomic_read(&ctxt->loc_refcount) - 1); __llog_ctxt_put(ctxt);