struct llog_process_data *d = data;
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
struct llog_handle *llh;
+ struct llog_log_hdr *hdr;
int rc;
ENTRY;
RETURN(rc);
}
+ /* clean old empty llogs, do not consider current llog in use */
+ hdr = llh->lgh_hdr;
+ if ((hdr->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
+ hdr->llh_count == 1 &&
+ llh != cat_llh->u.chd.chd_current_log) {
+ rc = llog_destroy(env, llh);
+ if (rc)
+ CERROR("%s: fail to destroy empty log: rc = %d\n",
+ llh->lgh_ctxt->loc_obd->obd_name, rc);
+ GOTO(out, rc = LLOG_DEL_PLAIN);
+ }
+
if (rec->lrh_index < d->lpd_startcat) {
/* Skip processing of the logs until startcat */
rc = 0;
NULL, false);
}
+out:
/* The empty plain log was destroyed while processing */
if (rc == LLOG_DEL_PLAIN)
rc = llog_cat_cleanup(env, cat_llh, llh,
struct llog_process_data *d = data;
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
struct llog_handle *llh;
+ struct llog_log_hdr *hdr;
int rc;
if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
RETURN(rc);
}
+ /* clean old empty llogs, do not consider current llog in use */
+ hdr = llh->lgh_hdr;
+ if ((hdr->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
+ hdr->llh_count == 1 &&
+ llh != cat_llh->u.chd.chd_current_log) {
+ rc = llog_destroy(env, llh);
+ if (rc)
+ CERROR("%s: fail to destroy empty log: rc = %d\n",
+ llh->lgh_ctxt->loc_obd->obd_name, rc);
+ GOTO(out, rc = LLOG_DEL_PLAIN);
+ }
+
rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
+out:
/* The empty plain was destroyed while processing */
if (rc == LLOG_DEL_PLAIN)
rc = llog_cat_cleanup(env, cat_llh, llh,
if (rc)
RETURN(rc);
- rc = llog_process_or_fork(env, llh, cat_cancel_cb, NULL, NULL, false);
- if (rc)
- CERROR("%s: llog_process() with cat_cancel_cb failed: rc = "
- "%d\n", llh->lgh_ctxt->loc_obd->obd_name, rc);
RETURN(0);
}
EXPORT_SYMBOL(llog_cat_init_and_process);