+#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
+