/* 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
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);
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);
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,
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 */
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,
* 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;
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",
}
/* 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;
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
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);
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)
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;
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;
* \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;
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;
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:
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--;
/* 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);
}
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);
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);
/* 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);
#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;
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);
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;
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);
}
/* 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) {
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;
/* 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 */
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);
/* 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,
/* 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;
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);
(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;
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);
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:
/* 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++;
}
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);
OBD_FREE_PTR(mml);
out_close:
- rc2 = llog_close(loghandle);
+ rc2 = llog_close(NULL, loghandle);
if (!rc)
rc = rc2;
out_pop:
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);
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);
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);
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);
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);
(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:
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);
NULL);
out_close:
- llog_close(llh);
+ llog_close(NULL, llh);
out_pop:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
out:
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);
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;
(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",
}
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",
}
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;
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)) {
}
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;
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);
/* 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);
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)
/* 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) {
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;
}
*
* 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;
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)
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);
&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.
* 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;
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",
}
}
- 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);
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);
*
* 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;
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);
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);
}
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);
*
* 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);
}
*
* 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;
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 */
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",
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);
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);
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:
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);
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,
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);
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 "
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);
}
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",
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:
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);
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);
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);
}
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);
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,
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);
}
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);
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);
}
}
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);
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;
/* 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;
* - 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;
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;
/* 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;
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;
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;
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);
#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);
#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;
/* 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);
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) {
}
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;
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;
}
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;
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;
}
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);
}
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;
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);
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;
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);
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);
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);
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);
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);
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);
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) {
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);
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);
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);
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);
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)
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);
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);
}
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");
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);
}
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);
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);
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
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)
return rc;
}
-
static int llog_test_llog_init(struct obd_device *obd,
struct obd_llog_group *olg,
struct obd_device *tgt, int *index)
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);
cfg->cfg_last_idx = cd.lpcd_last_idx;
parse_out:
- rc2 = llog_close(llh);
+ rc2 = llog_close(NULL, llh);
if (rc == 0)
rc = rc2;
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;
}
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 */
}
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) {
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);
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);
}
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;
/* 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;
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;
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
-
+
ptlrpc_req_finished(req);
err_exit:
LLOG_CLIENT_EXIT(loghandle->lgh_ctxt, imp);
}
-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;
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;
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;
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;
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
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) {
#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)
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);
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:
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);
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);
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);
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:
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);
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;
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);
* 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);
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:
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
* 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;
*/
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);
}
#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)
{
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);
}
/* 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) {
}
/* 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,
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);
}
out_close:
- llog_close(llh);
+ llog_close(NULL, llh);
out_pop:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
llog_ctxt_put(ctxt);