Whamcloud - gitweb
LU-1302 llog: pass lu_env as parametr in llog functions
authorMikhail Pershin <tappro@whamcloud.com>
Thu, 16 Aug 2012 13:25:11 +0000 (17:25 +0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Sep 2012 18:50:12 +0000 (14:50 -0400)
Add lu_env as paramenter in llog API functions and helpers

Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Change-Id: I3c3c1878b7dec7059602a91790820b70f225ade5
Reviewed-on: http://review.whamcloud.com/3696
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
24 files changed:
lustre/include/lustre_log.h
lustre/lov/lov_log.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_lov.c
lustre/mds/mds_log.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_llog.c
lustre/obdclass/llog.c
lustre/obdclass/llog_cat.c
lustre/obdclass/llog_internal.h
lustre/obdclass/llog_ioctl.c
lustre/obdclass/llog_lvfs.c
lustre/obdclass/llog_obd.c
lustre/obdclass/llog_test.c
lustre/obdclass/obd_config.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_log.c
lustre/ptlrpc/llog_client.c
lustre/ptlrpc/llog_net.c
lustre/ptlrpc/llog_server.c
lustre/ptlrpc/recov_thread.c
lustre/ptlrpc/sec_config.c

index 253bafd..9471603 100644 (file)
@@ -113,19 +113,19 @@ struct llog_handle;
 /* llog.c  -  general API */
 typedef int (*llog_cb_t)(const struct lu_env *env, struct llog_handle *lgh,
                         struct llog_rec_hdr *rec, void *data);
-typedef int (*llog_fill_rec_cb_t)(struct llog_rec_hdr *rec, void *data);
 extern struct llog_handle *llog_alloc_handle(void);
-int llog_init_handle(struct llog_handle *handle, int flags,
-                     struct obd_uuid *uuid);
+int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
+                    int flags, struct obd_uuid *uuid);
 extern void llog_free_handle(struct llog_handle *handle);
 int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
                 llog_cb_t cb, void *data, void *catdata);
 int llog_reverse_process(const struct lu_env *env,
                         struct llog_handle *loghandle, llog_cb_t cb,
                         void *data, void *catdata);
-extern int llog_cancel_rec(struct llog_handle *loghandle, int index);
-extern int llog_close(struct llog_handle *cathandle);
-extern int llog_get_size(struct llog_handle *loghandle);
+int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
+                   int index);
+int llog_close(const struct lu_env *env, struct llog_handle *cathandle);
+int llog_get_size(struct llog_handle *loghandle);
 
 /* llog_process flags */
 #define LLOG_FLAG_NODEAMON 0x0001
@@ -177,11 +177,13 @@ struct llog_process_cat_args {
 
 int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
                  struct llog_rec_hdr *rec, void *data);
-int llog_cat_put(struct llog_handle *cathandle);
-int llog_cat_add_rec(struct llog_handle *cathandle, struct llog_rec_hdr *rec,
-                     struct llog_cookie *reccookie, void *buf);
-int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
-                            struct llog_cookie *cookies);
+int llog_cat_put(const struct lu_env *env, struct llog_handle *cathandle);
+int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
+                    struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
+                    void *buf);
+int llog_cat_cancel_records(const struct lu_env *env,
+                           struct llog_handle *cathandle, int count,
+                           struct llog_cookie *cookies);
 int __llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
                       llog_cb_t cb, void *data, int startcat, int startidx,
                       int fork);
@@ -204,19 +206,20 @@ int llog_setup(struct obd_device *obd, struct obd_llog_group *olg, int index,
 int __llog_ctxt_put(struct llog_ctxt *ctxt);
 int llog_cleanup(struct llog_ctxt *);
 int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
-int llog_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
-             struct lov_stripe_md *lsm, struct llog_cookie *logcookies,
-             int numcookies);
-int llog_cancel(struct llog_ctxt *, struct lov_stripe_md *lsm,
-                int count, struct llog_cookie *cookies, int flags);
-
-int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
-                          int index, struct obd_device *disk_obd, int count,
-                          struct llog_logid *logid, const char *name);
-int llog_obd_origin_cleanup(struct llog_ctxt *ctxt);
-int llog_obd_origin_add(struct llog_ctxt *ctxt,
-                        struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
-                        struct llog_cookie *logcookies, int numcookies);
+int llog_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 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 llog_obd_origin_setup(const struct lu_env *env, struct obd_device *obd,
+                         struct obd_llog_group *olg, int index,
+                         struct obd_device *disk_obd, int count,
+                         struct llog_logid *logid, const char *name);
+int llog_obd_origin_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt);
+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);
 
 int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
                   struct obd_device *disk_obd, int *idx);
@@ -237,9 +240,9 @@ int llog_origin_connect(struct llog_ctxt *ctxt,
 int llog_handle_connect(struct ptlrpc_request *req);
 
 /* recov_thread.c */
-int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
-                         struct lov_stripe_md *lsm, int count,
-                         struct llog_cookie *cookies, int flags);
+int llog_obd_repl_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
+                        struct lov_stripe_md *lsm, int count,
+                        struct llog_cookie *cookies, int flags);
 int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp,
                       int flags);
 int llog_obd_repl_connect(struct llog_ctxt *ctxt,
@@ -247,35 +250,39 @@ int llog_obd_repl_connect(struct llog_ctxt *ctxt,
                           struct obd_uuid *uuid);
 
 struct llog_operations {
-        int (*lop_write_rec)(struct llog_handle *loghandle,
-                             struct llog_rec_hdr *rec,
-                             struct llog_cookie *logcookies, int numcookies,
-                             void *, int idx);
-        int (*lop_destroy)(struct llog_handle *handle);
-        int (*lop_next_block)(struct llog_handle *h, int *curr_idx,
-                              int next_idx, __u64 *offset, void *buf, int len);
-        int (*lop_prev_block)(struct llog_handle *h,
-                              int prev_idx, void *buf, int len);
-        int (*lop_create)(struct llog_ctxt *ctxt, struct llog_handle **,
-                          struct llog_logid *logid, char *name);
-        int (*lop_close)(struct llog_handle *handle);
-        int (*lop_read_header)(struct llog_handle *handle);
-
-        int (*lop_setup)(struct obd_device *obd, struct obd_llog_group *olg,
-                         int ctxt_idx, struct obd_device *disk_obd, int count,
-                         struct llog_logid *logid, const char *name);
+       int (*lop_destroy)(const struct lu_env *env,
+                          struct llog_handle *handle);
+       int (*lop_next_block)(const struct lu_env *env, struct llog_handle *h,
+                             int *curr_idx, int next_idx, __u64 *offset,
+                             void *buf, int len);
+       int (*lop_prev_block)(const struct lu_env *env, struct llog_handle *h,
+                             int prev_idx, void *buf, int len);
+       int (*lop_read_header)(const struct lu_env *env,
+                              struct llog_handle *handle);
+       int (*lop_setup)(const struct lu_env *env, struct obd_device *obd,
+                        struct obd_llog_group *olg, int ctxt_idx,
+                        struct obd_device *disk_obd, int count,
+                        struct llog_logid *logid, const char *name);
        int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp,
                        int flags);
-        int (*lop_cleanup)(struct llog_ctxt *ctxt);
-        int (*lop_add)(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
-                       struct lov_stripe_md *lsm,
-                       struct llog_cookie *logcookies, int numcookies);
-        int (*lop_cancel)(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm,
-                          int count, struct llog_cookie *cookies, int flags);
-        int (*lop_connect)(struct llog_ctxt *ctxt,
-                           struct llog_logid *logid, struct llog_gen *gen,
-                           struct obd_uuid *uuid);
-        /* XXX add 2 more: commit callbacks and llog recovery functions */
+       int (*lop_cleanup)(const struct lu_env *env, struct llog_ctxt *ctxt);
+       int (*lop_cancel)(const struct lu_env *env, struct llog_ctxt *ctxt,
+                         struct lov_stripe_md *lsm, int count,
+                         struct llog_cookie *cookies, int flags);
+       int (*lop_connect)(struct llog_ctxt *ctxt, struct llog_logid *logid,
+                          struct llog_gen *gen, struct obd_uuid *uuid);
+       int (*lop_create)(const struct lu_env *env, struct llog_ctxt *ctxt,
+                         struct llog_handle **h, struct llog_logid *logid,
+                         char *name);
+       int (*lop_write_rec)(const struct lu_env *env,
+                            struct llog_handle *loghandle,
+                            struct llog_rec_hdr *rec,
+                            struct llog_cookie *logcookies, int numcookies,
+                            void *, int idx);
+       int (*lop_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 (*lop_close)(const struct lu_env *env, struct llog_handle *handle);
 };
 
 /* In-memory descriptor for a log object or log catalog */
@@ -560,147 +567,140 @@ static inline int llog_ctxt_null(struct obd_device *obd, int index)
         return (llog_group_ctxt_null(&obd->obd_olg, index));
 }
 
-static inline int llog_write_rec(struct llog_handle *handle,
-                                 struct llog_rec_hdr *rec,
-                                 struct llog_cookie *logcookies,
-                                 int numcookies, void *buf, int idx)
+static inline int llog_write_rec(const struct lu_env *env,
+                                struct llog_handle *handle,
+                                struct llog_rec_hdr *rec,
+                                struct llog_cookie *logcookies,
+                                int numcookies, void *buf, int idx)
 {
-        struct llog_operations *lop;
-        int raised, rc, buflen;
-        ENTRY;
-
-        rc = llog_handle2ops(handle, &lop);
-        if (rc)
-                RETURN(rc);
-        LASSERT(lop);
-        if (lop->lop_write_rec == NULL)
-                RETURN(-EOPNOTSUPP);
-
-        /* FIXME:  Why doesn't caller just set the right lrh_len itself? */
-        if (buf)
-                buflen = rec->lrh_len + sizeof(struct llog_rec_hdr)
-                                + sizeof(struct llog_rec_tail);
-        else
-                buflen = rec->lrh_len;
-        LASSERT(cfs_size_round(buflen) == buflen);
-
-        raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
-        if (!raised)
-                cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
-        rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
-        if (!raised)
-                cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
-        RETURN(rc);
+       struct llog_operations *lop;
+       int raised, rc, buflen;
+
+       ENTRY;
+
+       rc = llog_handle2ops(handle, &lop);
+       if (rc)
+               RETURN(rc);
+       LASSERT(lop);
+       if (lop->lop_write_rec == NULL)
+               RETURN(-EOPNOTSUPP);
+
+       /* FIXME:  Why doesn't caller just set the right lrh_len itself? */
+       if (buf)
+               buflen = rec->lrh_len + sizeof(struct llog_rec_hdr) +
+                        sizeof(struct llog_rec_tail);
+       else
+               buflen = rec->lrh_len;
+       LASSERT(cfs_size_round(buflen) == buflen);
+
+       raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
+       if (!raised)
+               cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+       rc = lop->lop_write_rec(env, handle, rec, logcookies, numcookies,
+                               buf, idx);
+       if (!raised)
+               cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+       RETURN(rc);
 }
 
-static inline int llog_read_header(struct llog_handle *handle)
+static inline int llog_read_header(const struct lu_env *env,
+                                  struct llog_handle *handle)
 {
-        struct llog_operations *lop;
-        int rc;
-        ENTRY;
-
-        rc = llog_handle2ops(handle, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_read_header == NULL)
-                RETURN(-EOPNOTSUPP);
+       struct llog_operations *lop;
+       int rc;
 
-        rc = lop->lop_read_header(handle);
-        RETURN(rc);
-}
+       ENTRY;
 
-static inline int llog_destroy(struct llog_handle *handle)
-{
-        struct llog_operations *lop;
-        int rc;
-        ENTRY;
+       rc = llog_handle2ops(handle, &lop);
+       if (rc)
+               RETURN(rc);
+       if (lop->lop_read_header == NULL)
+               RETURN(-EOPNOTSUPP);
 
-        rc = llog_handle2ops(handle, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_destroy == NULL)
-                RETURN(-EOPNOTSUPP);
-
-        rc = lop->lop_destroy(handle);
-        RETURN(rc);
+       rc = lop->lop_read_header(env, handle);
+       RETURN(rc);
 }
 
-#if 0
-static inline int llog_cancel(struct obd_export *exp,
-                              struct lov_stripe_md *lsm, int count,
-                              struct llog_cookie *cookies, int flags)
+static inline int llog_destroy(const struct lu_env *env,
+                              struct llog_handle *handle)
 {
-        struct llog_operations *lop;
-        int rc;
-        ENTRY;
+       struct llog_operations *lop;
+       int rc;
 
-        rc = llog_handle2ops(loghandle, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_cancel == NULL)
-                RETURN(-EOPNOTSUPP);
+       ENTRY;
 
-        rc = lop->lop_cancel(exp, lsm, count, cookies, flags);
-        RETURN(rc);
+       rc = llog_handle2ops(handle, &lop);
+       if (rc)
+               RETURN(rc);
+       if (lop->lop_destroy == NULL)
+               RETURN(-EOPNOTSUPP);
+
+       rc = lop->lop_destroy(env, handle);
+       RETURN(rc);
 }
