int llog_handle_put(const struct lu_env *env, struct llog_handle *loghandle);
int llog_cat_id2handle(const struct lu_env *env, struct llog_handle *cathandle,
struct llog_handle **res, struct llog_logid *logid);
+void llog_get_marker_cfg_flags(struct llog_rec_hdr *rec,
+ unsigned int *cfg_flags);
int class_config_dump_handler(const struct lu_env *env,
struct llog_handle *handle,
struct llog_rec_hdr *rec, void *data);
bool lprd_raw;
};
+#define MARKER_DIFF 10
static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle,
struct llog_rec_hdr *rec, void *data)
{
}
cur_index = rec->lrh_index;
+ if (from > MARKER_DIFF && cur_index >= from - MARKER_DIFF &&
+ cur_index < from) {
+ /* LU-15706: try to remember the marker cfg_flag that the "from"
+ * is using, in case that the "from" record doesn't know its
+ * "SKIP" or not flag.
+ */
+ llog_get_marker_cfg_flags(rec, &lprd->lprd_cfg_flags);
+ }
if (cur_index < from)
RETURN(0);
if (to > 0 && cur_index > to)
EXPORT_SYMBOL(class_config_parse_llog);
/**
+ * Get marker cfg_flag
+ */
+void llog_get_marker_cfg_flags(struct llog_rec_hdr *rec,
+ unsigned int *cfg_flags)
+{
+ struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1);
+ struct cfg_marker *marker;
+
+ if (lcfg->lcfg_command == LCFG_MARKER) {
+ marker = lustre_cfg_buf(lcfg, 1);
+ if (marker->cm_flags & CM_START) {
+ *cfg_flags = CFG_F_MARKER;
+ if (marker->cm_flags & CM_SKIP)
+ *cfg_flags = CFG_F_SKIP;
+ } else if (marker->cm_flags & CM_END) {
+ *cfg_flags = 0;
+ }
+ CDEBUG(D_INFO, "index=%d, cm_flags=%#08x cfg_flags=%#08x\n",
+ rec->lrh_index, marker->cm_flags, *cfg_flags);
+ }
+}
+
+/**
* Parse config record and output dump in supplied buffer.
*
* This is separated from class_config_dump_handler() to use
if (!ldata)
return -ENOTTY;
- if (lcfg->lcfg_command == LCFG_MARKER) {
- struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
-
- lustre_swab_cfg_marker(marker, swab,
- LUSTRE_CFG_BUFLEN(lcfg, 1));
- if (marker->cm_flags & CM_START) {
- *cfg_flags = CFG_F_MARKER;
- if (marker->cm_flags & CM_SKIP)
- *cfg_flags = CFG_F_SKIP;
- } else if (marker->cm_flags & CM_END) {
- *cfg_flags = 0;
- }
- if (likely(!raw))
- return 0;
- }
-
+ llog_get_marker_cfg_flags(rec, cfg_flags);
+ if ((lcfg->lcfg_command == LCFG_MARKER) && likely(!raw))
+ return 0;
/* entries outside marker are skipped */
if (!(*cfg_flags & CFG_F_MARKER) && !raw)
return 0;
-
/* inside skipped marker */
- if (*cfg_flags & CFG_F_SKIP && !raw)
+ if ((*cfg_flags & CFG_F_SKIP) && !raw)
return 0;
/* form YAML entity */
}
if (lcfg->lcfg_command == LCFG_MARKER) {
- struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
+ struct cfg_marker *marker;
- if (marker->cm_flags & CM_START) {
- *cfg_flags = CFG_F_MARKER;
- if (marker->cm_flags & CM_SKIP)
- *cfg_flags = CFG_F_SKIP;
- } else if (marker->cm_flags & CM_END) {
- *cfg_flags = 0;
- }
+ marker = lustre_cfg_buf(lcfg, 1);
ptr += snprintf(ptr, end - ptr, ", flags: %#04x",
marker->cm_flags);
ptr += snprintf(ptr, end - ptr, ", version: %d.%d.%d.%d",
if (lpd->lpd_cmd_type == LCFG_POOL_NEW ||
lpd->lpd_cmd_type == LCFG_POOL_DEL) {
+ /* In function mgs_pool_cmd(), a pool's pool_new/add
+ * record will be marked as "SKIP" if its pool_destroy/
+ * remove record is logged later. That means the "SKIP"
+ * record won't be printed here and thus lpd_ost_num
+ * doesn't need to be decreased as well.
+ */
if (strstr(record, add_pool))
lpd->lpd_ost_num++;
- if (strstr(record, rem_pool))
- lpd->lpd_ost_num--;
} else if (lpd->lpd_ostname && lpd->lpd_ostname[0]) {
if (strstr(record, lpd->lpd_ostname)) {
lpd->lpd_pool_exists = true;