+/**
+ * Change the LFSCK speed limit.
+ *
+ * Limit number of items that may be scanned per second.
+ *
+ * \param[in] file proc file
+ * \param[in] buffer string which represents limit
+ * \param[in] count \a buffer length
+ * \param[in] off unused for single entry
+ *
+ * \retval \a count on success
+ * \retval negative number on error
+ */
+static ssize_t
+ofd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __u32 val;
+ int rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc != 0)
+ return rc;
+
+ rc = lfsck_set_speed(ofd->ofd_osd, val);
+
+ return rc != 0 ? rc : count;
+}
+LPROC_SEQ_FOPS(ofd_lfsck_speed_limit);
+
+/**
+ * Show LFSCK layout verification stats from the most recent LFSCK run.
+ *
+ * \param[in] m seq_file handle
+ * \param[in] data unused for single entry
+ *
+ * \retval 0 on success
+ * \retval negative value on error
+ */
+static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ return lfsck_dump(m, ofd->ofd_osd, LFSCK_TYPE_LAYOUT);
+}
+LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
+
+/**
+ * Show if LFSCK performed parent FID verification.
+ *
+ * \param[in] m seq_file handle
+ * \param[in] data unused for single entry
+ *
+ * \retval 0 on success
+ * \retval negative value on error
+ */
+static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ return seq_printf(m,
+ "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
+ ofd->ofd_lfsck_verify_pfid ? "on" : "off",
+ ofd->ofd_inconsistency_self_detected,
+ ofd->ofd_inconsistency_self_repaired);
+}
+
+/**
+ * Set the LFSCK behavior to verify parent FID correctness.
+ *
+ * If flag ofd_lfsck_verify_pfid is set then LFSCK does parent FID
+ * verification during read/write operations.
+ *
+ * \param[in] file proc file
+ * \param[in] buffer string which represents behavior
+ * 1: verify parent FID
+ * 0: don't verify parent FID
+ * \param[in] count \a buffer length
+ * \param[in] off unused for single entry
+ *
+ * \retval \a count on success
+ * \retval negative number on error
+ */
+static ssize_t
+ofd_lfsck_verify_pfid_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __u32 val;
+ int rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc != 0)
+ return rc;
+
+ ofd->ofd_lfsck_verify_pfid = !!val;
+
+ return count;
+}
+LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
+
+LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
+
+LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
+LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
+LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
+LPROC_SEQ_FOPS_WO_TYPE(ofd, evict_client);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
+LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
+LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
+LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
+
+struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
+ { .name = "uuid",
+ .fops = &ofd_uuid_fops },
+ { .name = "blocksize",
+ .fops = &ofd_blksize_fops },
+ { .name = "kbytestotal",
+ .fops = &ofd_kbytestotal_fops },
+ { .name = "kbytesfree",
+ .fops = &ofd_kbytesfree_fops },
+ { .name = "kbytesavail",
+ .fops = &ofd_kbytesavail_fops },
+ { .name = "filestotal",
+ .fops = &ofd_filestotal_fops },
+ { .name = "filesfree",
+ .fops = &ofd_filesfree_fops },
+ { .name = "seqs_allocated",
+ .fops = &ofd_seqs_fops },
+ { .name = "fstype",
+ .fops = &ofd_fstype_fops },
+ { .name = "last_id",
+ .fops = &ofd_last_id_fops },
+ { .name = "tot_dirty",
+ .fops = &ofd_tot_dirty_fops },
+ { .name = "tot_pending",
+ .fops = &ofd_tot_pending_fops },
+ { .name = "tot_granted",
+ .fops = &ofd_tot_granted_fops },
+ { .name = "grant_precreate",
+ .fops = &ofd_grant_precreate_fops },
+ { .name = "grant_ratio",
+ .fops = &ofd_grant_ratio_fops },
+ { .name = "precreate_batch",
+ .fops = &ofd_precreate_batch_fops },
+ { .name = "recovery_status",
+ .fops = &ofd_recovery_status_fops },
+ { .name = "recovery_time_soft",
+ .fops = &ofd_recovery_time_soft_fops },
+ { .name = "recovery_time_hard",
+ .fops = &ofd_recovery_time_hard_fops },
+ { .name = "evict_client",
+ .fops = &ofd_evict_client_fops },
+ { .name = "num_exports",
+ .fops = &ofd_num_exports_fops },
+ { .name = "degraded",
+ .fops = &ofd_degraded_fops },
+ { .name = "sync_journal",
+ .fops = &ofd_syncjournal_fops },
+ { .name = "sync_on_lock_cancel",
+ .fops = &ofd_sync_lock_cancel_fops },
+ { .name = "instance",
+ .fops = &ofd_target_instance_fops },
+ { .name = "ir_factor",
+ .fops = &ofd_ir_factor_fops },
+ { .name = "grant_compat_disable",
+ .fops = &ofd_grant_compat_disable_fops },
+ { .name = "client_cache_count",
+ .fops = &ofd_fmd_max_num_fops },
+ { .name = "client_cache_seconds",
+ .fops = &ofd_fmd_max_age_fops },
+ { .name = "capa",
+ .fops = &ofd_capa_fops },
+ { .name = "capa_count",
+ .fops = &ofd_capa_count_fops },
+ { .name = "job_cleanup_interval",
+ .fops = &ofd_job_interval_fops },
+ { .name = "soft_sync_limit",
+ .fops = &ofd_soft_sync_limit_fops },
+ { .name = "lfsck_speed_limit",
+ .fops = &ofd_lfsck_speed_limit_fops },
+ { .name = "lfsck_layout",
+ .fops = &ofd_lfsck_layout_fops },
+ { .name = "lfsck_verify_pfid",
+ .fops = &ofd_lfsck_verify_pfid_fops },
+ { 0 }
+};
+
+/**
+ * Initialize OFD statistics counters
+ *
+ * param[in] stats statistics counters
+ */