Whamcloud - gitweb
LU-1302 llog: pass lu_env as parametr in llog functions
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index 524738b..8e99fc4 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,9 +34,6 @@
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDC
 
 #ifdef __KERNEL__
@@ -1101,9 +1096,11 @@ restart_bulk:
         RETURN(0);
 }
 
-static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
+static int mdc_statfs(const struct lu_env *env,
+                      struct obd_export *exp, struct obd_statfs *osfs,
                       __u64 max_age, __u32 flags)
 {
+        struct obd_device     *obd = class_exp2obd(exp);
         struct ptlrpc_request *req;
         struct obd_statfs     *msfs;
         struct obd_import     *imp = NULL;
@@ -1183,7 +1180,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
         /* Val is struct getinfo_fid2path result plus path */
         vallen = sizeof(*gf) + gf->gf_pathlen;
 
-        rc = obd_get_info(exp, keylen, key, &vallen, gf, NULL);
+        rc = obd_get_info(NULL, exp, keylen, key, &vallen, gf, NULL);
         if (rc)
                 GOTO(out, rc);
 
@@ -1224,8 +1221,8 @@ struct changelog_show {
         struct obd_device *cs_obd;
 };
 
-static int changelog_show_cb(struct llog_handle *llh, struct llog_rec_hdr *hdr,
-                             void *data)
+static int changelog_show_cb(const struct lu_env *env, struct llog_handle *llh,
+                            struct llog_rec_hdr *hdr, void *data)
 {
         struct changelog_show *cs = data;
         struct llog_changelog_rec *rec = (struct llog_changelog_rec *)hdr;
@@ -1247,14 +1244,14 @@ static int changelog_show_cb(struct llog_handle *llh, struct llog_rec_hdr *hdr,
                 RETURN(0);
         }
 
-        CDEBUG(D_CHANGELOG, LPU64" %02d%-5s "LPU64" 0x%x t="DFID" p="DFID
-               " %.*s\n", rec->cr.cr_index, rec->cr.cr_type,
-               changelog_type2str(rec->cr.cr_type), rec->cr.cr_time,
-               rec->cr.cr_flags & CLF_FLAGMASK,
-               PFID(&rec->cr.cr_tfid), PFID(&rec->cr.cr_pfid),
-               rec->cr.cr_namelen, rec->cr.cr_name);
+       CDEBUG(D_CHANGELOG, LPU64" %02d%-5s "LPU64" 0x%x t="DFID" p="DFID
+               " %.*s\n", rec->cr.cr_index, rec->cr.cr_type,
+               changelog_type2str(rec->cr.cr_type), rec->cr.cr_time,
+               rec->cr.cr_flags & CLF_FLAGMASK,
+               PFID(&rec->cr.cr_tfid), PFID(&rec->cr.cr_pfid),
+               rec->cr.cr_namelen, changelog_rec_name(&rec->cr));
 
-        len = sizeof(*lh) + sizeof(rec->cr) + rec->cr.cr_namelen;
+       len = sizeof(*lh) + changelog_rec_size(&rec->cr) + rec->cr.cr_namelen;
 
         /* Set up the message */
         lh = changelog_kuc_hdr(cs->cs_buf, len, cs->cs_flags);
@@ -1292,18 +1289,18 @@ static int mdc_changelog_send_thread(void *csdata)
         ctxt = llog_get_context(cs->cs_obd, LLOG_CHANGELOG_REPL_CTXT);
         if (ctxt == NULL)
                 GOTO(out, rc = -ENOENT);
-        rc = llog_create(ctxt, &llh, NULL, CHANGELOG_CATALOG);
+       rc = llog_create(NULL, ctxt, &llh, NULL, CHANGELOG_CATALOG);
         if (rc) {
                 CERROR("llog_create() failed %d\n", rc);
                 GOTO(out, rc);
         }
-        rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_CAT, NULL);
         if (rc) {
                 CERROR("llog_init_handle failed %d\n", rc);
                 GOTO(out, rc);
         }
 
-        rc = llog_cat_process_flags(llh, changelog_show_cb, cs, 0, 0, 0);
+       rc = llog_cat_process(NULL, llh, changelog_show_cb, cs, 0, 0);
 
         /* Send EOF no matter what our result */
         if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch),
@@ -1315,7 +1312,7 @@ static int mdc_changelog_send_thread(void *csdata)
 out:
         cfs_put_file(cs->cs_fp);
         if (llh)
-                llog_cat_put(llh);
+               llog_cat_put(NULL, llh);
         if (ctxt)
                 llog_ctxt_put(ctxt);
         if (cs->cs_buf)
@@ -1468,7 +1465,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 struct ioc_changelog *icc = karg;
                 struct changelog_setinfo cs =
                         {.cs_recno = icc->icc_recno, .cs_id = icc->icc_id};
-                rc = obd_set_info_async(exp, strlen(KEY_CHANGELOG_CLEAR),
+                rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR),
                                         KEY_CHANGELOG_CLEAR, sizeof(cs), &cs,
                                         NULL);
                 GOTO(out, rc);
@@ -1525,7 +1522,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                                          (int) sizeof(struct obd_uuid))))
                         GOTO(out, rc = -EFAULT);
 
-                rc = mdc_statfs(obd, &stat_buf,
+                rc = mdc_statfs(NULL, obd->obd_self_export, &stat_buf,
                                 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
                                 0);
                 if (rc != 0)
@@ -1721,7 +1718,8 @@ static int mdc_hsm_copytool_send(int len, void *val)
         RETURN(rc);
 }
 
-int mdc_set_info_async(struct obd_export *exp,
+int mdc_set_info_async(const struct lu_env *env,
+                       struct obd_export *exp,
                        obd_count keylen, void *key,
                        obd_count vallen, void *val,
                        struct ptlrpc_request_set *set)
@@ -1778,8 +1776,9 @@ int mdc_set_info_async(struct obd_export *exp,
         RETURN(rc);
 }
 
-int mdc_get_info(struct obd_export *exp, __u32 keylen, void *key,
-                 __u32 *vallen, void *val, struct lov_stripe_md *lsm)
+int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
+                 __u32 keylen, void *key, __u32 *vallen, void *val,
+                 struct lov_stripe_md *lsm)
 {
         int rc = -EINVAL;