Print this page
7938 Port ZOL #3712 disable LBA weighting on files and SSDs

@@ -21,10 +21,11 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2017 James S Blachly, MD <james.blachly@gmail.com>
  */
 
 #include <sys/zfs_context.h>
 #include <sys/spa_impl.h>
 #include <sys/refcount.h>

@@ -270,10 +271,11 @@
         dev_t dev;
         int otyp;
         boolean_t validate_devid = B_FALSE;
         ddi_devid_t devid;
         uint64_t capacity = 0, blksz = 0, pbsize;
+        int device_rotational;
 
         /*
          * We must have a pathname, and it must be absolute.
          */
         if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') {

@@ -542,10 +544,20 @@
                 (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce,
                     FKIOCTL, kcred, NULL);
         }
 
         /*
+         * Inform the ZIO pipeline if we are non-rotational
+         */
+        device_rotational = ldi_prop_get_int(dvd->vd_lh, LDI_DEV_T_ANY,
+            "device-rotational", 0);
+        vd->vdev_nonrot = (device_rotational ? B_FALSE : B_TRUE);
+
+        cmn_err(CE_NOTE, "![vdev_disk_open] %s :: vd->vdev_nonrot == %d\n",
+            vd->vdev_path, (int) vd->vdev_nonrot);
+
+        /*
          * Clear the nowritecache bit, so that on a vdev_reopen() we will
          * try again.
          */
         vd->vdev_nowritecache = B_FALSE;