Whamcloud - gitweb
LU-2675 obdclass: remove uses of lov_stripe_md
[fs/lustre-release.git] / lustre / obdclass / llog_obd.c
index 53b3fe6..a2dc63a 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -54,7 +54,7 @@ static struct llog_ctxt* llog_new_ctxt(struct obd_device *obd)
                 return NULL;
 
         ctxt->loc_obd = obd;
-        cfs_atomic_set(&ctxt->loc_refcount, 1);
+       atomic_set(&ctxt->loc_refcount, 1);
 
         return ctxt;
 }
@@ -69,7 +69,6 @@ static void llog_ctxt_destroy(struct llog_ctxt *ctxt)
                 class_import_put(ctxt->loc_imp);
                 ctxt->loc_imp = NULL;
         }
-        LASSERT(ctxt->loc_llcd == NULL);
         OBD_FREE_PTR(ctxt);
 }
 
@@ -79,21 +78,18 @@ int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt)
         struct obd_device *obd;
         int rc = 0;
 
-        cfs_spin_lock(&olg->olg_lock);
-        if (!cfs_atomic_dec_and_test(&ctxt->loc_refcount)) {
-                cfs_spin_unlock(&olg->olg_lock);
-                return rc;
-        }
-        olg->olg_ctxts[ctxt->loc_idx] = NULL;
-        cfs_spin_unlock(&olg->olg_lock);
-
-        if (ctxt->loc_lcm)
-                lcm_put(ctxt->loc_lcm);
+       spin_lock(&olg->olg_lock);
+       if (!atomic_dec_and_test(&ctxt->loc_refcount)) {
+               spin_unlock(&olg->olg_lock);
+               return rc;
+       }
+       olg->olg_ctxts[ctxt->loc_idx] = NULL;
+       spin_unlock(&olg->olg_lock);
 
-        obd = ctxt->loc_obd;
-        cfs_spin_lock(&obd->obd_dev_lock);
-        /* sync with llog ctxt user thread */
-        cfs_spin_unlock(&obd->obd_dev_lock);
+       obd = ctxt->loc_obd;
+       spin_lock(&obd->obd_dev_lock);
+       /* sync with llog ctxt user thread */
+       spin_unlock(&obd->obd_dev_lock);
 
         /* obd->obd_starting is needed for the case of cleanup
          * in error case while obd is starting up. */
@@ -107,7 +103,7 @@ int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt)
                rc = CTXTP(ctxt, cleanup)(env, ctxt);
 
        llog_ctxt_destroy(ctxt);
-       cfs_waitq_signal(&olg->olg_waitq);
+       wake_up(&olg->olg_waitq);
        return rc;
 }
 EXPORT_SYMBOL(__llog_ctxt_put);
@@ -131,8 +127,8 @@ int llog_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt)
        /*
          * Banlance the ctxt get when calling llog_cleanup()
          */
-        LASSERT(cfs_atomic_read(&ctxt->loc_refcount) < LI_POISON);
-        LASSERT(cfs_atomic_read(&ctxt->loc_refcount) > 1);
+       LASSERT(atomic_read(&ctxt->loc_refcount) < LI_POISON);
+       LASSERT(atomic_read(&ctxt->loc_refcount) > 1);
         llog_ctxt_put(ctxt);
 
        /*
@@ -171,7 +167,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
         ctxt->loc_olg = olg;
         ctxt->loc_idx = index;
         ctxt->loc_logops = op;
-        cfs_mutex_init(&ctxt->loc_mutex);
+       mutex_init(&ctxt->loc_mutex);
         ctxt->loc_exp = class_export_get(disk_obd->obd_self_export);
         ctxt->loc_flags = LLOG_CTXT_FLAG_UNINITIALIZED;
 
@@ -236,35 +232,7 @@ int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
 }
 EXPORT_SYMBOL(llog_sync);
 
-int llog_obd_add(const struct lu_env *env, struct llog_ctxt *ctxt,
-                struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
-                struct llog_cookie *logcookies, int numcookies)
-{
-        int raised, rc;
-        ENTRY;
-
-        if (!ctxt) {
-                CERROR("No ctxt\n");
-                RETURN(-ENODEV);
-        }
-
-        if (ctxt->loc_flags & LLOG_CTXT_FLAG_UNINITIALIZED)
-                RETURN(-ENXIO);
-
-       CTXT_CHECK_OP(ctxt, obd_add, -EOPNOTSUPP);
-        raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
-        if (!raised)
-                cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
-       rc = CTXTP(ctxt, obd_add)(env, ctxt, rec, lsm, logcookies,
-                                 numcookies);
-        if (!raised)
-                cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
-        RETURN(rc);
-}
-EXPORT_SYMBOL(llog_obd_add);
-
 int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
-               struct lov_stripe_md *lsm, int count,
                struct llog_cookie *cookies, int flags)
 {
         int rc;
@@ -276,29 +244,11 @@ int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
         }
 
         CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
-       rc = CTXTP(ctxt, cancel)(env, ctxt, lsm, count, cookies, flags);
+       rc = CTXTP(ctxt, cancel)(env, ctxt, cookies, flags);
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_cancel);
 
-/* add for obdfilter/sz and mds/unlink */
-int llog_obd_origin_add(const struct lu_env *env, struct llog_ctxt *ctxt,
-                       struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
-                       struct llog_cookie *logcookies, int numcookies)
-{
-        struct llog_handle *cathandle;
-        int rc;
-        ENTRY;
-
-        cathandle = ctxt->loc_handle;
-        LASSERT(cathandle != NULL);
-       rc = llog_cat_add(env, cathandle, rec, logcookies, NULL);
-        if (rc != 0 && rc != 1)
-                CERROR("write one catalog record failed: %d\n", rc);
-        RETURN(rc);
-}
-EXPORT_SYMBOL(llog_obd_origin_add);
-
 int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
                   struct obd_device *disk_obd, int *index)
 {