}
LUSTRE_WO_ATTR(force_sync);
+static ssize_t nonrotational_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct dt_device *dt = container_of(kobj, struct dt_device,
+ dd_kobj);
+ struct osd_device *osd = osd_dt_dev(dt);
+
+ LASSERT(osd);
+ if (!osd->od_os)
+ return -EINPROGRESS;
+
+ return sprintf(buf, "%u\n", osd->od_nonrotational);
+}
+
+static ssize_t nonrotational_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 *osd = osd_dt_dev(dt);
+ bool val;
+ int rc;
+
+ LASSERT(osd);
+ if (!osd->od_os)
+ return -EINPROGRESS;
+
+ rc = kstrtobool(buffer, &val);
+ if (rc)
+ return rc;
+
+ osd->od_nonrotational = val;
+ return count;
+}
+LUSTRE_RW_ATTR(nonrotational);
+
static ssize_t index_backup_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct seq_file *m = file->private_data;
struct dt_device *dt = m->private;
struct osd_device *osd = osd_dt_dev(dt);
- s64 val;
+ char kernbuf[22] = "";
+ u64 val;
int rc;
LASSERT(osd != NULL);
if (unlikely(osd->od_os == NULL))
return -EINPROGRESS;
- rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
- if (rc)
+ if (count >= sizeof(kernbuf))
+ return -EINVAL;
+
+ if (copy_from_user(kernbuf, buffer, count))
+ return -EFAULT;
+ kernbuf[count] = 0;
+
+ rc = sysfs_memparse(kernbuf, count, &val, "B");
+ if (rc < 0)
return rc;
- if (val < 0)
- return -ERANGE;
osd->od_readcache_max_filesize = val > OSD_MAX_CACHE_SIZE ?
OSD_MAX_CACHE_SIZE : val;
&lustre_attr_fstype.attr,
&lustre_attr_mntdev.attr,
&lustre_attr_force_sync.attr,
+ &lustre_attr_nonrotational.attr,
&lustre_attr_index_backup.attr,
&lustre_attr_auto_scrub.attr,
NULL,
LASSERT(type);
LASSERT(name);
+ /* put reference taken by class_search_type */
+ kobject_put(&type->typ_kobj);
+
osd->od_dt_dev.dd_ktype.default_attrs = zfs_attrs;
rc = dt_tunables_init(&osd->od_dt_dev, type, name,
lprocfs_osd_obd_vars);