Print this page
NEX-3508 CLONE - Port NEX-2946 Add UNMAP/TRIM functionality to ZFS and illumos
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Conflicts:
    usr/src/uts/common/io/scsi/targets/sd.c
    usr/src/uts/common/sys/scsi/targets/sddef.h

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/dkio.h
          +++ new/usr/src/uts/common/sys/dkio.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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  /*
  23   23   * Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   *
  25      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  26   26   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27   27   */
  28   28  
  29   29  #ifndef _SYS_DKIO_H
  30   30  #define _SYS_DKIO_H
  31   31  
  32   32  #include <sys/dklabel.h>        /* Needed for NDKMAP define */
       33 +#include <sys/int_limits.h>     /* Needed for UINT16_MAX */
  33   34  
  34   35  #ifdef  __cplusplus
  35   36  extern "C" {
  36   37  #endif
  37   38  
  38   39  /*
  39   40   * Structures and definitions for disk io control commands
  40   41   */
  41   42  
  42   43  /*
↓ open down ↓ 473 lines elided ↑ open up ↑
 516  517  #endif /* _SYSCALL32 */
 517  518  
 518  519  /*
 519  520   * firmware update type - temporary or permanent use
 520  521   */
 521  522  #define FW_TYPE_TEMP    0x0             /* temporary use */
 522  523  #define FW_TYPE_PERM    0x1             /* permanent use */
 523  524  
 524  525  /*
 525  526   * ioctl to free space (e.g. SCSI UNMAP) off a disk.
      527 + * Pass a dkioc_free_list_t containing a list of extents to be freed.
 526  528   */
 527  529  #define DKIOCFREE       (DKIOC|50)
 528  530  
 529      -typedef struct dkioc_free_s {
 530      -        uint32_t df_flags;
 531      -        uint32_t df_reserved;   /* For easy 64-bit alignment below... */
 532      -        diskaddr_t df_start;
 533      -        diskaddr_t df_length;
 534      -} dkioc_free_t;
 535      -
 536  531  #define DF_WAIT_SYNC    0x00000001      /* Wait for full write-out of free. */
      532 +typedef struct dkioc_free_list_ext_s {
      533 +        uint64_t                dfle_start;
      534 +        uint64_t                dfle_length;
      535 +} dkioc_free_list_ext_t;
 537  536  
      537 +typedef struct dkioc_free_list_s {
      538 +        uint64_t                dfl_flags;
      539 +        uint64_t                dfl_num_exts;
      540 +        int64_t                 dfl_offset;
      541 +
      542 +        /*
      543 +         * N.B. this is only an internal debugging API! This is only called
      544 +         * from debug builds of sd for pre-release checking. Remove before GA!
      545 +         */
      546 +        void                    (*dfl_ck_func)(uint64_t, uint64_t, void *);
      547 +        void                    *dfl_ck_arg;
      548 +
      549 +        dkioc_free_list_ext_t   dfl_exts[1];
      550 +} dkioc_free_list_t;
      551 +#define DFL_SZ(num_exts) \
      552 +        (sizeof (dkioc_free_list_t) + (num_exts - 1) * 16)
      553 +
 538  554  #ifdef  __cplusplus
 539  555  }
 540  556  #endif
 541  557  
 542  558  #endif /* _SYS_DKIO_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX