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, int index,
- struct obd_device *disk_obd, int count,
+int llog_obd_origin_setup(struct obd_device *obd, struct obd_llogs *llogs,
+ int index, struct obd_device *disk_obd, int count,
struct llog_logid *logid);
int llog_obd_origin_cleanup(struct llog_ctxt *ctxt);
int llog_obd_origin_add(struct llog_ctxt *ctxt,
int (*lop_close)(struct llog_handle *handle);
int (*lop_read_header)(struct llog_handle *handle);
- int (*lop_setup)(struct obd_device *obd, int ctxt_idx,
- struct obd_device *disk_obd, int count,
+ int (*lop_setup)(struct obd_device *obd, struct obd_llogs *llogs,
+ int ctxt_idx, struct obd_device *disk_obd, int count,
struct llog_logid *logid);
int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
int (*lop_cleanup)(struct llog_ctxt *ctxt);
return obd->obd_llog_ctxt[index];
}
+static inline struct llog_ctxt *
+llog_get_context_from_llogs(struct obd_llogs *llogs, int index)
+{
+ if (index < 0 || index >= LLOG_MAX_CTXTS)
+ return NULL;
+ return llogs->llog_ctxt[index];
+}
+
static inline int llog_write_rec(struct llog_handle *handle,
struct llog_rec_hdr *rec,
struct llog_cookie *logcookies,
if (index < 0 || index >= LLOG_MAX_CTXTS)
RETURN(-EFAULT);
- if (obd->obd_llog_ctxt[index]) {
+ /* in some recovery cases, obd_llog_ctxt might already be set,
+ * but llogs might still be zero, for example in obd_filter recovery,
+ * Currenn */
+ if (obd->obd_llog_ctxt[index] &&
+ (!llogs || (llogs && llogs->llog_ctxt[index]))) {
/* mds_lov_update_mds might call here multiple times. So if the
llog is already set up then don't to do it again. */
CDEBUG(D_CONFIG, "obd %s ctxt %d already set up\n",
if (llogs)
llogs->llog_ctxt[index] = ctxt;
- obd->obd_llog_ctxt[index] = ctxt;
+ if (!obd->obd_llog_ctxt[index])
+ obd->obd_llog_ctxt[index] = ctxt;
+
ctxt->loc_obd = obd;
ctxt->loc_exp = class_export_get(disk_obd->obd_self_export);
ctxt->loc_idx = index;
sema_init(&ctxt->loc_sem, 1);
if (op->lop_setup)
- rc = op->lop_setup(obd, index, disk_obd, count, logid);
+ rc = op->lop_setup(obd, llogs, index, disk_obd, count, logid);
if (rc) {
obd->obd_llog_ctxt[index] = NULL;
/* lop_setup method for filter/osc */
// XXX how to set exports
-int llog_obd_origin_setup(struct obd_device *obd, int index,
- struct obd_device *disk_obd, int count,
+int llog_obd_origin_setup(struct obd_device *obd, struct obd_llogs *llogs,
+ int index, struct obd_device *disk_obd, int count,
struct llog_logid *logid)
{
struct llog_ctxt *ctxt;
LASSERT(count == 1);
- ctxt = llog_get_context(obd, index);
+ if (!llogs)
+ ctxt = llog_get_context(obd, index);
+ else
+ ctxt = llog_get_context_from_llogs(llogs, index);
+
LASSERT(ctxt);
llog_gen_init(ctxt);
if (!llogs)
ctxt = llog_get_context(obd, LLOG_MDS_OST_REPL_CTXT);
else
- ctxt = filter_llog_get_context(llogs, LLOG_MDS_OST_REPL_CTXT);
+ ctxt = llog_get_context_from_llogs(llogs, LLOG_MDS_OST_REPL_CTXT);
+
+ LASSERT(ctxt != NULL);
ctxt->llog_proc_cb = filter_recov_log_mds_ost_cb;
rc = llog_setup(obd, llogs, LLOG_SIZE_ORIG_CTXT, tgt, 0, NULL,
int rc = 0, rc2 = 0;
ENTRY;
- ctxt = filter_llog_get_context(llogs, LLOG_MDS_OST_REPL_CTXT);
+ ctxt = llog_get_context_from_llogs(llogs, LLOG_MDS_OST_REPL_CTXT);
if (ctxt)
rc = llog_cleanup(ctxt);
- ctxt = filter_llog_get_context(llogs, LLOG_SIZE_ORIG_CTXT);
+ ctxt = llog_get_context_from_llogs(llogs, LLOG_SIZE_ORIG_CTXT);
if (ctxt)
rc2 = llog_cleanup(ctxt);
if (!rc)
init:
if (export) {
fglog->exp = export;
- ctxt = filter_llog_get_context(fglog->llogs,
+ ctxt = llog_get_context_from_llogs(fglog->llogs,
LLOG_MDS_OST_REPL_CTXT);
LASSERT(ctxt != NULL);
llog = filter_grab_llog_for_group(obd, body->lgdc_logid.lgl_ogr, exp);
LASSERT(llog != NULL);
- ctxt = filter_llog_get_context(llog, body->lgdc_ctxt_idx);
+ ctxt = llog_get_context_from_llogs(llog, body->lgdc_ctxt_idx);
rc = llog_connect(ctxt, 1, &body->lgdc_logid,
&body->lgdc_gen, NULL);
if (rc != 0)
worked = fglog->group;
if (fglog->exp && (dexp == fglog->exp || dexp == NULL)) {
- ctxt = filter_llog_get_context(fglog->llogs,
+ ctxt = llog_get_context_from_llogs(fglog->llogs,
LLOG_MDS_OST_REPL_CTXT);
LASSERT(ctxt != NULL);
llog_sync(ctxt, fglog->exp);
struct obd_llogs *filter_grab_llog_for_group(struct obd_device *obd, int group,
struct obd_export *export);
-static inline struct llog_ctxt *filter_llog_get_context(struct obd_llogs *llogs,
- int index)
-{
- if (index < 0 || index >= LLOG_MAX_CTXTS)
- return NULL;
- return llogs->llog_ctxt[index];
-}
-
/* filter_lvb.c */
extern struct ldlm_valblock_ops filter_lvbo;
llogs = filter_grab_llog_for_group(obd, cookie->lgc_lgl.lgl_ogr, NULL);
if (llogs) {
- ctxt = filter_llog_get_context(llogs, cookie->lgc_subsys + 1);
+ ctxt = llog_get_context_from_llogs(llogs, cookie->lgc_subsys + 1);
if (ctxt) {
llog_cancel(ctxt, NULL, 1, cookie, 0);
} else