-struct lprocfs_vars lprocfs_osd_obd_vars[] = {
- { "blocksize", lprocfs_osd_rd_blksize, 0, 0 },
- { "kbytestotal", lprocfs_osd_rd_kbytestotal, 0, 0 },
- { "kbytesfree", lprocfs_osd_rd_kbytesfree, 0, 0 },
- { "kbytesavail", lprocfs_osd_rd_kbytesavail, 0, 0 },
- { "filestotal", lprocfs_osd_rd_filestotal, 0, 0 },
- { "filesfree", lprocfs_osd_rd_filesfree, 0, 0 },
- { "fstype", lprocfs_osd_rd_fstype, 0, 0 },
- { "mntdev", lprocfs_osd_rd_mntdev, 0, 0 },
- { "force_sync", 0, lprocfs_osd_wr_force_sync },
-#ifdef HAVE_LDISKFS_PDO
- { "pdo", lprocfs_osd_rd_pdo, lprocfs_osd_wr_pdo, 0 },
+static ssize_t index_in_idif_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct dt_device *dt = container_of(kobj, struct dt_device,
+ dd_kobj);
+ struct osd_device *dev = osd_dt_dev(dt);
+ struct lu_target *tgt;
+ struct lu_env env;
+ bool val;
+ int rc;
+
+ LASSERT(dev);
+ if (unlikely(!dev->od_mnt))
+ return -EINPROGRESS;
+
+ rc = kstrtobool(buffer, &val);
+ if (rc)
+ return rc;
+
+ if (dev->od_index_in_idif) {
+ if (val)
+ return count;
+
+ LCONSOLE_WARN("%s: OST-index in IDIF has been enabled, "
+ "it cannot be reverted back.\n", osd_name(dev));
+ return -EPERM;
+ }
+
+ if (!val)
+ return count;
+
+ rc = lu_env_init(&env, LCT_DT_THREAD);
+ if (rc)
+ return rc;
+
+ tgt = dev->od_dt_dev.dd_lu_dev.ld_site->ls_tgt;
+ tgt->lut_lsd.lsd_feature_rocompat |= OBD_ROCOMPAT_IDX_IN_IDIF;
+ rc = tgt_server_data_update(&env, tgt, 1);
+ lu_env_fini(&env);
+ if (rc < 0)
+ return rc;
+
+ LCONSOLE_INFO("%s: enable OST-index in IDIF successfully, "
+ "it cannot be reverted back.\n", osd_name(dev));
+
+ dev->od_index_in_idif = 1;
+ return count;
+}
+LUSTRE_RW_ATTR(index_in_idif);
+
+int osd_register_proc_index_in_idif(struct osd_device *osd)
+{
+ struct dt_device *dt = &osd->od_dt_dev;
+
+ return sysfs_create_file(&dt->dd_kobj, &lustre_attr_index_in_idif.attr);
+}