Whamcloud - gitweb
Revert "EX-3637 osd-ldiskfs: revalidate nonrotational state"
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 7 Feb 2022 18:51:27 +0000 (18:51 +0000)
committerOleg Drokin <green@whamcloud.com>
Tue, 8 Feb 2022 04:03:08 +0000 (04:03 +0000)
This reverts commit 5a1da772cf1721967d9dae55fae3d19aebba70f8.

Change-Id: I576d4cbd9794e4d4c4d941929e9c9e35ec01212a
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46473
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c
lustre/osd-ldiskfs/osd_lproc.c
lustre/osd-zfs/osd_internal.h
lustre/osd-zfs/osd_lproc.c

index 9c6b126..b4a7dd9 100644 (file)
@@ -2247,15 +2247,6 @@ static int osd_object_print(const struct lu_env *env, void *cookie,
                    d ? d->id_ops->id_name : "plain");
 }
 
-static void osd_tune_nonrot(struct osd_device *osd, bool nonrotational)
-{
-       /* do not use pagecache with flash-backed storage */
-       if (!osd->od_read_cache_enable_set)
-               osd->od_read_cache_enable = !nonrotational;
-       if (!osd->od_writethrough_cache_enable_set)
-               osd->od_writethrough_cache_enable = !nonrotational;
-}
-
 /*
  * Concurrency: shouldn't matter.
  */