-#endif
 
-static inline int llog_next_block(struct llog_handle *loghandle, int *cur_idx,
-                                  int next_idx, __u64 *cur_offset, void *buf,
-                                  int len)
+static inline int llog_next_block(const struct lu_env *env,
+                                 struct llog_handle *loghandle, int *cur_idx,
+                                 int next_idx, __u64 *cur_offset, void *buf,
+                                 int len)
 {
-        struct llog_operations *lop;
-        int rc;
-        ENTRY;
+       struct llog_operations *lop;
+       int rc;
 
-        rc = llog_handle2ops(loghandle, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_next_block == NULL)
-                RETURN(-EOPNOTSUPP);
+       ENTRY;
 
-        rc = lop->lop_next_block(loghandle, cur_idx, next_idx, cur_offset, buf,
-                                 len);
-        RETURN(rc);
+       rc = llog_handle2ops(loghandle, &lop);
+       if (rc)
+               RETURN(rc);
+       if (lop->lop_next_block == NULL)
+               RETURN(-EOPNOTSUPP);
+
+       rc = lop->lop_next_block(env, loghandle, cur_idx, next_idx,
+                                cur_offset, buf, len);
+       RETURN(rc);
 }
 
-static inline int llog_prev_block(struct llog_handle *loghandle,
-                                  int prev_idx, void *buf, int len)
+static inline int llog_prev_block(const struct lu_env *env,
+                                 struct llog_handle *loghandle,
+                                 int prev_idx, void *buf, int len)
 {
-        struct llog_operations *lop;
-        int rc;
-        ENTRY;
+       struct llog_operations *lop;
+       int rc;
 
-        rc = llog_handle2ops(loghandle, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_prev_block == NULL)
-                RETURN(-EOPNOTSUPP);
+       ENTRY;
 
-        rc = lop->lop_prev_block(loghandle, prev_idx, buf, len);
-        RETURN(rc);
+       rc = llog_handle2ops(loghandle, &lop);
+       if (rc)
+               RETURN(rc);
+       if (lop->lop_prev_block == NULL)
+               RETURN(-EOPNOTSUPP);
+
+       rc = lop->lop_prev_block(env, loghandle, prev_idx, buf, len);
+       RETURN(rc);
 }
 
-static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                              struct llog_logid *logid, char *name)
+static inline int llog_create(const struct lu_env *env, struct llog_ctxt *ctxt,
+                             struct llog_handle **res,
+                             struct llog_logid *logid, char *name)
 {
-        struct llog_operations *lop;
-        int raised, rc;
-        ENTRY;
-
-        rc = llog_obd2ops(ctxt, &lop);
-        if (rc)
-                RETURN(rc);
-        if (lop->lop_create == NULL)
-                RETURN(-EOPNOTSUPP);
-
-        raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
-        if (!raised)
-                cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
-        rc = lop->lop_create(ctxt, res, logid, name);
-        if (!raised)
-                cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
-        RETURN(rc);
+       struct llog_operations *lop;
+       int raised, rc;
+
+       ENTRY;
+
+       rc = llog_obd2ops(ctxt, &lop);
+       if (rc)
+               RETURN(rc);
+       if (lop->lop_create == NULL)
+               RETURN(-EOPNOTSUPP);
+
+       raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
+       if (!raised)
+               cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+       rc = lop->lop_create(env, ctxt, res, logid, name);
+       if (!raised)
+               cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+       RETURN(rc);
 }
 
 static inline int llog_connect(struct llog_ctxt *ctxt,
index 8359cd6..97b3ca8 100644 (file)
  * we need to keep cookies in stripe order, even if some are NULL, so that
  * the right cookies are passed back to the right OSTs at the client side.
  * Unset cookies should be all-zero (which will never occur naturally). */
-static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
-                               struct lov_stripe_md *lsm,
-                               struct llog_cookie *logcookies, int numcookies)
+static int lov_llog_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 obd_device *obd = ctxt->loc_obd;
         struct lov_obd *lov = &obd->u.lov;
@@ -104,8 +106,8 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
                         llog_ctxt_put(cctxt);
                         cctxt = NULL;
                 }
