in some cases the catalog can contain lots of non-empty llogs
(e.g. robinhood isn't running all the time and this lead to
many alive plain llogs) and scanning this in the context of
mount can take a lot. instead we can do this during normal
llog processing.
Change-Id: I6c23b02b4a9733f80599314d37ffac6d2ee57001
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/10308
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
struct llog_process_data *d = data;
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
struct llog_handle *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;
+ /* 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;
if (rec->lrh_index < d->lpd_startcat) {
/* Skip processing of the logs until startcat */
rc = 0;
/* The empty plain log was destroyed while processing */
if (rc == LLOG_DEL_PLAIN)
rc = llog_cat_cleanup(env, cat_llh, llh,
/* 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_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) {
int rc;
if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
+ /* 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);
rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
/* The empty plain was destroyed while processing */
if (rc == LLOG_DEL_PLAIN)
rc = llog_cat_cleanup(env, cat_llh, llh,
/* The empty plain was destroyed while processing */
if (rc == LLOG_DEL_PLAIN)
rc = llog_cat_cleanup(env, cat_llh, llh,
- 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);
RETURN(0);
}
EXPORT_SYMBOL(llog_cat_init_and_process);