@@ -2267,7 +2258,6 @@ int osd_statfs(const struct lu_env *env, struct dt_device *d,
        struct kstatfs *ksfs;
        __u64 reserved;
        int result = 0;
-       int nonrot;
 
        if (unlikely(osd->od_mnt == NULL))
                return -EINPROGRESS;
@@ -2289,13 +2279,6 @@ int osd_statfs(const struct lu_env *env, struct dt_device *d,
        if (unlikely(sb->s_flags & SB_RDONLY))
                sfs->os_state |= OS_STATFS_READONLY;
 
-       /* periodically re-check status from the kernel, if not manually set */
-       nonrot = !!blk_queue_nonrot(bdev_get_queue(osd_sb(osd)->s_bdev));
-       if (unlikely(nonrot != osd->od_nonrotational &&
-                    !osd->od_nonrotational_set)) {
-               osd->od_nonrotational = nonrot;
-               osd_tune_nonrot(osd, nonrot);
-       }
        sfs->os_state |= osd->od_nonrotational ? OS_STATFS_NONROT : 0;
 
        if (ldiskfs_has_feature_extents(sb))
@@ -7965,10 +7948,10 @@ static int osd_mount(const struct lu_env *env,
        if (lmd_flags & LMD_FLG_NOSCRUB)
                o->od_auto_scrub_interval = AS_NEVER;
 
-       /* Can only check block device after mount */
        if (blk_queue_nonrot(bdev_get_queue(osd_sb(o)->s_bdev))) {
-               o->od_nonrotational = 1;
-               osd_tune_nonrot(o, true);
+               /* do not use pagecache with flash-backed storage */
+               o->od_writethrough_cache = 0;
+               o->od_read_cache = 0;
        }
 
        GOTO(out, rc = 0);
@@ -8035,8 +8018,8 @@ static int osd_device_init0(const struct lu_env *env,
        o->od_t10_type = 0;
        init_waitqueue_head(&o->od_commit_cb_done);
 
-       o->od_read_cache_enable = 1;
-       o->od_writethrough_cache_enable = 1;
+       o->od_read_cache = 1;
+       o->od_writethrough_cache = 1;
        o->od_readcache_max_filesize = OSD_MAX_CACHE_SIZE;
        o->od_readcache_max_iosize = OSD_READCACHE_MAX_IO_MB << 20;
        o->od_writethrough_max_iosize = OSD_WRITECACHE_MAX_IO_MB << 20;
@@ -8063,6 +8046,10 @@ static int osd_device_init0(const struct lu_env *env,
        if (rc != 0)
                GOTO(out, rc);
 
+       /* Can only check block device after mount */
+       o->od_nonrotational =
+               blk_queue_nonrot(bdev_get_queue(osd_sb(o)->s_bdev));
+
        rc = osd_obj_map_init(env, o);
        if (rc != 0)
                GOTO(out_mnt, rc);
index 3131ee2..77afcda 100644 (file)
@@ -277,12 +277,10 @@ struct osd_device {
                                  od_in_init:1,
                                  od_index_in_idif:1,
        /* Other flags */
-                                 od_read_cache_enable:1,
-                                 od_read_cache_enable_set:1,
-                                 od_writethrough_cache_enable:1,
-                                 od_writethrough_cache_enable_set:1,
-                                 od_nonrotational:1,
-                                 od_nonrotational_set:1;
+                                 od_read_cache:1,
+                                 od_writethrough_cache:1,
+                                 od_nonrotational:1;
+
 
        __s64                     od_auto_scrub_interval;
        __u32                     od_dirent_journal;
index caf0128..fb13841 100644 (file)
@@ -63,7 +63,7 @@
 static inline bool osd_use_page_cache(struct osd_device *d)
 {
        /* do not use pagecache if write and read caching are disabled */
-       if (d->od_writethrough_cache_enable + d->od_read_cache_enable == 0)
+       if (d->od_writethrough_cache + d->od_read_cache == 0)
                return false;
        /* use pagecache by default */
        return true;
@@ -874,7 +874,7 @@ static int osd_bufs_get(const struct lu_env *env, struct dt_object *dt,
        cache = osd_use_page_cache(osd);
        while (cache) {
                if (write) {
-                       if (!osd->od_writethrough_cache_enable) {
+                       if (!osd->od_writethrough_cache) {
                                cache = false;
                                break;
                        }
@@ -883,7 +883,7 @@ static int osd_bufs_get(const struct lu_env *env, struct dt_object *dt,
                                break;
                        }
                } else {
-                       if (!osd->od_read_cache_enable) {
+                       if (!osd->od_read_cache) {
                                cache = false;
                                break;
                        }
index 5edc61e..42fa6c3 100644 (file)
@@ -264,7 +264,7 @@ static ssize_t read_cache_enable_show(struct kobject *kobj,
        if (unlikely(!osd->od_mnt))
                return -EINPROGRESS;
 
-       return sprintf(buf, "%u\n", osd->od_read_cache_enable);
+       return sprintf(buf, "%u\n", osd->od_read_cache);
 }
 
 static ssize_t read_cache_enable_store(struct kobject *kobj,
@@ -285,9 +285,7 @@ static ssize_t read_cache_enable_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       osd->od_read_cache_enable = !!val;
-       osd->od_read_cache_enable_set = 1;
-
+       osd->od_read_cache = !!val;
        return count;
 }
 LUSTRE_RW_ATTR(read_cache_enable);
@@ -304,7 +302,7 @@ static ssize_t writethrough_cache_enable_show(struct kobject *kobj,
        if (unlikely(!osd->od_mnt))
                return -EINPROGRESS;
 
-       return sprintf(buf, "%u\n", osd->od_writethrough_cache_enable);
+       return sprintf(buf, "%u\n", osd->od_writethrough_cache);
 }
 
 static ssize_t writethrough_cache_enable_store(struct kobject *kobj,
@@ -326,9 +324,7 @@ static ssize_t writethrough_cache_enable_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       osd->od_writethrough_cache_enable = !!val;
-       osd->od_writethrough_cache_enable = 1;
-
+       osd->od_writethrough_cache = !!val;
        return count;
 }
 LUSTRE_RW_ATTR(writethrough_cache_enable);
@@ -436,9 +432,7 @@ static ssize_t nonrotational_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       osd->od_nonrotational = !!val;
-       osd->od_nonrotational_set = 1;
-
+       osd->od_nonrotational = val;
        return count;
 }
 LUSTRE_RW_ATTR(nonrotational);
@@ -613,8 +607,7 @@ static int ldiskfs_osd_oi_scrub_seq_show(struct seq_file *m, void *data)
 
 LDEBUGFS_SEQ_FOPS_RO(ldiskfs_osd_oi_scrub);
 
-static int ldiskfs_osd_readcache_max_filesize_seq_show(struct seq_file *m,
-                                                      void *data)
+static int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data)
 {
        struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
 
@@ -627,9 +620,8 @@ static int ldiskfs_osd_readcache_max_filesize_seq_show(struct seq_file *m,
 }
 
 static ssize_t
-ldiskfs_osd_readcache_max_filesize_seq_write(struct file *file,
-                                            const char __user *buffer,
-                                            size_t count, loff_t *off)
+ldiskfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
        struct dt_device *dt = m->private;
@@ -657,7 +649,8 @@ ldiskfs_osd_readcache_max_filesize_seq_write(struct file *file,
                                         OSD_MAX_CACHE_SIZE : val;
        return count;
 }
-LDEBUGFS_SEQ_FOPS(ldiskfs_osd_readcache_max_filesize);
+
+LDEBUGFS_SEQ_FOPS(ldiskfs_osd_readcache);
 
 static int ldiskfs_osd_readcache_max_io_seq_show(struct seq_file *m, void *data)
 {
@@ -868,7 +861,7 @@ struct ldebugfs_vars ldebugfs_osd_obd_vars[] = {
        { .name =       "oi_scrub",
          .fops =       &ldiskfs_osd_oi_scrub_fops      },
        { .name =       "readcache_max_filesize",
-         .fops =       &ldiskfs_osd_readcache_max_filesize_fops},
+         .fops =       &ldiskfs_osd_readcache_fops     },
        { .name =       "readcache_max_io_mb",
          .fops =       &ldiskfs_osd_readcache_max_io_fops      },
        { .name =       "writethrough_max_io_mb",
index 8588101..e97f9ff 100644 (file)
@@ -351,8 +351,7 @@ struct osd_device {
                                 od_is_ost:1,
                                 od_in_init:1,
                                 od_posix_acl:1,
-                                od_nonrotational:1,
-                                od_nonrotational_set:1;
+                                od_nonrotational:1;
        unsigned int             od_dnsize;
        int                      od_index_backup_stop;
 
index 9727e72..c91ccf4 100644 (file)
@@ -327,9 +327,7 @@ static ssize_t nonrotational_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       osd->od_nonrotational = !!val;
-       osd->od_nonrotational_set = 1;
-
+       osd->od_nonrotational = val;
        return count;
 }
 LUSTRE_RW_ATTR(nonrotational);
@@ -370,8 +368,7 @@ ssize_t index_backup_store(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RW_ATTR(index_backup);
 
-static int zfs_osd_readcache_max_filesize_seq_show(struct seq_file *m,
-                                                  void *data)
+static int zfs_osd_readcache_seq_show(struct seq_file *m, void *data)
 {
        struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
 
@@ -384,9 +381,8 @@ static int zfs_osd_readcache_max_filesize_seq_show(struct seq_file *m,
 }
 
 static ssize_t
-zfs_osd_readcache_max_filesize_seq_write(struct file *file,
-                                        const char __user *buffer,
-                                        size_t count, loff_t *off)
+zfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
+                           size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
        struct dt_device *dt = m->private;
@@ -414,7 +410,7 @@ zfs_osd_readcache_max_filesize_seq_write(struct file *file,
                                         OSD_MAX_CACHE_SIZE : val;
        return count;
 }
-LDEBUGFS_SEQ_FOPS(zfs_osd_readcache_max_filesize);
+LDEBUGFS_SEQ_FOPS(zfs_osd_readcache);
 
 static struct attribute *zfs_attrs[] = {
        &lustre_attr_fstype.attr,
@@ -430,7 +426,7 @@ struct ldebugfs_vars ldebugfs_osd_obd_vars[] = {
        { .name =       "oi_scrub",
          .fops =       &zfs_osd_oi_scrub_fops          },
        { .name =       "readcache_max_filesize",
-         .fops =       &zfs_osd_readcache_max_filesize_fops            },
+         .fops =       &zfs_osd_readcache_fops         },
        { 0 }
 };