X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdfilter%2Ffilter_log.c;h=3fd9bc85d9a915b99ca69cc18f383abdd8f929b9;hb=fdb061c9ce3fd16e805ff07b1e80c8de46110004;hp=1e1a3d309eeae5af65b6e050e1fc864c6a40e69b;hpb=cd9c585e8c7bdd6cfd802be64ef277dfd466be17;p=fs%2Flustre-release.git diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 1e1a3d3..3fd9bc8 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -30,26 +30,26 @@ #include #include -#include +#include #include #include #include #include "filter_internal.h" -int filter_log_sz_change(struct llog_handle *cathandle, - struct ll_fid *mds_fid, - __u32 io_epoch, +int filter_log_sz_change(struct obd_device *obd, + struct lustre_id *id, __u32 io_epoch, struct llog_cookie *logcookie, struct inode *inode) { struct llog_size_change_rec *lsc; - int rc; struct ost_filterdata *ofd; + struct llog_ctxt *ctxt; + int rc; ENTRY; down(&inode->i_sem); - ofd = inode->i_filterdata; + ofd = (struct ost_filterdata *) LUSTRE_FILTERDATA(inode); if (ofd && ofd->ofd_epoch >= io_epoch) { if (ofd->ofd_epoch > io_epoch) @@ -66,7 +66,7 @@ int filter_log_sz_change(struct llog_handle *cathandle, if (!ofd) GOTO(out, rc = -ENOMEM); igrab(inode); - inode->i_filterdata = ofd; + LUSTRE_FILTERDATA(inode) = (void *) ofd; ofd->ofd_epoch = io_epoch; } /* the decision to write a record is now made, unlock */ @@ -77,10 +77,14 @@ int filter_log_sz_change(struct llog_handle *cathandle, RETURN(-ENOMEM); lsc->lsc_hdr.lrh_len = lsc->lsc_tail.lrt_len = sizeof(*lsc); lsc->lsc_hdr.lrh_type = OST_SZ_REC; - lsc->lsc_fid = *mds_fid; + lsc->lsc_id = *id; lsc->lsc_io_epoch = io_epoch; - rc = llog_cat_add_rec(cathandle, &lsc->lsc_hdr, logcookie, NULL); + CDEBUG(D_ERROR, "new epoch %lu for "DLID4"\n", + (unsigned long) io_epoch, OLID4(id)); + + ctxt = llog_get_context(&obd->obd_llogs, LLOG_SIZE_ORIG_CTXT); + rc = llog_add(ctxt, &lsc->lsc_hdr, NULL, logcookie, 1, NULL,NULL,NULL); OBD_FREE(lsc, sizeof(*lsc)); if (rc > 0) { @@ -88,20 +92,35 @@ int filter_log_sz_change(struct llog_handle *cathandle, rc = 0; } - out: +out: RETURN(rc); } +struct obd_llogs * filter_grab_llog_for_group(struct obd_device *, + int, struct obd_export *); + /* When this (destroy) operation is committed, return the cancel cookie */ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, - void *cb_data, int error) + void *cb_data, int error) { struct llog_cookie *cookie = cb_data; - int rc; - rc = llog_cancel(llog_get_context(obd, cookie->lgc_subsys + 1), - 1, cookie, 0, NULL); - if (rc) - CERROR("error cancelling log cookies: rc = %d\n", rc); + struct obd_llogs *llogs = NULL; + struct llog_ctxt *ctxt; + + /* we have to find context for right group */ + llogs = filter_grab_llog_for_group(obd, cookie->lgc_lgl.lgl_ogr, NULL); + + if (llogs) { + ctxt = llog_get_context(llogs, cookie->lgc_subsys + 1); + if (ctxt) { + llog_cancel(ctxt, 1, cookie, 0, NULL); + } else + CERROR("no valid context for group "LPU64"\n", + cookie->lgc_lgl.lgl_ogr); + } else { + CDEBUG(D_HA, "unknown group "LPU64"!\n", cookie->lgc_lgl.lgl_ogr); + } + OBD_FREE(cb_data, sizeof(struct llog_cookie)); } @@ -121,7 +140,7 @@ int filter_recov_log_unlink_cb(struct llog_handle *llh, obd_id oid; int rc = 0; ENTRY; - + if (!(le32_to_cpu(llh->lgh_hdr->llh_flags) & LLOG_F_IS_PLAIN)) { CERROR("log is not plain\n"); RETURN(-EINVAL); @@ -154,6 +173,7 @@ int filter_recov_log_unlink_cb(struct llog_handle *llh, oa->o_valid |= OBD_MD_FLCOOKIE; oa->o_id = lur->lur_oid; oa->o_gr = lur->lur_ogen; + oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; memcpy(obdo_logcookie(oa), &cookie, sizeof(cookie)); oid = oa->o_id;