-                rc = llog_add(cctxt, rec, NULL, logcookies + cookies,
-                               numcookies - cookies);
+               rc = llog_add(env, cctxt, rec, NULL, logcookies + cookies,
+                             numcookies - cookies);
                 llog_ctxt_put(cctxt);
                 if (rc < 0) {
                         CERROR("Can't add llog (rc = %d) for stripe %d\n",
@@ -157,8 +159,11 @@ static int lov_llog_origin_connect(struct llog_ctxt *ctxt,
 }
 
 /* the replicators commit callback */
-static int lov_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm,
-                          int count, struct llog_cookie *cookies, int flags)
+static int lov_llog_repl_cancel(const struct lu_env *env,
+                               struct llog_ctxt *ctxt,
+                               struct lov_stripe_md *lsm,
+                               int count, struct llog_cookie *cookies,
+                               int flags)
 {
         struct lov_obd *lov;
         struct obd_device *obd = ctxt->loc_obd;
@@ -178,7 +183,7 @@ static int lov_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *ls
                         llog_get_context(child, ctxt->loc_idx);
                 int err;
 
-                err = llog_cancel(cctxt, NULL, 1, cookies, flags);
+               err = llog_cancel(env, cctxt, NULL, 1, cookies, flags);
                 llog_ctxt_put(cctxt);
                 if (err && lov->lov_tgts[loi->loi_ost_idx]->ltd_active) {
                         CERROR("error: objid "LPX64" subobj "LPX64
index 7020c3b..8e99fc4 100644 (file)
@@ -1289,12 +1289,12 @@ 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);
@@ -1312,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)
index cc2324c..34b3091 100644 (file)
@@ -321,7 +321,7 @@ int mdd_changelog_llog_write(struct mdd_device         *mdd,
                 return -ENXIO;
 
         /* nested journal transaction */
-        rc = llog_add(ctxt, &rec->cr_hdr, NULL, NULL, 0);
+       rc = llog_add(NULL, ctxt, &rec->cr_hdr, NULL, NULL, 0);
         llog_ctxt_put(ctxt);
 
         return rc;
@@ -357,7 +357,7 @@ int mdd_changelog_ext_llog_write(struct mdd_device *mdd,
                return -ENXIO;
 
        /* nested journal transaction */
-       rc = llog_add(ctxt, &rec->cr_hdr, NULL, NULL, 0);
+       rc = llog_add(NULL, ctxt, &rec->cr_hdr, NULL, NULL, 0);
        llog_ctxt_put(ctxt);
 
        return rc;
@@ -369,7 +369,8 @@ int mdd_changelog_ext_llog_write(struct mdd_device *mdd,
  * \param endrec
  * \retval 0 ok
  */
-int mdd_changelog_llog_cancel(struct mdd_device *mdd, long long endrec)
+int mdd_changelog_llog_cancel(const struct lu_env *env,
+                             struct mdd_device *mdd, long long endrec)
 {
         struct obd_device *obd = mdd2obd_dev(mdd);
         struct llog_ctxt *ctxt;
@@ -407,7 +408,7 @@ int mdd_changelog_llog_cancel(struct mdd_device *mdd, long long endrec)
         mdd->mdd_cl.mc_starttime = cfs_time_current_64();
 
         /* XXX: transaction is started by llog itself */
-        rc = llog_cancel(ctxt, NULL, 1, (struct llog_cookie *)&endrec, 0);
+       rc = llog_cancel(env, ctxt, NULL, 1, (struct llog_cookie *)&endrec, 0);
 out:
         llog_ctxt_put(ctxt);
         return rc;
@@ -1383,7 +1384,7 @@ static int mdd_changelog_user_register(struct mdd_device *mdd, int *id)
         rec->cur_endrec = mdd->mdd_cl.mc_index;
         cfs_spin_unlock(&mdd->mdd_cl.mc_user_lock);
 
-        rc = llog_add(ctxt, &rec->cur_hdr, NULL, NULL, 0);
+       rc = llog_add(NULL, ctxt, &rec->cur_hdr, NULL, NULL, 0);
 
         CDEBUG(D_IOCTL, "Registered changelog user %d\n", *id);
 out:
@@ -1494,8 +1495,8 @@ static int mdd_changelog_user_purge_cb(const struct lu_env *env,
                 if (rc)
                         GOTO(stop, rc);
 
-                rc = llog_cat_cancel_records(llh->u.phd.phd_cat_handle,
-                                             1, &cookie);
+               rc = llog_cat_cancel_records(env, llh->u.phd.phd_cat_handle,
+                                            1, &cookie);
                 if (rc == 0)
                         mcud->mcud_usercount--;
 
@@ -1510,8 +1511,8 @@ stop:
 
         /* hdr+1 is loc of data */
         hdr->lrh_len -= sizeof(*hdr) + sizeof(struct llog_rec_tail);
-        rc = llog_write_rec(llh, hdr, NULL, 0, (void *)(hdr + 1),
-                            hdr->lrh_index);
+       rc = llog_write_rec(env, llh, hdr, NULL, 0, (void *)(hdr + 1),
+                           hdr->lrh_index);
 
         RETURN(rc);
 }
@@ -1553,7 +1554,7 @@ static int mdd_changelog_user_purge(const struct lu_env *env,
                 CDEBUG(D_IOCTL, "Purging changelog entries up to "LPD64
                        ", referenced by "CHANGELOG_USER_PREFIX"%d\n",
                        data.mcud_minrec, data.mcud_minid);
-                rc = mdd_changelog_llog_cancel(mdd, data.mcud_minrec);
+               rc = mdd_changelog_llog_cancel(env, mdd, data.mcud_minrec);
         } else {
                 CWARN("Could not determine changelog records to purge; rc=%d\n",
                       rc);
index 96181ba..e1a3169 100644 (file)
@@ -485,7 +485,8 @@ int mdd_changelog_llog_write(struct mdd_device         *mdd,
 int mdd_changelog_ext_llog_write(struct mdd_device *mdd,
                                 struct llog_changelog_ext_rec *rec,
                                 struct thandle *handle);
-int mdd_changelog_llog_cancel(struct mdd_device *mdd, long long endrec);
+int mdd_changelog_llog_cancel(const struct lu_env *env, struct mdd_device *mdd,
+                             long long endrec);
 int mdd_changelog_write_header(struct mdd_device *mdd, int markerflags);
 int mdd_changelog_on(struct mdd_device *mdd, int on);
 
index 8242307..681543c 100644 (file)
@@ -782,8 +782,8 @@ int mdd_log_op_setattr(struct obd_device *obd, __u32 uid, __u32 gid,
 
         /* write setattr log */
         ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
-        rc = llog_add(ctxt, &lsr->lsr_hdr, lsm, logcookies,
-                      cookies_size / sizeof(struct llog_cookie));
+       rc = llog_add(NULL, ctxt, &lsr->lsr_hdr, lsm, logcookies,
+                     cookies_size / sizeof(struct llog_cookie));
 
         llog_ctxt_put(ctxt);
 
index 168e81a..225b33f 100644 (file)
 #include <lustre_log.h>
 #include "mds_internal.h"
 
-static int mds_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
-                               struct lov_stripe_md *lsm,
-                               struct llog_cookie *logcookies, int numcookies)
+static int mds_llog_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 obd_device *obd = ctxt->loc_obd;
         struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
@@ -63,7 +65,7 @@ static int mds_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
         ENTRY;
 
         lctxt = llog_get_context(lov_obd, ctxt->loc_idx);
-        rc = llog_add(lctxt, rec, lsm, logcookies, numcookies);
+       rc = llog_add(env, lctxt, rec, lsm, logcookies, numcookies);
         llog_ctxt_put(lctxt);
 
         RETURN(rc);
@@ -91,8 +93,11 @@ static struct llog_operations mds_ost_orig_logops = {
         lop_connect:    mds_llog_origin_connect,
 };
 
-static int mds_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm,
-                          int count, struct llog_cookie *cookies, int flags)
+static int mds_llog_repl_cancel(const struct lu_env *env,
+                               struct llog_ctxt *ctxt,
+                               struct lov_stripe_md *lsm,
+                               int count, struct llog_cookie *cookies,
+                               int flags)
 {
         struct obd_device *obd = ctxt->loc_obd;
         struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
@@ -101,7 +106,7 @@ static int mds_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *ls
         ENTRY;
 
         lctxt = llog_get_context(lov_obd, ctxt->loc_idx);
-        rc = llog_cancel(lctxt, lsm, count, cookies, flags);
+       rc = llog_cancel(env, lctxt, lsm, count, cookies, flags);
         llog_ctxt_put(lctxt);
         RETURN(rc);
 }
@@ -154,7 +159,8 @@ static int llog_changelog_cancel_cb(const struct lu_env *env,
         /* cancel them one at a time.  I suppose we could store up the cookies
            and cancel them all at once; probably more efficient, but this is
            done as a user call, so who cares... */
-        rc = llog_cat_cancel_records(llh->u.phd.phd_cat_handle, 1, &cookie);
+       rc = llog_cat_cancel_records(env, llh->u.phd.phd_cat_handle, 1,
+                                    &cookie);
 
         err = fsfilt_commit(obd, inode, trans_h, 0);
         if (err) {
@@ -165,9 +171,10 @@ static int llog_changelog_cancel_cb(const struct lu_env *env,
         RETURN(rc < 0 ? rc : 0);
 }
 
-static int llog_changelog_cancel(struct llog_ctxt *ctxt,
-                                 struct lov_stripe_md *lsm, int count,
-                                 struct llog_cookie *cookies, int flags)
+static int llog_changelog_cancel(const struct lu_env *env,
+                                struct llog_ctxt *ctxt,
+                                struct lov_stripe_md *lsm, int count,
+                                struct llog_cookie *cookies, int flags)
 {
         struct llog_handle *cathandle = ctxt->loc_handle;
         int rc;
@@ -176,7 +183,7 @@ static int llog_changelog_cancel(struct llog_ctxt *ctxt,
         /* This should only be called with the catalog handle */
         LASSERT(cathandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
 
-       rc = llog_cat_process(NULL, cathandle, llog_changelog_cancel_cb,
+       rc = llog_cat_process(env, cathandle, llog_changelog_cancel_cb,
                              (void *)cookies, 0, 0);
         if (rc >= 0)
                 /* 0 or 1 means we're done */
@@ -307,7 +314,7 @@ static int mds_llog_add_unlink(struct obd_device *obd,
         lur->lur_count = count;
 
         ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
-        rc = llog_add(ctxt, &lur->lur_hdr, lsm, logcookie, cookies);
+       rc = llog_add(NULL, ctxt, &lur->lur_hdr, lsm, logcookie, cookies);
         llog_ctxt_put(ctxt);
 
         OBD_FREE_PTR(lur);
index ae89379..6364022 100644 (file)
@@ -1558,22 +1558,22 @@ out:
 
 /* identical to mgs_log_is_empty */
 static int mgc_llog_is_empty(struct obd_device *obd, struct llog_ctxt *ctxt,
-                            char *name)
+                            char *name)
 {
-        struct lvfs_run_ctxt saved;
-        struct llog_handle *llh;
-        int rc = 0;
-
-        push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_create(ctxt, &llh, NULL, name);
-        if (rc == 0) {
-                llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
-                rc = llog_get_size(llh);
-                llog_close(llh);
-        }
-        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        /* header is record 1 */
-        return(rc <= 1);
+       struct lvfs_run_ctxt     saved;
+       struct llog_handle      *llh;
+       int                      rc = 0;
+
+       push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
+       if (rc == 0) {
+               llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
+               rc = llog_get_size(llh);
+               llog_close(NULL, llh);
+       }
+       pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+       /* header is record 1 */
+       return (rc <= 1);
 }
 
 static int mgc_copy_handler(const struct lu_env *env, struct llog_handle *llh,
@@ -1588,7 +1588,7 @@ static int mgc_copy_handler(const struct lu_env *env, struct llog_handle *llh,
 
         /* Append all records */
         local_rec.lrh_len -= sizeof(*rec) + sizeof(struct llog_rec_tail);
-        rc = llog_write_rec(local_llh, &local_rec, NULL, 0,
+       rc = llog_write_rec(env, local_llh, &local_rec, NULL, 0,
                             (void *)cfg_buf, -1);
 
         lcfg = (struct lustre_cfg *)cfg_buf;
@@ -1618,35 +1618,35 @@ static int mgc_copy_llog(struct obd_device *obd, struct llog_ctxt *rctxt,
         sprintf(temp_log, "%sT", logname);
 
         /* Make sure there's no old temp log */
-        rc = llog_create(lctxt, &local_llh, NULL, temp_log);
-        if (rc)
-                GOTO(out, rc);
-        rc = llog_init_handle(local_llh, LLOG_F_IS_PLAIN, NULL);
-        if (rc)
-                GOTO(out, rc);
-        rc = llog_destroy(local_llh);
+       rc = llog_create(NULL, lctxt, &local_llh, NULL, temp_log);
+       if (rc)
+               GOTO(out, rc);
+       rc = llog_init_handle(NULL, local_llh, LLOG_F_IS_PLAIN, NULL);
+       if (rc)
+               GOTO(out, rc);
+       rc = llog_destroy(NULL, local_llh);
         llog_free_handle(local_llh);
         if (rc)
                 GOTO(out, rc);
 
         /* open local log */
-        rc = llog_create(lctxt, &local_llh, NULL, temp_log);
+       rc = llog_create(NULL, lctxt, &local_llh, NULL, temp_log);
         if (rc)
                 GOTO(out, rc);
 
         /* set the log header uuid for fun */
         OBD_ALLOC_PTR(uuid);
         obd_str2uuid(uuid, logname);
-        rc = llog_init_handle(local_llh, LLOG_F_IS_PLAIN, uuid);
+       rc = llog_init_handle(NULL, local_llh, LLOG_F_IS_PLAIN, uuid);
         OBD_FREE_PTR(uuid);
         if (rc)
                 GOTO(out_closel, rc);
 
         /* open remote log */
-        rc = llog_create(rctxt, &remote_llh, NULL, logname);
-        if (rc)
-                GOTO(out_closel, rc);
-        rc = llog_init_handle(remote_llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_create(NULL, rctxt, &remote_llh, NULL, logname);
+       if (rc)
+               GOTO(out_closel, rc);
+       rc = llog_init_handle(NULL, remote_llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_closer, rc);
 
@@ -1655,11 +1655,11 @@ static int mgc_copy_llog(struct obd_device *obd, struct llog_ctxt *rctxt,
                          (void *)local_llh, NULL);
 
 out_closer:
-        rc2 = llog_close(remote_llh);
-        if (!rc)
-                rc = rc2;
+       rc2 = llog_close(NULL, remote_llh);
+       if (!rc)
+               rc = rc2;
 out_closel:
-        rc2 = llog_close(local_llh);
+       rc2 = llog_close(NULL, local_llh);
         if (!rc)
                 rc = rc2;
 
index 883c251..98a1108 100644 (file)
@@ -275,11 +275,11 @@ static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb)
         name_create(&logname, fsdb->fsdb_name, "-client");
         cfs_mutex_lock(&fsdb->fsdb_mutex);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_create(ctxt, &loghandle, NULL, logname);
-        if (rc)
-                GOTO(out_pop, rc);
+       rc = llog_create(NULL, ctxt, &loghandle, NULL, logname);
+       if (rc)
+               GOTO(out_pop, rc);
 
-        rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -288,9 +288,9 @@ static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb)
 
        rc = llog_process(NULL, loghandle, mgs_fsdb_handler, (void *) &d,
                          NULL);
-        CDEBUG(D_INFO, "get_db = %d\n", rc);
+       CDEBUG(D_INFO, "get_db = %d\n", rc);
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(NULL, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -657,8 +657,8 @@ static int mgs_modify_handler(const struct lu_env *env,
                 /* Header and tail are added back to lrh_len in
                    llog_lvfs_write_rec */
                 rec->lrh_len = cfg_len;
-                rc = llog_write_rec(llh, rec, NULL, 0, (void *)lcfg,
-                                    rec->lrh_index);
+               rc = llog_write_rec(NULL, llh, rec, NULL, 0, (void *)lcfg,
+                                   rec->lrh_index);
                 if (!rc)
                          mml->mml_modified++;
         }
@@ -685,11 +685,11 @@ static int mgs_modify(struct obd_device *obd, struct fs_db *fsdb,
 
         ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
         LASSERT(ctxt != NULL);
-        rc = llog_create(ctxt, &loghandle, NULL, logname);
+       rc = llog_create(NULL, ctxt, &loghandle, NULL, logname);
         if (rc)
                 GOTO(out_pop, rc);
 
-        rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -712,7 +712,7 @@ static int mgs_modify(struct obd_device *obd, struct fs_db *fsdb,
         OBD_FREE_PTR(mml);
 
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(NULL, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -745,7 +745,7 @@ static int record_lcfg(struct obd_device *obd, struct llog_handle *llh,
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         /* idx = -1 means append */
-        rc = llog_write_rec(llh, &rec, NULL, 0, (void *)lcfg, -1);
+       rc = llog_write_rec(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         if (rc)
                 CERROR("failed %d\n", rc);
@@ -927,11 +927,11 @@ static int record_start_log(struct obd_device *obd,
                 GOTO(out, rc = -ENODEV);
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_create(ctxt, llh, NULL, name);
-        if (rc == 0)
-                llog_init_handle(*llh, LLOG_F_IS_PLAIN, &cfg_uuid);
-        else
-                *llh = NULL;
+       rc = llog_create(NULL, ctxt, llh, NULL, name);
+       if (rc == 0)
+               llog_init_handle(NULL, *llh, LLOG_F_IS_PLAIN, &cfg_uuid);
+       else
+               *llh = NULL;
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         llog_ctxt_put(ctxt);
@@ -950,7 +950,7 @@ static int record_end_log(struct obd_device *obd, struct llog_handle **llh)
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_close(*llh);
+       rc = llog_close(NULL, *llh);
         *llh = NULL;
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
@@ -967,11 +967,11 @@ static int mgs_log_is_empty(struct obd_device *obd, char *name)
         ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
         LASSERT(ctxt != NULL);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_create(ctxt, &llh, NULL, name);
+        rc = llog_create(NULL, ctxt, &llh, NULL, name);
         if (rc == 0) {
-                llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
-                rc = llog_get_size(llh);
-                llog_close(llh);
+               llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
+               rc = llog_get_size(llh);
+               llog_close(NULL, llh);
         }
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         llog_ctxt_put(ctxt);
@@ -1262,11 +1262,11 @@ static int mgs_steal_llog_for_mdt_from_client(struct obd_device *obd,
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, NULL, client_name);
+       rc = llog_create(NULL, ctxt, &loghandle, NULL, client_name);
         if (rc)
                 GOTO(out_pop, rc);
 
-        rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -1274,7 +1274,7 @@ static int mgs_steal_llog_for_mdt_from_client(struct obd_device *obd,
                          (void *)comp, NULL);
         CDEBUG(D_MGS, "steal llog re = %d\n", rc);
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(NULL, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -2384,11 +2384,11 @@ int mgs_get_fsdb_srpc_from_llog(struct obd_device *obd,
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &llh, NULL, logname);
+       rc = llog_create(NULL, ctxt, &llh, NULL, logname);
         if (rc)
                 GOTO(out_pop, rc);
 
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -2402,7 +2402,7 @@ int mgs_get_fsdb_srpc_from_llog(struct obd_device *obd,
                          NULL);
 
 out_close:
-        llog_close(llh);
+       llog_close(NULL, llh);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 out:
@@ -2901,10 +2901,10 @@ int mgs_erase_log(struct obd_device *obd, char *name)
         LASSERT(ctxt != NULL);
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_create(ctxt, &llh, NULL, name);
-        if (rc == 0) {
-                llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
-                rc = llog_destroy(llh);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
+       if (rc == 0) {
+               llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
+               rc = llog_destroy(NULL, llh);
                 llog_free_handle(llh);
         }
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
index 8bde1b1..4411e0c 100644 (file)
@@ -92,7 +92,8 @@ out:
 EXPORT_SYMBOL(llog_free_handle);
 
 /* returns negative on error; 0 if success; 1 if success & log destroyed */
-int llog_cancel_rec(struct llog_handle *loghandle, int index)
+int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
+                   int index)
 {
         struct llog_log_hdr *llh = loghandle->lgh_hdr;
         int rc = 0;
@@ -119,7 +120,7 @@ int llog_cancel_rec(struct llog_handle *loghandle, int index)
             (llh->llh_count == 1) &&
             (loghandle->lgh_last_idx == (LLOG_BITMAP_BYTES * 8) - 1)) {
                cfs_spin_unlock(&loghandle->lgh_hdr_lock);
-               rc = llog_destroy(loghandle);
+               rc = llog_destroy(env, loghandle);
                if (rc < 0) {
                        CERROR("%s: can't destroy empty llog #"LPX64"#"LPX64
                               "#%08x: rc = %d\n",
@@ -133,7 +134,7 @@ int llog_cancel_rec(struct llog_handle *loghandle, int index)
        }
        cfs_spin_unlock(&loghandle->lgh_hdr_lock);
 
-       rc = llog_write_rec(loghandle, &llh->llh_hdr, NULL, 0, NULL, 0);
+       rc = llog_write_rec(env, loghandle, &llh->llh_hdr, NULL, 0, NULL, 0);
        if (rc < 0) {
                CERROR("%s: fail to write header for llog #"LPX64"#"LPX64
                       "#%08x: rc = %d\n",
@@ -153,8 +154,8 @@ out_err:
 }
 EXPORT_SYMBOL(llog_cancel_rec);
 
-int llog_init_handle(struct llog_handle *handle, int flags,
-                     struct obd_uuid *uuid)
+int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
+                    int flags, struct obd_uuid *uuid)
 {
         int rc;
         struct llog_log_hdr *llh;
@@ -167,7 +168,7 @@ int llog_init_handle(struct llog_handle *handle, int flags,
         handle->lgh_hdr = llh;
         /* first assign flags to use llog_client_ops */
         llh->llh_flags = flags;
-        rc = llog_read_header(handle);
+       rc = llog_read_header(env, handle);
         if (rc == 0) {
                 flags = llh->llh_flags;
                 if (uuid && !obd_uuid_equals(uuid, &llh->llh_tgtuuid)) {
@@ -213,7 +214,7 @@ out:
 }
 EXPORT_SYMBOL(llog_init_handle);
 
-int llog_close(struct llog_handle *loghandle)
+int llog_close(const struct lu_env *env, struct llog_handle *loghandle)
 {
         struct llog_operations *lop;
         int rc;
@@ -224,7 +225,7 @@ int llog_close(struct llog_handle *loghandle)
                 GOTO(out, rc);
         if (lop->lop_close == NULL)
                 GOTO(out, -EOPNOTSUPP);
-        rc = lop->lop_close(loghandle);
+       rc = lop->lop_close(env, loghandle);
  out:
         llog_free_handle(loghandle);
         RETURN(rc);
@@ -281,8 +282,8 @@ repeat:
                 /* get the buf with our target record; avoid old garbage */
                 memset(buf, 0, LLOG_CHUNK_SIZE);
                 last_offset = cur_offset;
-                rc = llog_next_block(loghandle, &saved_index, index,
-                                     &cur_offset, buf, LLOG_CHUNK_SIZE);
+               rc = llog_next_block(lpi->lpi_env, loghandle, &saved_index,
+                                    index, &cur_offset, buf, LLOG_CHUNK_SIZE);
                 if (rc)
                         GOTO(out, rc);
 
@@ -335,12 +336,13 @@ repeat:
                         if (ext2_test_bit(index, llh->llh_bitmap)) {
                                rc = lpi->lpi_cb(lpi->lpi_env, loghandle, rec,
                                                 lpi->lpi_cbdata);
-                                last_called_index = index;
-                                if (rc == LLOG_PROC_BREAK) {
-                                        GOTO(out, rc);
-                                } else if (rc == LLOG_DEL_RECORD) {
-                                        llog_cancel_rec(loghandle,
-                                                        rec->lrh_index);
+                               last_called_index = index;
+                               if (rc == LLOG_PROC_BREAK) {
+                                       GOTO(out, rc);
+                               } else if (rc == LLOG_DEL_RECORD) {
+                                       llog_cancel_rec(lpi->lpi_env,
+                                                       loghandle,
+                                                       rec->lrh_index);
                                         rc = 0;
                                 }
                                 if (rc)
@@ -487,11 +489,12 @@ int llog_reverse_process(const struct lu_env *env,
 
                 /* get the buf with our target record; avoid old garbage */
                 memset(buf, 0, LLOG_CHUNK_SIZE);
-                rc = llog_prev_block(loghandle, index, buf, LLOG_CHUNK_SIZE);
-                if (rc)
-                        GOTO(out, rc);
+               rc = llog_prev_block(env, loghandle, index, buf,
+                                    LLOG_CHUNK_SIZE);
+               if (rc)
+                       GOTO(out, rc);
 
-                rec = buf;
+               rec = buf;
                idx = rec->lrh_index;
                CDEBUG(D_RPCTRACE, "index %u : idx %u\n", index, idx);
                 while (idx < index) {
@@ -517,7 +520,7 @@ int llog_reverse_process(const struct lu_env *env,
                                if (rc == LLOG_PROC_BREAK) {
                                        GOTO(out, rc);
                                } else if (rc == LLOG_DEL_RECORD) {
-                                       llog_cancel_rec(loghandle,
+                                       llog_cancel_rec(env, loghandle,
                                                        tail->lrt_index);
                                        rc = 0;
                                }
index bccdfc5..3bbb801 100644 (file)
@@ -58,7 +58,8 @@
  *
  * Assumes caller has already pushed us into the kernel context and is locking.
  */
-static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
+static struct llog_handle *llog_cat_new_log(const struct lu_env *env,
+                                           struct llog_handle *cathandle)
 {
         struct llog_handle *loghandle;
         struct llog_log_hdr *llh;
@@ -80,11 +81,11 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
                 RETURN(ERR_PTR(-ENOSPC));
 
-        rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL);
-        if (rc)
-                RETURN(ERR_PTR(rc));
+       rc = llog_create(env, cathandle->lgh_ctxt, &loghandle, NULL, NULL);
+       if (rc)
+               RETURN(ERR_PTR(rc));
 
-        rc = llog_init_handle(loghandle,
+       rc = llog_init_handle(env, loghandle,
                               LLOG_F_IS_PLAIN | LLOG_F_ZAP_WHEN_EMPTY,
                               &cathandle->lgh_hdr->llh_tgtuuid);
         if (rc)
@@ -118,7 +119,7 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
         rec.lid_tail.lrt_index = index;
 
         /* update the catalog: header and record */
-        rc = llog_write_rec(cathandle, &rec.lid_hdr,
+       rc = llog_write_rec(env, cathandle, &rec.lid_hdr,
                             &loghandle->u.phd.phd_cookie, 1, NULL, index);
         if (rc < 0) {
                 GOTO(out_destroy, rc);
@@ -131,10 +132,10 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
                           &cathandle->u.chd.chd_head);
 
 out_destroy:
-        if (rc < 0)
-                llog_destroy(loghandle);
+       if (rc < 0)
+               llog_destroy(env, loghandle);
 
-        RETURN(loghandle);
+       RETURN(loghandle);
 }
 
 /* Open an existent log handle and add it to the open list.
@@ -143,8 +144,8 @@ out_destroy:
  * Assumes caller has already pushed us into the kernel context and is locking.
  * We return a lock on the handle to ensure nobody yanks it from us.
  */
-int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
-                       struct llog_logid *logid)
+int llog_cat_id2handle(const struct lu_env *env, struct llog_handle *cathandle,
+                      struct llog_handle **res, struct llog_logid *logid)
 {
         struct llog_handle *loghandle;
         int rc = 0;
@@ -156,6 +157,7 @@ int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
         cfs_list_for_each_entry(loghandle, &cathandle->u.chd.chd_head,
                                 u.phd.phd_entry) {
                 struct llog_logid *cgl = &loghandle->lgh_id;
+
                 if (cgl->lgl_oid == logid->lgl_oid) {
                         if (cgl->lgl_ogen != logid->lgl_ogen) {
                                 CERROR("log "LPX64" generation %x != %x\n",
@@ -168,12 +170,12 @@ int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
                 }
         }
 
-        rc = llog_create(cathandle->lgh_ctxt, &loghandle, logid, NULL);
-        if (rc) {
-                CERROR("error opening log id "LPX64":%x: rc %d\n",
-                       logid->lgl_oid, logid->lgl_ogen, rc);
-        } else {
-                rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_create(env, cathandle->lgh_ctxt, &loghandle, logid, NULL);
+       if (rc) {
+               CERROR("error opening log id "LPX64":%x: rc %d\n",
+                      logid->lgl_oid, logid->lgl_ogen, rc);
+       } else {
+               rc = llog_init_handle(env, loghandle, LLOG_F_IS_PLAIN, NULL);
                 if (!rc) {
                         cfs_list_add(&loghandle->u.phd.phd_entry,
                                      &cathandle->u.chd.chd_head);
@@ -191,20 +193,21 @@ out:
         RETURN(rc);
 }
 
-int llog_cat_put(struct llog_handle *cathandle)
+int llog_cat_put(const struct lu_env *env, struct llog_handle *cathandle)
 {
-        struct llog_handle *loghandle, *n;
-        int rc;
-        ENTRY;
+       struct llog_handle      *loghandle, *n;
+       int                      rc;
 
-        cfs_list_for_each_entry_safe(loghandle, n, &cathandle->u.chd.chd_head,
-                                     u.phd.phd_entry) {
-                int err = llog_close(loghandle);
-                if (err)
-                        CERROR("error closing loghandle\n");
-        }
-        rc = llog_close(cathandle);
-        RETURN(rc);
+       ENTRY;
+
+       cfs_list_for_each_entry_safe(loghandle, n, &cathandle->u.chd.chd_head,
+                                    u.phd.phd_entry) {
+               int err = llog_close(env, loghandle);
+               if (err)
+                       CERROR("error closing loghandle\n");
+       }
+       rc = llog_close(env, cathandle);
+       RETURN(rc);
 }
 EXPORT_SYMBOL(llog_cat_put);
 
@@ -226,8 +229,9 @@ enum {
  *
  * NOTE: loghandle is write-locked upon successful return
  */
-static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
-                                                int create)
+static struct llog_handle *llog_cat_current_log(const struct lu_env *env,
+                                               struct llog_handle *cathandle,
+                                               int create)
 {
         struct llog_handle *loghandle = NULL;
         ENTRY;
@@ -236,6 +240,7 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
         loghandle = cathandle->u.chd.chd_current_log;
         if (loghandle) {
                 struct llog_log_hdr *llh = loghandle->lgh_hdr;
+
                 cfs_down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
                 if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
                         cfs_up_read(&cathandle->lgh_lock);
@@ -259,6 +264,7 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
         loghandle = cathandle->u.chd.chd_current_log;
         if (loghandle) {
                 struct llog_log_hdr *llh = loghandle->lgh_hdr;
+
                 cfs_down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
                 if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
                         cfs_up_write(&cathandle->lgh_lock);
@@ -269,7 +275,7 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
         }
 
         CDEBUG(D_INODE, "creating new log\n");
-        loghandle = llog_cat_new_log(cathandle);
+       loghandle = llog_cat_new_log(env, cathandle);
         if (!IS_ERR(loghandle))
                 cfs_down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
         cfs_up_write(&cathandle->lgh_lock);
@@ -281,28 +287,30 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
  *
  * Assumes caller has already pushed us into the kernel context.
  */
-int llog_cat_add_rec(struct llog_handle *cathandle, struct llog_rec_hdr *rec,
-                     struct llog_cookie *reccookie, void *buf)
+int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
+                    struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
+                    void *buf)
 {
         struct llog_handle *loghandle;
         int rc;
         ENTRY;
 
         LASSERT(rec->lrh_len <= LLOG_CHUNK_SIZE);
-        loghandle = llog_cat_current_log(cathandle, 1);
-        if (IS_ERR(loghandle))
-                RETURN(PTR_ERR(loghandle));
-        /* loghandle is already locked by llog_cat_current_log() for us */
-        rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1);
+       loghandle = llog_cat_current_log(env, cathandle, 1);
+       if (IS_ERR(loghandle))
+               RETURN(PTR_ERR(loghandle));
+       /* loghandle is already locked by llog_cat_current_log() for us */
+       rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf, -1);
         if (rc < 0)
                 CERROR("llog_write_rec %d: lh=%p\n", rc, loghandle);
         cfs_up_write(&loghandle->lgh_lock);
         if (rc == -ENOSPC) {
                 /* to create a new plain log */
-                loghandle = llog_cat_current_log(cathandle, 1);
-                if (IS_ERR(loghandle))
-                        RETURN(PTR_ERR(loghandle));
-                rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1);
+               loghandle = llog_cat_current_log(env, cathandle, 1);
+               if (IS_ERR(loghandle))
+                       RETURN(PTR_ERR(loghandle));
+               rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf,
+                                   -1);
                 cfs_up_write(&loghandle->lgh_lock);
         }
 
@@ -319,8 +327,9 @@ EXPORT_SYMBOL(llog_cat_add_rec);
  *
  * Assumes caller has already pushed us into the kernel context.
  */
-int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
-                            struct llog_cookie *cookies)
+int llog_cat_cancel_records(const struct lu_env *env,
+                           struct llog_handle *cathandle, int count,
+                           struct llog_cookie *cookies)
 {
         int i, index, rc = 0;
         ENTRY;
@@ -330,14 +339,14 @@ int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
                 struct llog_handle *loghandle;
                 struct llog_logid *lgl = &cookies->lgc_lgl;
 
-                rc = llog_cat_id2handle(cathandle, &loghandle, lgl);
-                if (rc) {
-                        CERROR("Cannot find log "LPX64"\n", lgl->lgl_oid);
-                        break;
-                }
+               rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
+               if (rc) {
+                       CERROR("Cannot find log "LPX64"\n", lgl->lgl_oid);
+                       break;
+               }
 
                 cfs_down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
-                rc = llog_cancel_rec(loghandle, cookies->lgc_index);
+               rc = llog_cancel_rec(env, loghandle, cookies->lgc_index);
                 cfs_up_write(&loghandle->lgh_lock);
 
                 if (rc == 1) {          /* log has been destroyed */
@@ -348,7 +357,7 @@ int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
 
                         LASSERT(index);
                         llog_cat_set_first_idx(cathandle, index);
-                        rc = llog_cancel_rec(cathandle, index);
+                       rc = llog_cancel_rec(env, cathandle, index);
                         if (rc == 0)
                                 CDEBUG(D_RPCTRACE,"cancel plain log at index %u"
                                        " of catalog "LPX64"\n",
@@ -378,7 +387,7 @@ int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh,
                LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
                rec->lrh_index, cat_llh->lgh_id.lgl_oid);
 
-        rc = llog_cat_id2handle(cat_llh, &llh, &lir->lid_id);
+       rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
         if (rc) {
                 CERROR("Cannot find handle for log "LPX64"\n",
                        lir->lid_id.lgl_oid);
@@ -475,12 +484,12 @@ int llog_cat_process_thread(void *data)
        LASSERT(lgi);
 
        lgi->lgi_logid = *(struct llog_logid *)(args->lpca_arg);
-       rc = llog_create(ctxt, &llh, &lgi->lgi_logid, NULL);
+       rc = llog_create(&env, ctxt, &llh, &lgi->lgi_logid, NULL);
         if (rc) {
                 CERROR("llog_create() failed %d\n", rc);
                GOTO(out_env, rc);
         }
-        rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
+       rc = llog_init_handle(&env, llh, LLOG_F_IS_CAT, NULL);
         if (rc) {
                 CERROR("llog_init_handle failed %d\n", rc);
                 GOTO(release_llh, rc);
@@ -501,7 +510,7 @@ int llog_cat_process_thread(void *data)
        llog_sync(ctxt, NULL, 0);
         GOTO(release_llh, rc);
 release_llh:
-        rc = llog_cat_put(llh);
+       rc = llog_cat_put(&env, llh);
         if (rc)
                 CERROR("llog_cat_put() failed %d\n", rc);
 out_env:
@@ -531,7 +540,7 @@ static int llog_cat_reverse_process_cb(const struct lu_env *env,
                LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
                le32_to_cpu(rec->lrh_index), cat_llh->lgh_id.lgl_oid);
 
-        rc = llog_cat_id2handle(cat_llh, &llh, &lir->lid_id);
+       rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
         if (rc) {
                 CERROR("Cannot find handle for log "LPX64"\n",
                        lir->lid_id.lgl_oid);
@@ -635,7 +644,7 @@ int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
               LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
               rec->lrh_index, cathandle->lgh_id.lgl_oid);
 
-       rc = llog_cat_id2handle(cathandle, &loghandle, &lir->lid_id);
+       rc = llog_cat_id2handle(env, cathandle, &loghandle, &lir->lid_id);
        if (rc) {
                CERROR("%s: cannot find handle for llog "LPX64"\n",
                       loghandle->lgh_ctxt->loc_obd->obd_name,
@@ -650,7 +659,7 @@ int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
        llh = loghandle->lgh_hdr;
        if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
            (llh->llh_count == 1)) {
-               rc = llog_destroy(loghandle);
+               rc = llog_destroy(env, loghandle);
                if (rc)
                        CERROR("%s: fail to destroy empty log: rc = %d\n",
                               loghandle->lgh_ctxt->loc_obd->obd_name, rc);
@@ -661,7 +670,7 @@ int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
 cat_cleanup:
                LASSERT(index);
                llog_cat_set_first_idx(cathandle, index);
-               rc = llog_cancel_rec(cathandle, index);
+               rc = llog_cancel_rec(env, cathandle, index);
                if (rc == 0)
                        CDEBUG(D_HA,
                               "cancel log "LPX64":%x at index %u of catalog "
index 9960237..0e8d3b2 100644 (file)
@@ -79,8 +79,8 @@ static inline struct llog_thread_info *llog_info(const struct lu_env *env)
 int llog_info_init(void);
 void llog_info_fini(void);
 
-int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
-                       struct llog_logid *logid);
+int llog_cat_id2handle(const struct lu_env *env, struct llog_handle *cathandle,
+                      struct llog_handle **res, struct llog_logid *logid);
 int class_config_dump_handler(const struct lu_env *env,
                              struct llog_handle *handle,
                              struct llog_rec_hdr *rec, void *data);
index 6d2383f..afbb34a 100644 (file)
@@ -127,7 +127,8 @@ static int llog_check_cb(const struct lu_env *env, struct llog_handle *handle,
                 }
                 if (handle->lgh_ctxt == NULL)
                         RETURN(-EOPNOTSUPP);
-                rc = llog_cat_id2handle(handle, &log_handle, &lir->lid_id);
+               rc = llog_cat_id2handle(env, handle, &log_handle,
+                                       &lir->lid_id);
                 if (rc) {
                         CDEBUG(D_IOCTL,
                                "cannot find log #"LPX64"#"LPX64"#%08x\n",
@@ -136,7 +137,7 @@ static int llog_check_cb(const struct lu_env *env, struct llog_handle *handle,
                         RETURN(rc);
                 }
                rc = llog_process(env, log_handle, llog_check_cb, NULL, NULL);
-                llog_close(log_handle);
+               llog_close(env, log_handle);
         } else {
                 switch (rec->lrh_type) {
                 case OST_SZ_REC:
@@ -233,14 +234,15 @@ static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle,
 
         RETURN(0);
 }
-static int llog_remove_log(struct llog_handle *cat, struct llog_logid *logid)
+static int llog_remove_log(const struct lu_env *env, struct llog_handle *cat,
+                          struct llog_logid *logid)
 {
         struct llog_handle *log;
         int rc, index = 0;
 
         ENTRY;
         cfs_down_write(&cat->lgh_lock);
-        rc = llog_cat_id2handle(cat, &log, logid);
+       rc = llog_cat_id2handle(env, cat, &log, logid);
         if (rc) {
                 CDEBUG(D_IOCTL, "cannot find log #"LPX64"#"LPX64"#%08x\n",
                        logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen);
@@ -249,13 +251,13 @@ static int llog_remove_log(struct llog_handle *cat, struct llog_logid *logid)
 
         index = log->u.phd.phd_cookie.lgc_index;
         LASSERT(index);
-        rc = llog_destroy(log);
+       rc = llog_destroy(env, log);
         if (rc) {
                 CDEBUG(D_IOCTL, "cannot destroy log\n");
                 GOTO(out, rc);
         }
         llog_cat_set_first_idx(cat, index);
-        rc = llog_cancel_rec(cat, index);
+       rc = llog_cancel_rec(env, cat, index);
 out:
         llog_free_handle(log);
         cfs_up_write(&cat->lgh_lock);
@@ -272,7 +274,7 @@ static int llog_delete_cb(const struct lu_env *env, struct llog_handle *handle,
         ENTRY;
         if (rec->lrh_type != LLOG_LOGID_MAGIC)
               RETURN (-EINVAL);
-        rc = llog_remove_log(handle, &lir->lid_id);
+       rc = llog_remove_log(env, handle, &lir->lid_id);
 
         RETURN(rc);
 }
@@ -289,19 +291,19 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
                 err = str2logid(&logid, data->ioc_inlbuf1, data->ioc_inllen1);
                 if (err)
                         GOTO(out, err);
-                err = llog_create(ctxt, &handle, &logid, NULL);
+               err = llog_create(NULL, ctxt, &handle, &logid, NULL);
                 if (err)
                         GOTO(out, err);
         } else if (*data->ioc_inlbuf1 == '$') {
                 char *name = data->ioc_inlbuf1 + 1;
-                err = llog_create(ctxt, &handle, NULL, name);
+               err = llog_create(NULL, ctxt, &handle, NULL, name);
                 if (err)
                         GOTO(out, err);
         } else {
                 GOTO(out, err = -EINVAL);
         }
 
-        err = llog_init_handle(handle, 0, NULL);
+       err = llog_init_handle(NULL, handle, 0, NULL);
         if (err)
                 GOTO(out_close, err = -ENOENT);
 
@@ -309,7 +311,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
         case OBD_IOC_LLOG_INFO: {
                 int l;
                 int remains = data->ioc_inllen2 +
-                        cfs_size_round(data->ioc_inllen1);
+                             cfs_size_round(data->ioc_inllen1);
                 char *out = data->ioc_bulk;
 
                 l = snprintf(out, remains,
@@ -362,7 +364,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
 
                 if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
                         cfs_down_write(&handle->lgh_lock);
-                        err = llog_cancel_rec(handle, cookie.lgc_index);
+                       err = llog_cancel_rec(NULL, handle, cookie.lgc_index);
                         cfs_up_write(&handle->lgh_lock);
                         GOTO(out_close, err);
                 }
@@ -375,14 +377,14 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
                 if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT))
                         GOTO(out_close, err = -EINVAL);
 
-                err = llog_cat_cancel_records(handle, 1, &cookie);
+               err = llog_cat_cancel_records(NULL, handle, 1, &cookie);
                 GOTO(out_close, err);
         }
         case OBD_IOC_LLOG_REMOVE: {
                 struct llog_logid plain;
 
                 if (handle->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN) {
-                        err = llog_destroy(handle);
+                        err = llog_destroy(NULL, handle);
                         if (!err)
                                 llog_free_handle(handle);
                         GOTO(out, err);
@@ -397,8 +399,8 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
                                         data->ioc_inllen2);
                         if (err)
                                 GOTO(out_close, err);
-                        err = llog_remove_log(handle, &plain);
-                } else {
+                       err = llog_remove_log(NULL, handle, &plain);
+               } else {
                        /* remove all the log of the catalog */
                        llog_process(NULL, handle, llog_delete_cb, NULL, NULL);
                 }
@@ -407,13 +409,13 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
         }
 
 out_close:
-        if (handle->lgh_hdr &&
-            handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)
-                llog_cat_put(handle);
-        else
-                llog_close(handle);
+       if (handle->lgh_hdr &&
+           handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)
+               llog_cat_put(NULL, handle);
+       else
+               llog_close(NULL, handle);
 out:
-        RETURN(err);
+       RETURN(err);
 }
 EXPORT_SYMBOL(llog_ioctl);
 
index cba0de9..a01582b 100644 (file)
@@ -159,7 +159,8 @@ static int llog_lvfs_read_blob(struct obd_device *obd, struct l_file *file,
         RETURN(0);
 }
 
-static int llog_lvfs_read_header(struct llog_handle *handle)
+static int llog_lvfs_read_header(const struct lu_env *env,
+                                struct llog_handle *handle)
 {
         struct obd_device *obd;
         int rc;
@@ -211,10 +212,11 @@ static int llog_lvfs_read_header(struct llog_handle *handle)
 
 /* returns negative in on error; 0 if success && reccookie == 0; 1 otherwise */
 /* appends if idx == -1, otherwise overwrites record idx. */
-static int llog_lvfs_write_rec(struct llog_handle *loghandle,
-                               struct llog_rec_hdr *rec,
-                               struct llog_cookie *reccookie, int cookiecount,
-                               void *buf, int idx)
+static int llog_lvfs_write_rec(const struct lu_env *env,
+                              struct llog_handle *loghandle,
+                              struct llog_rec_hdr *rec,
+                              struct llog_cookie *reccookie, int cookiecount,
+                              void *buf, int idx)
 {
         struct llog_log_hdr *llh;
         int reclen = rec->lrh_len, index, rc;
@@ -395,9 +397,10 @@ static void llog_skip_over(__u64 *off, int curr, int goal)
  *  - cur_idx to the log index preceeding cur_offset
  * returns -EIO/-EINVAL on error
  */
-static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
-                                int next_idx, __u64 *cur_offset, void *buf,
-                                int len)
+static int llog_lvfs_next_block(const struct lu_env *env,
+                               struct llog_handle *loghandle, int *cur_idx,
+                               int next_idx, __u64 *cur_offset, void *buf,
+                               int len)
 {
         int rc;
         ENTRY;
@@ -478,8 +481,9 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
         RETURN(-EIO);
 }
 
-static int llog_lvfs_prev_block(struct llog_handle *loghandle,
-                                int prev_idx, void *buf, int len)
+static int llog_lvfs_prev_block(const struct lu_env *env,
+                               struct llog_handle *loghandle,
+                               int prev_idx, void *buf, int len)
 {
         __u64 cur_offset;
         int rc;
@@ -576,8 +580,9 @@ static struct file *llog_filp_open(char *dir, char *name, int flags, int mode)
 
 /* This is a callback from the llog_* functions.
  * Assumes caller has already pushed us into the kernel context. */
-static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                            struct llog_logid *logid, char *name)
+static int llog_lvfs_create(const struct lu_env *env,
+                           struct llog_ctxt *ctxt, struct llog_handle **res,
+                           struct llog_logid *logid, char *name)
 {
         struct llog_handle *handle;
         struct obd_device *obd;
@@ -681,7 +686,8 @@ out:
         RETURN(rc);
 }
 
-static int llog_lvfs_close(struct llog_handle *handle)
+static int llog_lvfs_close(const struct lu_env *env,
+                          struct llog_handle *handle)
 {
         int rc;
         ENTRY;
@@ -692,7 +698,8 @@ static int llog_lvfs_close(struct llog_handle *handle)
         RETURN(rc);
 }
 
-static int llog_lvfs_destroy(struct llog_handle *handle)
+static int llog_lvfs_destroy(const struct lu_env *env,
+                            struct llog_handle *handle)
 {
         struct dentry *fdentry;
         struct obdo *oa;
@@ -713,8 +720,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle)
 
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 dget(fdentry);
-                rc = llog_lvfs_close(handle);
-
+               rc = llog_lvfs_close(env, handle);
                if (rc == 0) {
                        mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
                        rc = ll_vfs_unlink(inode, fdentry, mnt);
@@ -737,7 +743,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle)
 #undef o_generation
         oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLGENER;
 
-        rc = llog_lvfs_close(handle);
+       rc = llog_lvfs_close(env, handle);
         if (rc)
                 GOTO(out, rc);
 
@@ -874,50 +880,57 @@ EXPORT_SYMBOL(llog_lvfs_ops);
 
 #else /* !__KERNEL__ */
 
-static int llog_lvfs_read_header(struct llog_handle *handle)
+static int llog_lvfs_read_header(const struct lu_env *env,
+                                struct llog_handle *handle)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_write_rec(struct llog_handle *loghandle,
-                               struct llog_rec_hdr *rec,
-                               struct llog_cookie *reccookie, int cookiecount,
-                               void *buf, int idx)
+static int llog_lvfs_write_rec(const struct lu_env *env,
+                              struct llog_handle *loghandle,
+                              struct llog_rec_hdr *rec,
+                              struct llog_cookie *reccookie, int cookiecount,
+                              void *buf, int idx)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
-                                int next_idx, __u64 *cur_offset, void *buf,
-                                int len)
+static int llog_lvfs_next_block(const struct lu_env *env,
+                               struct llog_handle *loghandle, int *cur_idx,
+                               int next_idx, __u64 *cur_offset, void *buf,
+                               int len)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_prev_block(struct llog_handle *loghandle,
-                                int prev_idx, void *buf, int len)
+static int llog_lvfs_prev_block(const struct lu_env *env,
+                               struct llog_handle *loghandle,
+                               int prev_idx, void *buf, int len)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                            struct llog_logid *logid, char *name)
+static int llog_lvfs_create(const struct lu_env *env,
+                           struct llog_ctxt *ctxt, struct llog_handle **res,
+                           struct llog_logid *logid, char *name)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_close(struct llog_handle *handle)
+static int llog_lvfs_close(const struct lu_env *env,
+                          struct llog_handle *handle)
 {
         LBUG();
         return 0;
 }
 
-static int llog_lvfs_destroy(struct llog_handle *handle)
+static int llog_lvfs_destroy(const struct lu_env *env,
+                            struct llog_handle *handle)
 {
         LBUG();
         return 0;
index 8cd7e46..372536f 100644 (file)
@@ -105,11 +105,11 @@ int __llog_ctxt_put(struct llog_ctxt *ctxt)
 
         /* cleanup the llog ctxt here */
         if (CTXTP(ctxt, cleanup))
-                rc = CTXTP(ctxt, cleanup)(ctxt);
+               rc = CTXTP(ctxt, cleanup)(NULL, ctxt);
 
-        llog_ctxt_destroy(ctxt);
-        cfs_waitq_signal(&olg->olg_waitq);
-        return rc;
+       llog_ctxt_destroy(ctxt);
+       cfs_waitq_signal(&olg->olg_waitq);
+       return rc;
 }
 EXPORT_SYMBOL(__llog_ctxt_put);
 
@@ -205,8 +205,8 @@ int llog_setup_named(struct obd_device *obd,  struct obd_llog_group *olg,
                 rc = -ENOTSUPP;
         } else {
                 if (op->lop_setup)
-                        rc = op->lop_setup(obd, olg, index, disk_obd, count,
-                                           logid, logname);
+                       rc = op->lop_setup(NULL, obd, olg, index, disk_obd,
+                                          count, logid, logname);
         }
 
         if (rc) {
@@ -246,9 +246,9 @@ int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
 }
 EXPORT_SYMBOL(llog_sync);
 
-int llog_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
-             struct lov_stripe_md *lsm, struct llog_cookie *logcookies,
-             int numcookies)
+int llog_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;
@@ -266,15 +266,17 @@ int llog_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
         raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
         if (!raised)
                 cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
-        rc = CTXTP(ctxt, add)(ctxt, rec, lsm, logcookies, numcookies);
+       rc = CTXTP(ctxt, add)(env, ctxt, rec, lsm, logcookies,
+                             numcookies);
         if (!raised)
                 cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_add);
 
-int llog_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm,
-                int count, struct llog_cookie *cookies, int flags)
+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;
         ENTRY;
@@ -285,16 +287,17 @@ int llog_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm,
         }
 
         CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
-        rc = CTXTP(ctxt, cancel)(ctxt, lsm, count, cookies, flags);
+       rc = CTXTP(ctxt, cancel)(env, ctxt, lsm, count, cookies, flags);
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_cancel);
 
 /* lop_setup method for filter/osc */
 // XXX how to set exports
-int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
-                          int index, struct obd_device *disk_obd, int count,
-                          struct llog_logid *logid, const char *name)
+int llog_obd_origin_setup(const struct lu_env *env, struct obd_device *obd,
+                         struct obd_llog_group *olg, int index,
+                         struct obd_device *disk_obd, int count,
+                         struct llog_logid *logid, const char *name)
 {
         struct llog_ctxt *ctxt;
         struct llog_handle *handle;
@@ -313,9 +316,9 @@ int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
                 RETURN(-ENODEV);
 
         if (logid && logid->lgl_oid) {
-                rc = llog_create(ctxt, &handle, logid, NULL);
+               rc = llog_create(env, ctxt, &handle, logid, NULL);
         } else {
-                rc = llog_create(ctxt, &handle, NULL, (char *)name);
+               rc = llog_create(env, ctxt, &handle, NULL, (char *)name);
                 if (!rc && logid)
                         *logid = handle->lgh_id;
         }
@@ -324,12 +327,12 @@ int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
 
         ctxt->loc_handle = handle;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
-        rc = llog_init_handle(handle, LLOG_F_IS_CAT, NULL);
+       rc = llog_init_handle(env, handle, LLOG_F_IS_CAT, NULL);
         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
         if (rc)
                 GOTO(out, rc);
 
-       rc = llog_process(NULL, handle, (llog_cb_t)cat_cancel_cb, NULL, NULL);
+       rc = llog_process(env, handle, (llog_cb_t)cat_cancel_cb, NULL, NULL);
         if (rc)
                 CERROR("llog_process() with cat_cancel_cb failed: %d\n", rc);
         GOTO(out, rc);
@@ -339,7 +342,7 @@ out:
 }
 EXPORT_SYMBOL(llog_obd_origin_setup);
 
-int llog_obd_origin_cleanup(struct llog_ctxt *ctxt)
+int llog_obd_origin_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt)
 {
         struct llog_handle *cathandle, *n, *loghandle;
         struct llog_log_hdr *llh;
@@ -358,7 +361,7 @@ int llog_obd_origin_cleanup(struct llog_ctxt *ctxt)
                         if ((llh->llh_flags &
                                 LLOG_F_ZAP_WHEN_EMPTY) &&
                             (llh->llh_count == 1)) {
-                                rc = llog_destroy(loghandle);
+                               rc = llog_destroy(env, loghandle);
                                 if (rc)
                                         CERROR("failure destroying log during "
                                                "cleanup: %d\n", rc);
@@ -368,23 +371,23 @@ int llog_obd_origin_cleanup(struct llog_ctxt *ctxt)
 
                                 LASSERT(index);
                                 llog_cat_set_first_idx(cathandle, index);
-                                rc = llog_cancel_rec(cathandle, index);
+                               rc = llog_cancel_rec(env, cathandle, index);
                                 if (rc == 0)
                                         CDEBUG(D_RPCTRACE, "cancel plain log at"
                                                "index %u of catalog "LPX64"\n",
                                                index,cathandle->lgh_id.lgl_oid);
                         }
                 }
-                llog_cat_put(ctxt->loc_handle);
+               llog_cat_put(env, ctxt->loc_handle);
         }
         RETURN(0);
 }
 EXPORT_SYMBOL(llog_obd_origin_cleanup);
 
 /* add for obdfilter/sz and mds/unlink */
-int llog_obd_origin_add(struct llog_ctxt *ctxt,
-                        struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
-                        struct llog_cookie *logcookies, int numcookies)
+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;
@@ -392,7 +395,7 @@ int llog_obd_origin_add(struct llog_ctxt *ctxt,
 
         cathandle = ctxt->loc_handle;
         LASSERT(cathandle != NULL);
-        rc = llog_cat_add_rec(cathandle, rec, logcookies, NULL);
+       rc = llog_cat_add_rec(env, cathandle, rec, logcookies, NULL);
         if (rc != 0 && rc != 1)
                 CERROR("write one catalog record failed: %d\n", rc);
         RETURN(rc);
index 66396f0..7027a4f 100644 (file)
@@ -99,20 +99,20 @@ static int llog_test_1(struct obd_device *obd, char *name)
         CWARN("1a: create a log with name: %s\n", name);
         LASSERT(ctxt);
 
-        rc = llog_create(ctxt, &llh, NULL, name);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
         if (rc) {
                 CERROR("1a: llog_create with name %s failed: %d\n", name, rc);
                 llog_ctxt_put(ctxt);
                 RETURN(rc);
         }
-        llog_init_handle(llh, LLOG_F_IS_PLAIN, &uuid);
+       llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, &uuid);
 
         if ((rc = verify_handle("1", llh, 1)))
                 GOTO(out, rc);
 
  out:
         CWARN("1b: close newly-created log\n");
-        rc2 = llog_close(llh);
+       rc2 = llog_close(NULL, llh);
         llog_ctxt_put(ctxt);
         if (rc2) {
                 CERROR("1b: close log %s failed: %d\n", name, rc2);
@@ -131,12 +131,12 @@ static int llog_test_2(struct obd_device *obd, char *name,
         ENTRY;
 
         CWARN("2a: re-open a log with name: %s\n", name);
-        rc = llog_create(ctxt, llh, NULL, name);
+       rc = llog_create(NULL, ctxt, llh, NULL, name);
         if (rc) {
                 CERROR("2a: re-open log with name %s failed: %d\n", name, rc);
                 GOTO(out, rc);
         }
-        llog_init_handle(*llh, LLOG_F_IS_PLAIN, &uuid);
+       llog_init_handle(NULL, *llh, LLOG_F_IS_PLAIN, &uuid);
 
         if ((rc = verify_handle("2", *llh, 1)))
                 GOTO(out, rc);
@@ -185,7 +185,7 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
         lcr.lcr_hdr.lrh_type = OST_SZ_REC;
 
         CWARN("3a: write one create_rec\n");
-        rc = llog_write_rec(llh,  &lcr.lcr_hdr, NULL, 0, NULL, -1);
+       rc = llog_write_rec(NULL, llh,  &lcr.lcr_hdr, NULL, 0, NULL, -1);
         num_recs++;
         if (rc) {
                 CERROR("3a: write one log record failed: %d\n", rc);
@@ -202,7 +202,7 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
                 hdr.lrh_len = 8;
                 hdr.lrh_type = OBD_CFG_REC;
                 memset(buf, 0, sizeof buf);
-                rc = llog_write_rec(llh, &hdr, NULL, 0, buf, -1);
+               rc = llog_write_rec(NULL, llh, &hdr, NULL, 0, buf, -1);
                 if (rc) {
                         CERROR("3b: write 10 records failed at #%d: %d\n",
                                i + 1, rc);
@@ -218,7 +218,8 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
 
         CWARN("3c: write 1000 more log records\n");
         for (i = 0; i < 1000; i++) {
-                rc = llog_write_rec(llh, &lcr.lcr_hdr, NULL, 0, NULL, -1);
+               rc = llog_write_rec(NULL, llh, &lcr.lcr_hdr, NULL, 0, NULL,
+                                   -1);
                 if (rc) {
                         CERROR("3c: write 1000 records failed at #%d: %d\n",
                                i + 1, rc);
@@ -243,11 +244,13 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
                 if ((i % 2) == 0) {
                         hdr.lrh_len = 24;
                         hdr.lrh_type = OBD_CFG_REC;
-                        rc = llog_write_rec(llh, &hdr, NULL, 0, buf_even, -1);
+                       rc = llog_write_rec(NULL, llh, &hdr, NULL, 0, buf_even,
+                                           -1);
                 } else {
                         hdr.lrh_len = 32;
                         hdr.lrh_type = OBD_CFG_REC;
-                        rc = llog_write_rec(llh, &hdr, NULL, 0, buf_odd, -1);
+                       rc = llog_write_rec(NULL, llh, &hdr, NULL, 0, buf_odd,
+                                           -1);
                 }
                 if (rc) {
                         if (rc == -ENOSPC) {
@@ -290,17 +293,17 @@ static int llog_test_4(struct obd_device *obd)
 
         sprintf(name, "%x", llog_test_rand+1);
         CWARN("4a: create a catalog log with name: %s\n", name);
-        rc = llog_create(ctxt, &cath, NULL, name);
+       rc = llog_create(NULL, ctxt, &cath, NULL, name);
         if (rc) {
                 CERROR("1a: llog_create with name %s failed: %d\n", name, rc);
                 GOTO(out, rc);
         }
-        llog_init_handle(cath, LLOG_F_IS_CAT, &uuid);
+       llog_init_handle(NULL, cath, LLOG_F_IS_CAT, &uuid);
         num_recs++;
         cat_logid = cath->lgh_id;
 
         CWARN("4b: write 1 record into the catalog\n");
-        rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, &cookie, NULL);
+       rc = llog_cat_add_rec(NULL, cath, &lmr.lmr_hdr, &cookie, NULL);
         if (rc != 1) {
                 CERROR("4b: write 1 catalog record failed at: %d\n", rc);
                 GOTO(out, rc);
@@ -313,7 +316,7 @@ static int llog_test_4(struct obd_device *obd)
                 GOTO(ctxt_release, rc);
 
         CWARN("4c: cancel 1 log record\n");
-        rc = llog_cat_cancel_records(cath, 1, &cookie);
+       rc = llog_cat_cancel_records(NULL, cath, 1, &cookie);
         if (rc) {
                 CERROR("4c: cancel 1 catalog based record failed: %d\n", rc);
                 GOTO(out, rc);
@@ -325,7 +328,7 @@ static int llog_test_4(struct obd_device *obd)
 
         CWARN("4d: write 40,000 more log records\n");
         for (i = 0; i < 40000; i++) {
-                rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, NULL, NULL);
+               rc = llog_cat_add_rec(NULL, cath, &lmr.lmr_hdr, NULL, NULL);
                 if (rc) {
                         CERROR("4d: write 40000 records failed at #%d: %d\n",
                                i + 1, rc);
@@ -343,7 +346,7 @@ static int llog_test_4(struct obd_device *obd)
         for (i = 0; i < 5; i++) {
                 rec.lrh_len = buflen;
                 rec.lrh_type = OBD_CFG_REC;
-                rc = llog_cat_add_rec(cath, &rec, NULL, buf);
+               rc = llog_cat_add_rec(NULL, cath, &rec, NULL, buf);
                 if (rc) {
                         CERROR("4e: write 5 records failed at #%d: %d\n",
                                i + 1, rc);
@@ -356,7 +359,7 @@ static int llog_test_4(struct obd_device *obd)
 
  out:
         CWARN("4f: put newly-created catalog\n");
-        rc = llog_cat_put(cath);
+       rc = llog_cat_put(NULL, cath);
 ctxt_release:
         llog_ctxt_put(ctxt);
         if (rc)
@@ -408,7 +411,7 @@ static int llog_cancel_rec_cb(const struct lu_env *env,
         cookie.lgc_lgl = llh->lgh_id;
         cookie.lgc_index = rec->lrh_index;
 
-        llog_cat_cancel_records(llh->u.phd.phd_cat_handle, 1, &cookie);
+       llog_cat_cancel_records(NULL, llh->u.phd.phd_cat_handle, 1, &cookie);
         i++;
         if (i == 40000)
                 RETURN(-4711);
@@ -430,12 +433,12 @@ static int llog_test_5(struct obd_device *obd)
         lmr.lmr_hdr.lrh_type = 0xf00f00;
 
         CWARN("5a: re-open catalog by id\n");
-        rc = llog_create(ctxt, &llh, &cat_logid, NULL);
+       rc = llog_create(NULL, ctxt, &llh, &cat_logid, NULL);
         if (rc) {
                 CERROR("5a: llog_create with logid failed: %d\n", rc);
                 GOTO(out, rc);
         }
-        llog_init_handle(llh, LLOG_F_IS_CAT, &uuid);
+       llog_init_handle(NULL, llh, LLOG_F_IS_CAT, &uuid);
 
         CWARN("5b: print the catalog entries.. we expect 2\n");
        rc = llog_process(NULL, llh, cat_print_cb, "test 5", NULL);
@@ -452,7 +455,7 @@ static int llog_test_5(struct obd_device *obd)
         }
 
         CWARN("5d: add 1 record to the log with many canceled empty pages\n");
-        rc = llog_cat_add_rec(llh, &lmr.lmr_hdr, NULL, NULL);
+       rc = llog_cat_add_rec(NULL, llh, &lmr.lmr_hdr, NULL, NULL);
         if (rc) {
                 CERROR("5d: add record to the log with many canceled empty\
                        pages failed\n");
@@ -483,7 +486,7 @@ static int llog_test_5(struct obd_device *obd)
  out:
         CWARN("5: close re-opened catalog\n");
         if (llh)
-                rc = llog_cat_put(llh);
+               rc = llog_cat_put(NULL, llh);
         if (rc)
                 CERROR("1b: close log %s failed: %d\n", name, rc);
         llog_ctxt_put(ctxt);
@@ -522,14 +525,14 @@ static int llog_test_6(struct obd_device *obd, char *name)
         }
 
         nctxt = llog_get_context(mgc_obd, LLOG_CONFIG_REPL_CTXT);
-        rc = llog_create(nctxt, &llh, NULL, name);
+       rc = llog_create(NULL, nctxt, &llh, NULL, name);
         if (rc) {
                 CERROR("6: llog_create failed %d\n", rc);
                 llog_ctxt_put(nctxt);
                 GOTO(ctxt_release, rc);
         }
 
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc) {
                 CERROR("6: llog_init_handle failed %d\n", rc);
                 GOTO(parse_out, rc);
@@ -544,7 +547,7 @@ static int llog_test_6(struct obd_device *obd, char *name)
                 CERROR("6: llog_reverse_process failed %d\n", rc);
 
 parse_out:
-        rc = llog_close(llh);
+       rc = llog_close(NULL, llh);
         llog_ctxt_put(nctxt);
         if (rc) {
                 CERROR("6: llog_close failed: rc = %d\n", rc);
@@ -567,22 +570,22 @@ static int llog_test_7(struct obd_device *obd)
         CWARN("7: create a log with name: %s\n", name);
         LASSERT(ctxt);
 
-        rc = llog_create(ctxt, &llh, NULL, name);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
         if (rc) {
                 CERROR("7: llog_create with name %s failed: %d\n", name, rc);
                 GOTO(ctxt_release, rc);
         }
-        llog_init_handle(llh, LLOG_F_IS_PLAIN, &uuid);
+       llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, &uuid);
 
         lcr.lcr_hdr.lrh_len = lcr.lcr_tail.lrt_len = sizeof(lcr);
         lcr.lcr_hdr.lrh_type = OST_SZ_REC;
-        rc = llog_write_rec(llh,  &lcr.lcr_hdr, NULL, 0, NULL, -1);
+       rc = llog_write_rec(NULL, llh,  &lcr.lcr_hdr, NULL, 0, NULL, -1);
         if (rc) {
                 CERROR("7: write one log record failed: %d\n", rc);
                 GOTO(ctxt_release, rc);
         }
 
-        rc = llog_destroy(llh);
+       rc = llog_destroy(NULL, llh);
         if (rc)
                 CERROR("7: llog_destroy failed: %d\n", rc);
         else
@@ -639,7 +642,7 @@ static int llog_run_tests(struct obd_device *obd)
  cleanup:
         switch (cleanup_phase) {
         case 1:
-                err = llog_close(llh);
+               err = llog_close(NULL, llh);
                 if (err)
                         CERROR("cleanup: llog_close failed: %d\n", err);
                 if (!rc)
@@ -651,7 +654,6 @@ static int llog_run_tests(struct obd_device *obd)
         return rc;
 }
 
-
 static int llog_test_llog_init(struct obd_device *obd,
                                struct obd_llog_group *olg,
                                struct obd_device *tgt, int *index)
index c1d87c2..da9734e 100644 (file)
@@ -1467,11 +1467,11 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
         ENTRY;
 
         CDEBUG(D_INFO, "looking up llog %s\n", name);
-        rc = llog_create(ctxt, &llh, NULL, name);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
         if (rc)
                 RETURN(rc);
 
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(parse_out, rc);
 
@@ -1489,7 +1489,7 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
                 cfg->cfg_last_idx = cd.lpcd_last_idx;
 
 parse_out:
-        rc2 = llog_close(llh);
+       rc2 = llog_close(NULL, llh);
         if (rc == 0)
                 rc = rc2;
 
@@ -1567,17 +1567,17 @@ int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
 
         LCONSOLE_INFO("Dumping config log %s\n", name);
 
-        rc = llog_create(ctxt, &llh, NULL, name);
+       rc = llog_create(NULL, ctxt, &llh, NULL, name);
         if (rc)
                 RETURN(rc);
 
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(parse_out, rc);
 
        rc = llog_process(NULL, llh, class_config_dump_handler, cfg, NULL);
 parse_out:
-        rc2 = llog_close(llh);
+       rc2 = llog_close(NULL, llh);
         if (rc == 0)
                 rc = rc2;
 
index 6f036a6..4e634e4 100644 (file)
@@ -4274,7 +4274,7 @@ int filter_destroy(const struct lu_env *env, struct obd_export *exp,
                         }
                         fcc = &oa->o_lcookie;
                         ctxt = llog_group_get_ctxt(olg, fcc->lgc_subsys + 1);
-                        llog_cancel(ctxt, NULL, 1, fcc, 0);
+                       llog_cancel(NULL, ctxt, NULL, 1, fcc, 0);
                         llog_ctxt_put(ctxt);
                         fcc = NULL; /* we didn't allocate fcc, don't free it */
                 }
index 1d5f7d9..d997ae8 100644 (file)
@@ -94,7 +94,7 @@ int filter_log_sz_change(struct llog_handle *cathandle,
         lsc->lsc_fid = *mds_fid;
         lsc->lsc_ioepoch = ioepoch;
 
-        rc = llog_cat_add_rec(cathandle, &lsc->lsc_hdr, logcookie, NULL);
+       rc = llog_cat_add_rec(NULL, cathandle, &lsc->lsc_hdr, logcookie, NULL);
         OBD_FREE(lsc, sizeof(*lsc));
 
         if (rc > 0) {
@@ -137,7 +137,7 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno,
 
         OBD_FAIL_TIMEOUT(OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT, 30);
 
-        rc = llog_cancel(ctxt, NULL, 1, cookie, 0);
+       rc = llog_cancel(NULL, ctxt, NULL, 1, cookie, 0);
         if (rc)
                 CERROR("error cancelling log cookies: rc = %d\n", rc);
         llog_ctxt_put(ctxt);
@@ -239,7 +239,7 @@ static int filter_recov_log_setattr_cb(struct llog_ctxt *ctxt,
 
         if (rc == -ENOENT) {
                 CDEBUG(D_RPCTRACE, "object already removed, send cookie\n");
-                llog_cancel(ctxt, NULL, 1, cookie, 0);
+               llog_cancel(NULL, ctxt, NULL, 1, cookie, 0);
                 RETURN(0);
         }
 
@@ -293,7 +293,7 @@ int filter_recov_log_mds_ost_cb(const struct lu_env *env,
                 else
                         rc = LLOG_PROC_BREAK;
                 CDEBUG(D_HA, "fetch generation log, send cookie\n");
-                llog_cancel(ctxt, NULL, 1, &cookie, 0);
+               llog_cancel(NULL, ctxt, NULL, 1, &cookie, 0);
                 RETURN(rc);
                 }
                 break;
index eb69a4a..6b07ef2 100644 (file)
@@ -80,8 +80,9 @@
 
 /* This is a callback from the llog_* functions.
  * Assumes caller has already pushed us into the kernel context. */
-static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                              struct llog_logid *logid, char *name)
+static int llog_client_create(const struct lu_env *env, struct llog_ctxt *ctxt,
+                             struct llog_handle **res,
+                             struct llog_logid *logid, char *name)
 {
         struct obd_import     *imp;
         struct llogd_body     *body;
@@ -148,7 +149,8 @@ err_free:
         goto out;
 }
 
-static int llog_client_destroy(struct llog_handle *loghandle)
+static int llog_client_destroy(const struct lu_env *env,
+                              struct llog_handle *loghandle)
 {
         struct obd_import     *imp;
         struct ptlrpc_request *req = NULL;
@@ -169,7 +171,7 @@ static int llog_client_destroy(struct llog_handle *loghandle)
 
         ptlrpc_request_set_replen(req);
         rc = ptlrpc_queue_wait(req);
-        
+
         ptlrpc_req_finished(req);
 err_exit:
         LLOG_CLIENT_EXIT(loghandle->lgh_ctxt, imp);
@@ -177,9 +179,10 @@ err_exit:
 }
 
 
-static int llog_client_next_block(struct llog_handle *loghandle,
-                                  int *cur_idx, int next_idx,
-                                  __u64 *cur_offset, void *buf, int len)
+static int llog_client_next_block(const struct lu_env *env,
+                                 struct llog_handle *loghandle,
+                                 int *cur_idx, int next_idx,
+                                 __u64 *cur_offset, void *buf, int len)
 {
         struct obd_import     *imp;
         struct ptlrpc_request *req = NULL;
@@ -194,7 +197,7 @@ static int llog_client_next_block(struct llog_handle *loghandle,
                                         LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
         if (req == NULL)
                 GOTO(err_exit, rc =-ENOMEM);
-                
+
         body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
         body->lgd_logid = loghandle->lgh_id;
         body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1;
@@ -231,8 +234,9 @@ err_exit:
         return rc;
 }
 
-static int llog_client_prev_block(struct llog_handle *loghandle,
-                                  int prev_idx, void *buf, int len)
+static int llog_client_prev_block(const struct lu_env *env,
+                                 struct llog_handle *loghandle,
+                                 int prev_idx, void *buf, int len)
 {
         struct obd_import     *imp;
         struct ptlrpc_request *req = NULL;
@@ -279,7 +283,8 @@ err_exit:
         return rc;
 }
 
-static int llog_client_read_header(struct llog_handle *handle)
+static int llog_client_read_header(const struct lu_env *env,
+                                  struct llog_handle *handle)
 {
         struct obd_import     *imp;
         struct ptlrpc_request *req = NULL;
@@ -334,7 +339,8 @@ err_exit:
         return rc;
 }
 
-static int llog_client_close(struct llog_handle *handle)
+static int llog_client_close(const struct lu_env *env,
+                            struct llog_handle *handle)
 {
         /* this doesn't call LLOG_ORIGIN_HANDLE_CLOSE because
            the servers all close the file at the end of every
index 84d3ca6..679f99f 100644 (file)
@@ -93,9 +93,9 @@ int llog_origin_connect(struct llog_ctxt *ctxt,
                rc = PTR_ERR(handle);
                RETURN(rc);
         }
-        
+
         lgr->lgr_gen = ctxt->loc_gen;
-        rc = llog_add(ctxt, &lgr->lgr_hdr, NULL, NULL, 1);
+       rc = llog_add(NULL, ctxt, &lgr->lgr_hdr, NULL, NULL, 1);
         OBD_FREE_PTR(lgr);
         rc1 = fsfilt_commit(ctxt->loc_exp->exp_obd, inode, handle, 0);
         if (rc != 1 || rc1 != 0) {
index 3337198..7226a1e 100644 (file)
@@ -49,7 +49,6 @@
 #include <obd_class.h>
 #include <lustre_log.h>
 #include <lustre_net.h>
-#include <libcfs/list.h>
 #include <lustre_fsfilt.h>
 
 #if defined(__KERNEL__) && defined(LUSTRE_LOG_SERVER)
@@ -91,7 +90,8 @@ int llog_origin_handle_create(struct ptlrpc_request *req)
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, logid, name);
+       rc = llog_create(req->rq_svc_thread->t_env, ctxt, &loghandle, logid,
+                        name);
         if (rc)
                 GOTO(out_pop, rc);
 
@@ -102,9 +102,9 @@ int llog_origin_handle_create(struct ptlrpc_request *req)
         body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY);
         body->lgd_logid = loghandle->lgh_id;
 
-        GOTO(out_close, rc);
+       EXIT;
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(req->rq_svc_thread->t_env, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -141,7 +141,8 @@ int llog_origin_handle_destroy(struct ptlrpc_request *req)
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, logid, NULL);
+       rc = llog_create(req->rq_svc_thread->t_env, ctxt, &loghandle, logid,
+                        NULL);
         if (rc)
                 GOTO(out_pop, rc);
 
@@ -151,17 +152,18 @@ int llog_origin_handle_destroy(struct ptlrpc_request *req)
 
         body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY);
         body->lgd_logid = loghandle->lgh_id;
-        rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle,
+                             LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
-        rc = llog_destroy(loghandle);
+       rc = llog_destroy(req->rq_svc_thread->t_env, loghandle);
         if (rc)
                 GOTO(out_close, rc);
         llog_free_handle(loghandle);
-        GOTO(out_close, rc);
+       EXIT;
 out_close:
         if (rc)
-                llog_close(loghandle);
+               llog_close(req->rq_svc_thread->t_env, loghandle);
 out_pop:
         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
         llog_ctxt_put(ctxt);
@@ -199,19 +201,21 @@ int llog_origin_handle_next_block(struct ptlrpc_request *req)
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
+       rc = llog_create(req->rq_svc_thread->t_env, ctxt, &loghandle,
+                        &body->lgd_logid, NULL);
         if (rc)
                 GOTO(out_pop, rc);
 
         flags = body->lgd_llh_flags;
-        rc = llog_init_handle(loghandle, flags, NULL);
+       rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags,
+                             NULL);
         if (rc)
                 GOTO(out_close, rc);
 
         memset(buf, 0, LLOG_CHUNK_SIZE);
-        rc = llog_next_block(loghandle, &body->lgd_saved_index,
-                             body->lgd_index,
-                             &body->lgd_cur_offset, buf, LLOG_CHUNK_SIZE);
+       rc = llog_next_block(req->rq_svc_thread->t_env, loghandle,
+                            &body->lgd_saved_index, body->lgd_index,
+                            &body->lgd_cur_offset, buf, LLOG_CHUNK_SIZE);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -226,9 +230,9 @@ int llog_origin_handle_next_block(struct ptlrpc_request *req)
 
         ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA);
         memcpy(ptr, buf, LLOG_CHUNK_SIZE);
-        GOTO(out_close, rc);
+       EXIT;
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(req->rq_svc_thread->t_env, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -271,18 +275,20 @@ int llog_origin_handle_prev_block(struct ptlrpc_request *req)
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
+       rc = llog_create(req->rq_svc_thread->t_env, ctxt, &loghandle,
+                        &body->lgd_logid, NULL);
         if (rc)
                 GOTO(out_pop, rc);
 
         flags = body->lgd_llh_flags;
-        rc = llog_init_handle(loghandle, flags, NULL);
+       rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags,
+                             NULL);
         if (rc)
                 GOTO(out_close, rc);
 
         memset(buf, 0, LLOG_CHUNK_SIZE);
-        rc = llog_prev_block(loghandle, body->lgd_index,
-                             buf, LLOG_CHUNK_SIZE);
+       rc = llog_prev_block(req->rq_svc_thread->t_env, loghandle,
+                            body->lgd_index, buf, LLOG_CHUNK_SIZE);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -297,9 +303,9 @@ int llog_origin_handle_prev_block(struct ptlrpc_request *req)
 
         ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA);
         memcpy(ptr, buf, LLOG_CHUNK_SIZE);
-        GOTO(out_close, rc);
+       EXIT;
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(req->rq_svc_thread->t_env, loghandle);
         if (!rc)
                 rc = rc2;
 
@@ -337,7 +343,8 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req)
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
+       rc = llog_create(req->rq_svc_thread->t_env, ctxt, &loghandle,
+                        &body->lgd_logid, NULL);
         if (rc)
                 GOTO(out_pop, rc);
 
@@ -345,7 +352,8 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req)
          * llog_init_handle() reads the llog header
          */
         flags = body->lgd_llh_flags;
-        rc = llog_init_handle(loghandle, flags, NULL);
+       rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags,
+                             NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -355,9 +363,9 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req)
 
         hdr = req_capsule_server_get(&req->rq_pill, &RMF_LLOG_LOG_HDR);
         *hdr = *loghandle->lgh_hdr;
-        GOTO(out_close, rc);
+        EXIT;
 out_close:
-        rc2 = llog_close(loghandle);
+       rc2 = llog_close(req->rq_svc_thread->t_env, loghandle);
         if (!rc)
                 rc = rc2;
 out_pop:
@@ -415,7 +423,8 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req)
                         GOTO(pop_ctxt, rc = PTR_ERR(handle));
                 }
 
-                rc = llog_cat_cancel_records(cathandle, 1, logcookies);
+               rc = llog_cat_cancel_records(req->rq_svc_thread->t_env,
+                                            cathandle, 1, logcookies);
 
                 /*
                  * Do not raise -ENOENT errors for resent rpcs. This rec already
index 8076420..710afd7 100644 (file)
@@ -581,9 +581,9 @@ EXPORT_SYMBOL(llog_obd_repl_connect);
  * log record for the deletion. The commit callback calls this
  * function.
  */
-int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
-                         struct lov_stripe_md *lsm, int count,
-                         struct llog_cookie *cookies, int flags)
+int llog_obd_repl_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
+                        struct lov_stripe_md *lsm, int count,
+                        struct llog_cookie *cookies, int flags)
 {
         struct llog_commit_master *lcm;
         struct llog_canceld_ctxt *llcd;
@@ -717,8 +717,8 @@ int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp,
                  */
                 CDEBUG(D_RPCTRACE, "Sync cached llcd\n");
                 cfs_mutex_unlock(&ctxt->loc_mutex);
-               rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW |
-                                flags);
+               rc = llog_cancel(NULL, ctxt, NULL, 0, NULL,
+                                OBD_LLOG_FL_SENDNOW | flags);
         }
         RETURN(rc);
 }
@@ -726,7 +726,7 @@ EXPORT_SYMBOL(llog_obd_repl_sync);
 
 #else /* !__KERNEL__ */
 
-int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
+int llog_obd_repl_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
                          struct lov_stripe_md *lsm, int count,
                          struct llog_cookie *cookies, int flags)
 {
index fb44b2d..e0b8ebb 100644 (file)
@@ -983,7 +983,7 @@ static int sptlrpc_record_rule_set(struct llog_handle *llh,
                                         lcfg->lcfg_buflens);
                 rec.lrh_len = llog_data_len(buflen);
                 rec.lrh_type = OBD_CFG_REC;
-                rc = llog_write_rec(llh, &rec, NULL, 0, (void *)lcfg, -1);
+               rc = llog_write_rec(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1);
                 if (rc)
                         CERROR("failed to write a rec: rc = %d\n", rc);
                 lustre_cfg_free(lcfg);
@@ -1037,15 +1037,15 @@ int sptlrpc_target_local_copy_conf(struct obd_device *obd,
         }
 
         /* erase the old tmp log */
-        rc = llog_create(ctxt, &llh, NULL, LOG_SPTLRPC_TMP);
-        if (rc == 0) {
-                rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
-                if (rc == 0) {
-                        rc = llog_destroy(llh);
-                        llog_free_handle(llh);
-                } else {
-                        llog_close(llh);
-                }
+       rc = llog_create(NULL, ctxt, &llh, NULL, LOG_SPTLRPC_TMP);
+       if (rc == 0) {
+               rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
+               if (rc == 0) {
+                       rc = llog_destroy(NULL, llh);
+                       llog_free_handle(llh);
+               } else {
+                       llog_close(NULL, llh);
+               }
         }
 
         if (rc) {
@@ -1055,17 +1055,17 @@ int sptlrpc_target_local_copy_conf(struct obd_device *obd,
         }
 
         /* write temporary log */
-        rc = llog_create(ctxt, &llh, NULL, LOG_SPTLRPC_TMP);
-        if (rc)
-                GOTO(out_dput, rc);
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_create(NULL, ctxt, &llh, NULL, LOG_SPTLRPC_TMP);
+       if (rc)
+               GOTO(out_dput, rc);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
         rc = sptlrpc_record_rules(llh, conf);
 
 out_close:
-        llog_close(llh);
+       llog_close(NULL, llh);
 
         if (rc == 0) {
                 rc = lustre_rename(dentry, obd->obd_lvfs_ctxt.pwdmnt,
@@ -1133,11 +1133,11 @@ int sptlrpc_target_local_read_conf(struct obd_device *obd,
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(ctxt, &llh, NULL, LOG_SPTLRPC);
-        if (rc)
-                GOTO(out_pop, rc);
+       rc = llog_create(NULL, ctxt, &llh, NULL, LOG_SPTLRPC);
+       if (rc)
+               GOTO(out_pop, rc);
 
-        rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL);
+       rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -1155,7 +1155,7 @@ int sptlrpc_target_local_read_conf(struct obd_device *obd,
         }
 
 out_close:
-        llog_close(llh);
+       llog_close(NULL, llh);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         llog_ctxt_put(ctxt);