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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/vdev_disk.c
          +++ new/usr/src/uts/common/fs/zfs/vdev_disk.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  24   24   * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  25   25   * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
       26 + * Copyright (c) 2017 James S Blachly, MD <james.blachly@gmail.com>
  26   27   */
  27   28  
  28   29  #include <sys/zfs_context.h>
  29   30  #include <sys/spa_impl.h>
  30   31  #include <sys/refcount.h>
  31   32  #include <sys/vdev_disk.h>
  32   33  #include <sys/vdev_impl.h>
  33   34  #include <sys/abd.h>
  34   35  #include <sys/fs/zfs.h>
  35   36  #include <sys/zio.h>
↓ open down ↓ 229 lines elided ↑ open up ↑
 265  266                  struct dk_minfo ud;
 266  267          } dks;
 267  268          struct dk_minfo_ext *dkmext = &dks.ude;
 268  269          struct dk_minfo *dkm = &dks.ud;
 269  270          int error;
 270  271          dev_t dev;
 271  272          int otyp;
 272  273          boolean_t validate_devid = B_FALSE;
 273  274          ddi_devid_t devid;
 274  275          uint64_t capacity = 0, blksz = 0, pbsize;
      276 +        int device_rotational;
 275  277  
 276  278          /*
 277  279           * We must have a pathname, and it must be absolute.
 278  280           */
 279  281          if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') {
 280  282                  vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
 281  283                  return (SET_ERROR(EINVAL));
 282  284          }
 283  285  
 284  286          /*
↓ open down ↓ 252 lines elided ↑ open up ↑
 537  539  
 538  540                  /*
 539  541                   * Since we own the whole disk, try to enable disk write
 540  542                   * caching.  We ignore errors because it's OK if we can't do it.
 541  543                   */
 542  544                  (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce,
 543  545                      FKIOCTL, kcred, NULL);
 544  546          }
 545  547  
 546  548          /*
      549 +         * Inform the ZIO pipeline if we are non-rotational
      550 +         */
      551 +        device_rotational = ldi_prop_get_int(dvd->vd_lh, LDI_DEV_T_ANY,
      552 +            "device-rotational", 0);
      553 +        vd->vdev_nonrot = (device_rotational ? B_FALSE : B_TRUE);
      554 +
      555 +        cmn_err(CE_NOTE, "![vdev_disk_open] %s :: vd->vdev_nonrot == %d\n",
      556 +            vd->vdev_path, (int) vd->vdev_nonrot);
      557 +
      558 +        /*
 547  559           * Clear the nowritecache bit, so that on a vdev_reopen() we will
 548  560           * try again.
 549  561           */
 550  562          vd->vdev_nowritecache = B_FALSE;
 551  563  
 552  564          return (0);
 553  565  }
 554  566  
 555  567  static void
 556  568  vdev_disk_close(vdev_t *vd)
↓ open down ↓ 362 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX