LPROC_SEQ_FOPS_RO(ofd_last_id);
/**
- * Show maximum number of Filter Modification Data (FMD) maintained by OFD.
- *
- * \param[in] m seq_file handle
- * \param[in] data unused for single entry
- *
- * \retval 0 on success
- * \retval negative value on error
- */
-static ssize_t client_cache_count_show(struct kobject *kobj,
- struct attribute *attr,
- char *buf)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
-
- return sprintf(buf, "%u\n", ofd->ofd_fmd_max_num);
-}
-
-/**
- * Change number of FMDs maintained by OFD.
- *
- * This defines how large the list of FMDs can be.
- *
- * \param[in] file proc file
- * \param[in] buffer string which represents maximum number
- * \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 client_cache_count_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
- int rc;
-
- rc = kstrtoint(buffer, 0, &val);
- if (rc)
- return rc;
-
- if (val < 1 || val > 65536)
- return -EINVAL;
-
- ofd->ofd_fmd_max_num = val;
- return count;
-}
-LUSTRE_RW_ATTR(client_cache_count);
-
-/**
- * Show the maximum age of FMD data in seconds.
- *
- * \param[in] m seq_file handle
- * \param[in] data unused for single entry
- *
- * \retval 0 on success
- * \retval negative value on error
- */
-static ssize_t client_cache_seconds_show(struct kobject *kobj,
- struct attribute *attr,
- char *buf)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
-
- return sprintf(buf, "%lld\n", ofd->ofd_fmd_max_age);
-}
-
-/**
- * Set the maximum age of FMD data in seconds.
- *
- * This defines how long FMD data stays in the FMD list.
- *
- * \param[in] file proc file
- * \param[in] buffer string which represents maximum number
- * \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 client_cache_seconds_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- time64_t val;
- int rc;
-
- rc = kstrtoll(buffer, 0, &val);
- if (rc)
- return rc;
-
- if (val < 1 || val > 65536) /* ~ 18 hour max */
- return -EINVAL;
-
- ofd->ofd_fmd_max_age = val;
- return count;
-}
-LUSTRE_RW_ATTR(client_cache_seconds);
-
-/**
* Show if the OFD is in degraded mode.
*
* Degraded means OFD has a failed drive or is undergoing RAID rebuild.
}
LUSTRE_RW_ATTR(sync_journal);
-/* This must be longer than the longest string below */
-#define SYNC_STATES_MAXLEN 16
-
static int ofd_brw_size_seq_show(struct seq_file *m, void *data)
{
struct obd_device *obd = m->private;
LPROC_SEQ_FOPS(ofd_brw_size);
-static char *sync_on_cancel_states[] = {"never",
- "blocking",
- "always" };
-
-/**
- * Show OFD policy for handling dirty data under a lock being cancelled.
- *
- * \param[in] m seq_file handle
- * \param[in] data unused for single entry
- *
- * \retval 0 on success
- * \retval negative value on error
- */
-static ssize_t sync_lock_cancel_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct lu_target *tgt = obd->u.obt.obt_lut;
-
- return sprintf(buf, "%s\n",
- sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
-}
-
-/**
- * Change OFD policy for handling dirty data under a lock being cancelled.
- *
- * This variable defines what action OFD takes upon lock cancel
- * There are three possible modes:
- * 1) never - never do sync upon lock cancel. This can lead to data
- * inconsistencies if both the OST and client crash while writing a file
- * that is also concurrently being read by another client. In these cases,
- * this may allow the file data to "rewind" to an earlier state.
- * 2) blocking - do sync only if there is blocking lock, e.g. if another
- * client is trying to access this same object
- * 3) always - do sync always
- *
- * \param[in] file proc file
- * \param[in] buffer string which represents policy
- * \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 sync_lock_cancel_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count)
-{
- struct obd_device *obd = container_of(kobj, struct obd_device,
- obd_kset.kobj);
- struct lu_target *tgt = obd->u.obt.obt_lut;
- int val = -1;
- int i;
-
- if (count == 0 || count >= SYNC_STATES_MAXLEN)
- return -EINVAL;
-
- for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
- if (strcmp(buffer, sync_on_cancel_states[i]) == 0) {
- val = i;
- break;
- }
- }
-
- /* Legacy numeric codes */
- if (val == -1) {
- int rc = kstrtoint(buffer, 0, &val);
- if (rc)
- return rc;
- }
-
- if (val < 0 || val > 2)
- return -EINVAL;
-
- spin_lock(&tgt->lut_flags_lock);
- tgt->lut_sync_lock_cancel = val;
- spin_unlock(&tgt->lut_flags_lock);
- return count;
-}
-LUSTRE_RW_ATTR(sync_lock_cancel);
-
/**
* Show the limit of soft sync RPCs.
*
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- return lfsck_get_speed(NULL, buf, ofd->ofd_osd);
+ return lfsck_get_speed(buf, ofd->ofd_osd);
}
/**
}
LUSTRE_RW_ATTR(checksum_t10pi_enforce);
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 14, 53, 0)
+static bool max_file_warned;
+static bool rd_cache_warned;
+static bool wr_cache_warned;
+
+static ssize_t read_cache_enable_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!rd_cache_warned) {
+ rd_cache_warned = true;
+ pr_info("ofd: 'obdfilter.*.read_cache_enabled' is deprecated, use 'osd-*.read_cache_enabled' instead\n");
+ }
+
+ if (!ofd->ofd_read_cache_enable)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_show(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_read_cache_enable, buf);
+}
+
+static ssize_t read_cache_enable_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!rd_cache_warned) {
+ rd_cache_warned = true;
+ pr_info("ofd: 'obdfilter.*.read_cache_enabled' is deprecated, use 'osd-*.read_cache_enabled' instead\n");
+ }
+
+ if (!ofd->ofd_read_cache_enable)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_store(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_read_cache_enable, buffer, count);
+}
+LUSTRE_RW_ATTR(read_cache_enable);
+
+static ssize_t readcache_max_filesize_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!max_file_warned) {
+ max_file_warned = true;
+ pr_info("ofd: 'obdfilter.*.readcache_max_filesize' is deprecated, use 'osd-*.readcache_max_filesize' instead\n");
+ }
+
+ if (!ofd->ofd_read_cache_max_filesize)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_show(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_read_cache_max_filesize, buf);
+}
+
+static ssize_t readcache_max_filesize_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!max_file_warned) {
+ max_file_warned = true;
+ pr_info("ofd: 'obdfilter.*.readcache_max_filesize' is deprecated, use 'osd-*.readcache_max_filesize' instead\n");
+ }
+
+ if (!ofd->ofd_read_cache_max_filesize)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_store(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_read_cache_max_filesize,
+ buffer, count);
+}
+LUSTRE_RW_ATTR(readcache_max_filesize);
+
+static ssize_t writethrough_cache_enable_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!wr_cache_warned) {
+ wr_cache_warned = true;
+ pr_info("ofd: 'obdfilter.*.writethrough_cache_enabled' is deprecated, use 'osd-*.writethrough_cache_enabled' instead\n");
+ }
+
+ if (!ofd->ofd_write_cache_enable)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_show(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_write_cache_enable, buf);
+}
+
+static ssize_t writethrough_cache_enable_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ if (!ofd->ofd_write_cache_enable)
+ return -EOPNOTSUPP;
+
+ return lustre_attr_store(&ofd->ofd_osd->dd_kobj,
+ ofd->ofd_write_cache_enable,
+ buffer, count);
+}
+LUSTRE_RW_ATTR(writethrough_cache_enable);
+#endif
+
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);
+LUSTRE_RW_ATTR(recovery_time_hard);
+LUSTRE_RW_ATTR(recovery_time_soft);
+LUSTRE_RW_ATTR(ir_factor);
+
LPROC_SEQ_FOPS_WR_ONLY(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, checksum_dump);
-LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
+LUSTRE_RW_ATTR(job_cleanup_interval);
+
+LUSTRE_RO_ATTR(tot_dirty);
+LUSTRE_RO_ATTR(tot_granted);
+LUSTRE_RO_ATTR(tot_pending);
+LUSTRE_RW_ATTR(grant_compat_disable);
+LUSTRE_RO_ATTR(instance);
-LPROC_SEQ_FOPS_RO(tgt_tot_dirty);
-LPROC_SEQ_FOPS_RO(tgt_tot_granted);
-LPROC_SEQ_FOPS_RO(tgt_tot_pending);
-LPROC_SEQ_FOPS(tgt_grant_compat_disable);
+LUSTRE_RO_ATTR(num_exports);
struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
{ .name = "last_id",
.fops = &ofd_last_id_fops },
- { .name = "tot_dirty",
- .fops = &tgt_tot_dirty_fops },
- { .name = "tot_pending",
- .fops = &tgt_tot_pending_fops },
- { .name = "tot_granted",
- .fops = &tgt_tot_granted_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 = "brw_size",
.fops = &ofd_brw_size_fops },
- { .name = "instance",
- .fops = &ofd_target_instance_fops },
- { .name = "ir_factor",
- .fops = &ofd_ir_factor_fops },
{ .name = "checksum_dump",
.fops = &ofd_checksum_dump_fops },
- { .name = "grant_compat_disable",
- .fops = &tgt_grant_compat_disable_fops },
- { .name = "job_cleanup_interval",
- .fops = &ofd_job_interval_fops },
{ .name = "lfsck_layout",
.fops = &ofd_lfsck_layout_fops },
{ .name = "lfsck_verify_pfid",
LPROC_SEQ_FOPS(lprocfs_nid_stats_clear);
static struct attribute *ofd_attrs[] = {
+ &lustre_attr_tot_dirty.attr,
+ &lustre_attr_tot_granted.attr,
+ &lustre_attr_tot_pending.attr,
+ &lustre_attr_grant_compat_disable.attr,
+ &lustre_attr_instance.attr,
+ &lustre_attr_recovery_time_hard.attr,
+ &lustre_attr_recovery_time_soft.attr,
+ &lustre_attr_ir_factor.attr,
+ &lustre_attr_num_exports.attr,
&lustre_attr_seqs_allocated.attr,
&lustre_attr_grant_precreate.attr,
&lustre_attr_precreate_batch.attr,
- &lustre_attr_client_cache_count.attr,
- &lustre_attr_client_cache_seconds.attr,
&lustre_attr_degraded.attr,
&lustre_attr_fstype.attr,
&lustre_attr_sync_journal.attr,
- &lustre_attr_sync_lock_cancel.attr,
&lustre_attr_soft_sync_limit.attr,
&lustre_attr_lfsck_speed_limit.attr,
+ &lustre_attr_job_cleanup_interval.attr,
&lustre_attr_checksum_t10pi_enforce.attr,
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 14, 53, 0)
+ &lustre_attr_read_cache_enable.attr,
+ &lustre_attr_readcache_max_filesize.attr,
+ &lustre_attr_writethrough_cache_enable.attr,
+#endif
NULL,
};
RETURN(rc);
}
+ rc = tgt_tunables_init(&ofd->ofd_lut);
+ if (rc) {
+ CERROR("%s: tgt_tunables_init failed: rc = %d\n",
+ obd->obd_name, rc);
+ GOTO(obd_cleanup, rc);
+ }
+
rc = lprocfs_alloc_obd_stats(obd, LPROC_OFD_STATS_LAST);
if (rc) {
CERROR("%s: lprocfs_alloc_obd_stats failed: %d.\n",
obd->obd_name, rc);
- GOTO(obd_cleanup, rc);
+ GOTO(tgt_cleanup, rc);
}
entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
obd_free_stats:
lprocfs_free_obd_stats(obd);
+tgt_cleanup:
+ tgt_tunables_fini(&ofd->ofd_lut);
obd_cleanup:
lprocfs_obd_cleanup(obd);