summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/truss/codes.c4
-rw-r--r--usr/src/uts/common/fs/zfs/zvol.c11
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c13
-rw-r--r--usr/src/uts/common/sys/dkio.h8
4 files changed, 34 insertions, 2 deletions
diff --git a/usr/src/cmd/truss/codes.c b/usr/src/cmd/truss/codes.c
index 888e6c9caf..9e7d513178 100644
--- a/usr/src/cmd/truss/codes.c
+++ b/usr/src/cmd/truss/codes.c
@@ -1380,6 +1380,10 @@ const struct ioc {
NULL},
{ (uint_t)DKIOCREADONLY, "DKIOCREADONLY",
NULL},
+ { (uint_t)DKIOCFREE, "DKIOCFREE",
+ NULL},
+ { (uint_t)DKIOC_CANFREE, "DKIOC_CANFREE",
+ NULL},
/* disk ioctls - (0x04 << 8) - fdio.h */
{ (uint_t)FDIOGCHAR, "FDIOGCHAR",
diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c
index 2ac660e9f7..b61e000f9c 100644
--- a/usr/src/uts/common/fs/zfs/zvol.c
+++ b/usr/src/uts/common/fs/zfs/zvol.c
@@ -1663,7 +1663,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
{
zvol_state_t *zv;
struct dk_callback *dkc;
- int error = 0;
+ int i, error = 0;
locked_range_t *lr;
mutex_enter(&zfsdev_state_lock);
@@ -1889,6 +1889,15 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
return (error);
}
+ case DKIOC_CANFREE:
+ i = zvol_unmap_enabled ? 1 : 0;
+ if (ddi_copyout(&i, (void *)arg, sizeof (int), flag) != 0) {
+ error = EFAULT;
+ } else {
+ error = 0;
+ }
+ break;
+
default:
error = SET_ERROR(ENOTTY);
break;
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index 51058cf50a..c4bc51a385 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -26,7 +26,7 @@
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
* Copyright (c) 2012, 2016 by Delphix. All rights reserved.
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
* Copyright 2017 Nexenta Systems, Inc.
* Copyright 2019 Racktop Systems
*/
@@ -22635,6 +22635,7 @@ sdioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cred_p, int *rval_p)
case DKIOCGMEDIAINFO:
case DKIOCGMEDIAINFOEXT:
case DKIOCSOLIDSTATE:
+ case DKIOC_CANFREE:
case MHIOCENFAILFAST:
case MHIOCSTATUS:
case MHIOCTKOWN:
@@ -23484,6 +23485,16 @@ skip_ready_valid:
}
break;
+ case DKIOC_CANFREE:
+ SD_TRACE(SD_LOG_IOCTL, un, "DKIOC_CANFREE\n");
+ i = (un->un_thin_flags & SD_THIN_PROV_ENABLED) ? 1 : 0;
+ if (ddi_copyout(&i, (void *)arg, sizeof (int), flag) != 0) {
+ err = EFAULT;
+ } else {
+ err = 0;
+ }
+ break;
+
case DKIOCGETWCE: {
int wce;
diff --git a/usr/src/uts/common/sys/dkio.h b/usr/src/uts/common/sys/dkio.h
index 7a9bbc3f15..9d88731c5d 100644
--- a/usr/src/uts/common/sys/dkio.h
+++ b/usr/src/uts/common/sys/dkio.h
@@ -24,6 +24,7 @@
*
* Copyright 2017 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#ifndef _SYS_DKIO_H
@@ -543,6 +544,13 @@ typedef struct dkioc_free_list_s {
(sizeof (dkioc_free_list_t) + \
(num_exts - 1) * sizeof (dkioc_free_list_ext_t))
+/*
+ * ioctl to determine if free (e.g. SCSI UNMAP) is supported.
+ * See FDIOC ioctls for why we're not using '51' here.
+ */
+#define DKIOC_CANFREE (DKIOC|60)
+
+
#ifdef __cplusplus
}
#endif