+LPROC_SEQ_FOPS(mdd_changelog_mask);
+
+static int lprocfs_changelog_users_cb(const struct lu_env *env,
+ struct llog_handle *llh,
+ struct llog_rec_hdr *hdr, void *data)
+{
+ struct llog_changelog_user_rec *rec;
+ struct seq_file *m = data;
+
+ LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
+
+ rec = (struct llog_changelog_user_rec *)hdr;
+
+ seq_printf(m, CHANGELOG_USER_PREFIX"%-3d "LPU64"\n",
+ rec->cur_id, rec->cur_endrec);
+ return 0;
+}
+
+static int mdd_changelog_users_seq_show(struct seq_file *m, void *data)
+{
+ struct lu_env env;
+ struct mdd_device *mdd = m->private;
+ struct llog_ctxt *ctxt;
+ __u64 cur;
+ int rc;
+
+ ctxt = llog_get_context(mdd2obd_dev(mdd),
+ LLOG_CHANGELOG_USER_ORIG_CTXT);
+ if (ctxt == NULL)
+ return -ENXIO;
+ LASSERT(ctxt->loc_handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
+
+ rc = lu_env_init(&env, LCT_LOCAL);
+ if (rc) {
+ llog_ctxt_put(ctxt);
+ return rc;
+ }
+
+ spin_lock(&mdd->mdd_cl.mc_lock);
+ cur = mdd->mdd_cl.mc_index;
+ spin_unlock(&mdd->mdd_cl.mc_lock);
+
+ seq_printf(m, "current index: "LPU64"\n", cur);
+ seq_printf(m, "%-5s %s\n", "ID", "index");
+
+ llog_cat_process(&env, ctxt->loc_handle, lprocfs_changelog_users_cb,
+ m, 0, 0);
+
+ lu_env_fini(&env);
+ llog_ctxt_put(ctxt);
+ return 0;
+}
+LPROC_SEQ_FOPS_RO(mdd_changelog_users);