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
NEX-3023 Panics and hangs when using write_same and compare_and_write
Review by: Bayard Bell <bayard.bell@nexenta.com>
Review by: Rick McNeal <rick.mcneal@nexenta.com>
Review by: Jean McCormack <jean.mccormack@nexenta.com>
Approved by: Jean McCormack <jean.mccormack@nexenta.com>
Related bug: NEX-2723 Kernel panic in xfer_completion code for write_same (0x93) and compare_and_write (0x89)
NEX-1965 Page fault at netbios_first_level_name_decode+0xbb
Support simultaneous compare_and_write operations for VAAI
Bug IDs SUP-505
                SUP-1768
                SUP-1928
Code Reviewers:
        Sarah Jelinek
        Jeffry Molanus
        Albert Lee
        Harold Shaw
OS-69 Open source VAAI
re #7936 rb3706 Support for COMSTAR/OEM
re #8002 rb3706 Allow setting iSCSI vendor ID via stmf_sbd.conf
re #11454 rb3750 Fix inconsistent vid/pid in stmf
8226 nza-kernel needs to be buildable by itself
Re #6790 backspace should perform delete on console
VAAI (XXX ATS support for COMSTAR, YYY Block-copy support for COMSTAR)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/lu/stmf_sbd/stmf_sbd.h
          +++ new/usr/src/uts/common/io/comstar/lu/stmf_sbd/stmf_sbd.h
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - *
  24      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  25   25   */
  26   26  
  27   27  #ifndef _STMF_SBD_H
  28   28  #define _STMF_SBD_H
  29   29  
       30 +#include <sys/dkio.h>
       31 +
  30   32  #ifdef  __cplusplus
  31   33  extern "C" {
  32   34  #endif
  33   35  
  34   36  typedef stmf_status_t   sbd_status_t;
       37 +#include "ats_copy_mgr.h"
  35   38  extern char sbd_vendor_id[];
  36   39  extern char sbd_product_id[];
  37   40  extern char sbd_revision[];
  38   41  extern char *sbd_mgmt_url;
  39   42  extern uint16_t sbd_mgmt_url_alloc_size;
  40   43  extern krwlock_t sbd_global_prop_lock;
  41   44  
  42   45  /*
  43   46   * Error codes
  44   47   */
↓ open down ↓ 2 lines elided ↑ open up ↑
  47   50  
  48   51  #define SBD_ALREADY             (SBD_FAILURE | STMF_FSC(1))
  49   52  #define SBD_NOT_SUPPORTED       (SBD_FAILURE | STMF_FSC(2))
  50   53  #define SBD_META_CORRUPTED      (SBD_FAILURE | STMF_FSC(3))
  51   54  #define SBD_INVALID_ARG         (SBD_FAILURE | STMF_FSC(4))
  52   55  #define SBD_NOT_FOUND           (SBD_FAILURE | STMF_FSC(5))
  53   56  #define SBD_ALLOC_FAILURE       (SBD_FAILURE | STMF_FSC(6))
  54   57  #define SBD_FILEIO_FAILURE      (SBD_FAILURE | STMF_FSC(7))
  55   58  #define SBD_IO_PAST_EOF         (SBD_FAILURE | STMF_FSC(8))
  56   59  #define SBD_BUSY                (SBD_FAILURE | STMF_FSC(9))
       60 +#define SBD_COMPARE_FAILED      (SBD_FAILURE | STMF_FSC(10))
  57   61  
  58   62  #define SHARED_META_DATA_SIZE   65536
  59   63  #define SBD_META_OFFSET         4096
  60   64  #define SBD_MIN_LU_SIZE         (1024 * 1024)
  61   65  
  62   66  /*
  63   67   * sms endianess
  64   68   */
  65   69  #define SMS_BIG_ENDIAN                  0x00
  66   70  #define SMS_LITTLE_ENDIAN               0xFF
↓ open down ↓ 170 lines elided ↑ open up ↑
 237  241          uint64_t        sl_total_data_size;
 238  242          uint64_t        sl_data_readable_size;  /* read() fails after this */
 239  243          uint64_t        sl_data_offset;         /* After the metadata,if any */
 240  244          uint64_t        sl_lu_size;             /* READ CAPACITY size */
 241  245          uint64_t        sl_blksize;             /* used for zvols */
 242  246          uint64_t        sl_max_xfer_len;        /* used for zvols */
 243  247  
 244  248          struct sbd_it_data      *sl_it_list;
 245  249          struct sbd_pgr          *sl_pgr;
 246  250          uint64_t        sl_rs_owner_session_id;
      251 +        list_t          sl_ats_io_list;
 247  252  } sbd_lu_t;
 248  253  
 249  254  /*
 250  255   * sl_flags
 251  256   */
 252  257  #define SL_LINKED                           0x00000001
 253  258  #define SL_META_OPENED                      0x00000002
 254  259  #define SL_REGISTERED                       0x00000004
 255  260  #define SL_META_NEEDS_FLUSH                 0x00000008
 256  261  #define SL_DATA_NEEDS_FLUSH                 0x00000010
↓ open down ↓ 36 lines elided ↑ open up ↑
 293  298  void sbd_task_free(struct scsi_task *task);
 294  299  stmf_status_t sbd_abort(struct stmf_lu *lu, int abort_cmd, void *arg,
 295  300      uint32_t flags);
 296  301  void sbd_ctl(struct stmf_lu *lu, int cmd, void *arg);
 297  302  stmf_status_t sbd_info(uint32_t cmd, stmf_lu_t *lu, void *arg, uint8_t *buf,
 298  303      uint32_t *bufsizep);
 299  304  sbd_status_t sbd_write_lu_info(sbd_lu_t *sl);
 300  305  sbd_status_t sbd_flush_data_cache(sbd_lu_t *sl, int fsync_done);
 301  306  sbd_status_t sbd_wcd_set(int wcd, sbd_lu_t *sl);
 302  307  void sbd_wcd_get(int *wcd, sbd_lu_t *sl);
 303      -int sbd_unmap(sbd_lu_t *, uint64_t, uint64_t);
      308 +int sbd_unmap(sbd_lu_t *sl, dkioc_free_list_t *dfl);
 304  309  
      310 +void sbd_handle_short_write_transfers(scsi_task_t *, stmf_data_buf_t *,
      311 +    uint32_t);
      312 +void sbd_handle_short_read_transfers(scsi_task_t *, stmf_data_buf_t *,
      313 +    uint8_t *, uint32_t, uint32_t);
      314 +
 305  315  #ifdef  __cplusplus
 306  316  }
 307  317  #endif
 308  318  
 309  319  #endif /* _STMF_SBD_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX