svn commit: r268482 - in projects/random_number_generator: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs...

Mark Murray markm at FreeBSD.org
Thu Jul 10 07:17:01 UTC 2014


Author: markm
Date: Thu Jul 10 07:16:55 2014
New Revision: 268482
URL: http://svnweb.freebsd.org/changeset/base/268482

Log:
  MFC - tracking commit.
  Merging r268468 through r268481.

Modified:
  projects/random_number_generator/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  projects/random_number_generator/cddl/contrib/opensolaris/cmd/zhack/zhack.c
  projects/random_number_generator/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  projects/random_number_generator/share/mk/src.opts.mk
  projects/random_number_generator/sys/amd64/amd64/machdep.c
  projects/random_number_generator/sys/boot/i386/boot2/boot2.c
  projects/random_number_generator/sys/boot/pc98/boot2/Makefile
  projects/random_number_generator/sys/boot/pc98/boot2/boot2.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
  projects/random_number_generator/sys/dev/fb/fbd.c
  projects/random_number_generator/sys/dev/virtio/network/if_vtnet.c
  projects/random_number_generator/sys/dev/virtio/network/if_vtnetvar.h
  projects/random_number_generator/sys/dev/virtio/virtqueue.c
  projects/random_number_generator/sys/dev/virtio/virtqueue.h
  projects/random_number_generator/sys/netinet/in.h
  projects/random_number_generator/sys/netinet/in_pcb.c
  projects/random_number_generator/sys/netinet/in_pcb.h
  projects/random_number_generator/sys/netinet/in_pcbgroup.c
  projects/random_number_generator/sys/netinet/ip_output.c
Directory Properties:
  projects/random_number_generator/   (props changed)
  projects/random_number_generator/cddl/   (props changed)
  projects/random_number_generator/cddl/contrib/opensolaris/   (props changed)
  projects/random_number_generator/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  projects/random_number_generator/share/   (props changed)
  projects/random_number_generator/sys/   (props changed)
  projects/random_number_generator/sys/boot/   (props changed)
  projects/random_number_generator/sys/cddl/contrib/opensolaris/   (props changed)

Modified: projects/random_number_generator/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- projects/random_number_generator/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright 2012 Milan Jurik. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
@@ -6856,6 +6856,9 @@ zfs_do_bookmark(int argc, char **argv)
 		case ENOTSUP:
 			err_msg = "bookmark feature not enabled";
 			break;
+		case ENOSPC:
+			err_msg = "out of space";
+			break;
 		default:
 			err_msg = "unknown error";
 			break;
@@ -6864,7 +6867,7 @@ zfs_do_bookmark(int argc, char **argv)
 		    dgettext(TEXT_DOMAIN, err_msg));
 	}
 
-	return (ret);
+	return (ret != 0);
 
 usage:
 	usage(B_FALSE);

Modified: projects/random_number_generator/cddl/contrib/opensolaris/cmd/zhack/zhack.c
==============================================================================
--- projects/random_number_generator/cddl/contrib/opensolaris/cmd/zhack/zhack.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/cddl/contrib/opensolaris/cmd/zhack/zhack.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
@@ -362,7 +362,7 @@ zhack_do_feature_enable(int argc, char *
 		    feature.fi_guid);
 
 	VERIFY0(dsl_sync_task(spa_name(spa), NULL,
-	    zhack_feature_enable_sync, &feature, 5));
+	    zhack_feature_enable_sync, &feature, 5, ZFS_SPACE_CHECK_NORMAL));
 
 	spa_close(spa, FTAG);
 
@@ -473,7 +473,8 @@ zhack_do_feature_ref(int argc, char **ar
 	}
 
 	VERIFY0(dsl_sync_task(spa_name(spa), NULL,
-	    decr ? feature_decr_sync : feature_incr_sync, &feature, 5));
+	    decr ? feature_decr_sync : feature_incr_sync, &feature,
+	    5, ZFS_SPACE_CHECK_NORMAL));
 
 	spa_close(spa, FTAG);
 }

Modified: projects/random_number_generator/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- projects/random_number_generator/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -3076,17 +3076,10 @@ zpool_do_list(int argc, char **argv)
 	if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0)
 		usage(B_FALSE);
 
-	if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL)
-		return (1);
-
-	if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
-		(void) printf(gettext("no pools available\n"));
-		zprop_free_list(cb.cb_proplist);
-		return (0);
-	}
-
 	for (;;) {
-		pool_list_update(list);
+		if ((list = pool_list_get(argc, argv, &cb.cb_proplist,
+		    &ret)) == NULL)
+			return (1);
 
 		if (pool_list_count(list) == 0)
 			break;
@@ -3109,9 +3102,16 @@ zpool_do_list(int argc, char **argv)
 		if (count != 0 && --count == 0)
 			break;
 
+		pool_list_free(list);
 		(void) sleep(interval);
 	}
 
+	if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
+		(void) printf(gettext("no pools available\n"));
+		ret = 0;
+	}
+
+	pool_list_free(list);
 	zprop_free_list(cb.cb_proplist);
 	return (ret);
 }

Modified: projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
@@ -3873,7 +3873,6 @@ zfs_rename(zfs_handle_t *zhp, const char
 	     strcmp(property, "none") == 0)) {
 		flags.nounmount = B_TRUE;
 	}
-
 	if (flags.recurse) {
 
 		parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
@@ -3888,8 +3887,7 @@ zfs_rename(zfs_handle_t *zhp, const char
 			ret = -1;
 			goto error;
 		}
-
-	} else {
+	} else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
 		if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
 		    flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0,
 		    flags.forceunmount ? MS_FORCE : 0)) == NULL) {
@@ -3941,23 +3939,23 @@ zfs_rename(zfs_handle_t *zhp, const char
 		 * On failure, we still want to remount any filesystems that
 		 * were previously mounted, so we don't alter the system state.
 		 */
-		if (!flags.recurse)
+		if (cl != NULL)
 			(void) changelist_postfix(cl);
 	} else {
-		if (!flags.recurse) {
+		if (cl != NULL) {
 			changelist_rename(cl, zfs_get_name(zhp), target);
 			ret = changelist_postfix(cl);
 		}
 	}
 
 error:
-	if (parentname) {
+	if (parentname != NULL) {
 		free(parentname);
 	}
-	if (zhrp) {
+	if (zhrp != NULL) {
 		zfs_close(zhrp);
 	}
-	if (cl) {
+	if (cl != NULL) {
 		changelist_free(cl);
 	}
 	return (ret);

Modified: projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
==============================================================================
--- projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
  */
 
 /*
@@ -736,16 +737,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_s
 	if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
 		return (0);
 
-#ifdef sun
-	if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
-		(void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
-		    dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
-		    zfs_get_name(zhp), _sa_errorstr != NULL ?
-		    _sa_errorstr(ret) : "");
-		return (-1);
-	}
-#endif
-
 	for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
 		/*
 		 * Return success if there are no share options.
@@ -756,6 +747,17 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_s
 		    strcmp(shareopts, "off") == 0)
 			continue;
 
+#ifdef illumos
+		ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API);
+		if (ret != SA_OK) {
+			(void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
+			    dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
+			    zfs_get_name(zhp), _sa_errorstr != NULL ?
+			    _sa_errorstr(ret) : "");
+			return (-1);
+		}
+#endif
+
 		/*
 		 * If the 'zoned' property is set, then zfs_is_mountable()
 		 * will have already bailed out if we are in the global zone.

Modified: projects/random_number_generator/share/mk/src.opts.mk
==============================================================================
--- projects/random_number_generator/share/mk/src.opts.mk	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/share/mk/src.opts.mk	Thu Jul 10 07:16:55 2014	(r268482)
@@ -205,14 +205,7 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL C
 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
     ${__T} == "armv6hf" || ${__T} == "i386"
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
-__DEFAULT_NO_OPTIONS+=GNUCXX
-# The pc98 bootloader requires gcc to build and so we must leave gcc enabled
-# for pc98 for now.
-.if ${__TT} == "pc98"
-__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP
-.else
-__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP
-.endif
+__DEFAULT_NO_OPTIONS+=GNUCXX GCC GCC_BOOTSTRAP
 .else
 # If clang is not cc, then build gcc by default
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP

Modified: projects/random_number_generator/sys/amd64/amd64/machdep.c
==============================================================================
--- projects/random_number_generator/sys/amd64/amd64/machdep.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/amd64/amd64/machdep.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -2144,7 +2144,9 @@ makectx(struct trapframe *tf, struct pcb
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
+
 	td->td_frame->tf_rip = addr;
+	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
 	return (0);
 }
 
@@ -2244,8 +2246,8 @@ set_regs(struct thread *td, struct reg *
 		tp->tf_fs = regs->r_fs;
 		tp->tf_gs = regs->r_gs;
 		tp->tf_flags = TF_HASSEGS;
-		set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
 	}
+	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
 	return (0);
 }
 

Modified: projects/random_number_generator/sys/boot/i386/boot2/boot2.c
==============================================================================
--- projects/random_number_generator/sys/boot/i386/boot2/boot2.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/boot/i386/boot2/boot2.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -34,9 +34,22 @@ __FBSDID("$FreeBSD$");
 #include "boot2.h"
 #include "lib.h"
 
+/* Define to 0 to omit serial support */
+#ifndef SERIAL
+#define SERIAL 1
+#endif
+
 #define IO_KEYBOARD	1
 #define IO_SERIAL	2
 
+#if SERIAL
+#define DO_KBD (ioctrl & IO_KEYBOARD)
+#define DO_SIO (ioctrl & IO_SERIAL)
+#else
+#define DO_KBD (1)
+#define DO_SIO (0)
+#endif
+
 #define SECOND		18	/* Circa that many ticks in a second. */
 
 #define RBX_ASKNAME	0x0	/* -a */
@@ -131,9 +144,11 @@ static struct dsk {
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
 static uint32_t opts;
-static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
+#if SERIAL
+static int comspeed = SIOSPD;
 static uint8_t ioctrl = IO_KEYBOARD;
+#endif
 
 void exit(int);
 static void load(void);
@@ -276,7 +291,7 @@ main(void)
 		   "boot: ",
 		   dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
 		   'a' + dsk.part, kname);
-	if (ioctrl & IO_SERIAL)
+	if (DO_SIO)
 	    sio_flush();
 	if (!autoboot || keyhit(3*SECOND))
 	    getstr();
@@ -398,6 +413,7 @@ parse()
 		    }
 		    printf("Keyboard: %s\n", cp);
 		    continue;
+#if SERIAL
 		} else if (c == 'S') {
 		    j = 0;
 		    while ((unsigned int)(i = *arg++ - '0') <= 9)
@@ -407,18 +423,21 @@ parse()
 			break;
 		    }
 		    /* Fall through to error below ('S' not in optstr[]). */
+#endif
 		}
 		for (i = 0; c != optstr[i]; i++)
 		    if (i == NOPT - 1)
 			return -1;
 		opts ^= OPT_SET(flags[i]);
 	    }
+#if SERIAL
 	    ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
 		     OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
-	    if (ioctrl & IO_SERIAL) {
+	    if (DO_SIO) {
 	        if (sio_init(115200 / comspeed) != 0)
 		    ioctrl &= ~IO_SERIAL;
 	    }
+#endif
 	} else {
 	    for (q = arg--; *q && *q != '('; q++);
 	    if (*q) {
@@ -626,9 +645,9 @@ keyhit(unsigned ticks)
 static int
 xputc(int c)
 {
-    if (ioctrl & IO_KEYBOARD)
+    if (DO_KBD)
 	putc(c);
-    if (ioctrl & IO_SERIAL)
+    if (DO_SIO)
 	sio_putc(c);
     return c;
 }
@@ -648,9 +667,9 @@ xgetc(int fn)
     if (OPT_CHECK(RBX_NOINTR))
 	return 0;
     for (;;) {
-	if (ioctrl & IO_KEYBOARD && getc(1))
+	if (DO_KBD && getc(1))
 	    return fn ? 1 : getc(0);
-	if (ioctrl & IO_SERIAL && sio_ischar())
+	if (DO_SIO && sio_ischar())
 	    return fn ? 1 : sio_getc();
 	if (fn)
 	    return 0;

Modified: projects/random_number_generator/sys/boot/pc98/boot2/Makefile
==============================================================================
--- projects/random_number_generator/sys/boot/pc98/boot2/Makefile	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/boot/pc98/boot2/Makefile	Thu Jul 10 07:16:55 2014	(r268482)
@@ -3,8 +3,8 @@
 .include <bsd.own.mk>
 
 # XXX: clang can compile the boot code just fine, but boot2 gets too big
-CC:=		gcc
-COMPILER_TYPE:=	gcc
+#CC:=		gcc
+#COMPILER_TYPE:=	gcc
 
 NO_PIE=	yes
 
@@ -26,10 +26,7 @@ BOOT2_UFS?=	UFS1_AND_UFS2
 #BOOT2_UFS?=	UFS1_ONLY
 
 CFLAGS=	-Os \
-	-fno-guess-branch-probability \
 	-fomit-frame-pointer \
-	-fno-unit-at-a-time \
-	-mno-align-long-strings \
 	-mrtd \
 	-mregparm=3 \
 	-D${BOOT2_UFS} \
@@ -46,7 +43,10 @@ CFLAGS=	-Os \
 	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
 	-Winline
 
-CFLAGS.gcc+=	--param max-inline-insns-single=100
+CFLAGS.gcc+=	-fno-guess-branch-probability \
+		-fno-unit-at-a-time \
+		-mno-align-long-strings \
+		--param max-inline-insns-single=100
 
 # Set machine type to PC98_SYSTEM_PARAMETER
 #CFLAGS+=	-DSET_MACHINE_TYPE
@@ -54,6 +54,8 @@ CFLAGS.gcc+=	--param max-inline-insns-si
 # Initialize the bi_bios_geom using the BIOS geometry
 #CFLAGS+=	-DGET_BIOSGEOM
 
+CFLAGS.clang+=${CLANG_OPT_SMALL}
+
 LD_FLAGS=-static -N --gc-sections
 
 # Pick up ../Makefile.inc early.
@@ -112,3 +114,6 @@ boot2.h: boot1.out
 	    REL1=`printf "%d" ${REL1}` > ${.TARGET}
 
 .include <bsd.prog.mk>
+
+# XXX: clang integrated-as doesn't grok .codeNN directives yet
+CFLAGS+=		${CLANG_NO_IAS}

Modified: projects/random_number_generator/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- projects/random_number_generator/sys/boot/pc98/boot2/boot2.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/boot/pc98/boot2/boot2.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -36,9 +36,22 @@ __FBSDID("$FreeBSD$");
 #include "boot2.h"
 #include "lib.h"
 
+/* Define to 0 to omit serial support */
+#ifndef SERIAL
+#define SERIAL 0
+#endif
+
 #define IO_KEYBOARD	1
 #define IO_SERIAL	2
 
+#if SERIAL
+#define DO_KBD (ioctrl & IO_KEYBOARD)
+#define DO_SIO (ioctrl & IO_SERIAL)
+#else
+#define DO_KBD (1)
+#define DO_SIO (0)
+#endif
+
 #define SECOND		1	/* Circa that many ticks in a second. */
 
 #define RBX_ASKNAME	0x0	/* -a */
@@ -133,9 +146,11 @@ static struct dsk {
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
 static uint32_t opts;
-static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
+#if SERIAL
+static int comspeed = SIOSPD;
 static uint8_t ioctrl = IO_KEYBOARD;
+#endif
 
 void exit(int);
 static void load(void);
@@ -415,7 +430,7 @@ main(void)
 		   "boot: ",
 		   dsk.unit, dev_nm[dsk.type], dsk.unit,
 		   'a' + dsk.part, kname);
-	if (ioctrl & IO_SERIAL)
+	if (DO_SIO)
 	    sio_flush();
 	if (!autoboot || keyhit(3*SECOND))
 	    getstr();
@@ -537,6 +552,7 @@ parse()
 		    }
 		    printf("Keyboard: %s\n", cp);
 		    continue;
+#if SERIAL
 		} else if (c == 'S') {
 		    j = 0;
 		    while ((unsigned int)(i = *arg++ - '0') <= 9)
@@ -546,18 +562,21 @@ parse()
 			break;
 		    }
 		    /* Fall through to error below ('S' not in optstr[]). */
+#endif
 		}
 		for (i = 0; c != optstr[i]; i++)
 		    if (i == NOPT - 1)
 			return -1;
 		opts ^= OPT_SET(flags[i]);
 	    }
+#if SERIAL
 	    ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
 		     OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
-	    if (ioctrl & IO_SERIAL) {
+	    if (DO_SIO) {
 	        if (sio_init(115200 / comspeed) != 0)
 		    ioctrl &= ~IO_SERIAL;
 	    }
+#endif
 	} else {
 	    for (q = arg--; *q && *q != '('; q++);
 	    if (*q) {
@@ -780,9 +799,9 @@ keyhit(unsigned sec)
 static int
 xputc(int c)
 {
-    if (ioctrl & IO_KEYBOARD)
+    if (DO_KBD)
 	putc(c);
-    if (ioctrl & IO_SERIAL)
+    if (DO_SIO)
 	sio_putc(c);
     return c;
 }
@@ -805,9 +824,9 @@ xgetc(int fn)
     if (OPT_CHECK(RBX_NOINTR))
 	return 0;
     for (;;) {
-	if (ioctrl & IO_KEYBOARD && getc(1))
+	if (DO_KBD && getc(1))
 	    return fn ? 1 : getc(0);
-	if (ioctrl & IO_SERIAL && sio_ischar())
+	if (DO_SIO && sio_ischar())
 	    return fn ? 1 : sio_getc();
 	if (fn)
 	    return 0;

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -832,7 +832,8 @@ dmu_objset_create(const char *name, dmu_
 	doca.doca_type = type;
 
 	return (dsl_sync_task(name,
-	    dmu_objset_create_check, dmu_objset_create_sync, &doca, 5));
+	    dmu_objset_create_check, dmu_objset_create_sync, &doca,
+	    5, ZFS_SPACE_CHECK_NORMAL));
 }
 
 typedef struct dmu_objset_clone_arg {
@@ -931,7 +932,8 @@ dmu_objset_clone(const char *clone, cons
 	doca.doca_cred = CRED();
 
 	return (dsl_sync_task(clone,
-	    dmu_objset_clone_check, dmu_objset_clone_sync, &doca, 5));
+	    dmu_objset_clone_check, dmu_objset_clone_sync, &doca,
+	    5, ZFS_SPACE_CHECK_NORMAL));
 }
 
 int

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -1196,7 +1196,7 @@ dmu_recv_begin(char *tofs, char *tosnap,
 	drba.drba_cred = CRED();
 
 	return (dsl_sync_task(tofs, dmu_recv_begin_check, dmu_recv_begin_sync,
-	    &drba, 5));
+	    &drba, 5, ZFS_SPACE_CHECK_NORMAL));
 }
 
 struct restorearg {
@@ -2081,7 +2081,7 @@ dmu_recv_existing_end(dmu_recv_cookie_t 
 
 	error = dsl_sync_task(drc->drc_tofs,
 	    dmu_recv_end_check, dmu_recv_end_sync, drc,
-	    dmu_recv_end_modified_blocks);
+	    dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
 
 	if (error != 0)
 		dmu_recv_cleanup_ds(drc);
@@ -2095,7 +2095,7 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc)
 
 	error = dsl_sync_task(drc->drc_tofs,
 	    dmu_recv_end_check, dmu_recv_end_sync, drc,
-	    dmu_recv_end_modified_blocks);
+	    dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
 
 	if (error != 0) {
 		dmu_recv_cleanup_ds(drc);

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -13,7 +13,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -246,7 +246,8 @@ dsl_bookmark_create(nvlist_t *bmarks, nv
 	dbca.dbca_errors = errors;
 
 	return (dsl_sync_task(nvpair_name(pair), dsl_bookmark_create_check,
-	    dsl_bookmark_create_sync, &dbca, fnvlist_num_pairs(bmarks)));
+	    dsl_bookmark_create_sync, &dbca,
+	    fnvlist_num_pairs(bmarks), ZFS_SPACE_CHECK_NORMAL));
 }
 
 int
@@ -448,7 +449,8 @@ dsl_bookmark_destroy(nvlist_t *bmarks, n
 	dbda.dbda_success = fnvlist_alloc();
 
 	rv = dsl_sync_task(nvpair_name(pair), dsl_bookmark_destroy_check,
-	    dsl_bookmark_destroy_sync, &dbda, fnvlist_num_pairs(bmarks));
+	    dsl_bookmark_destroy_sync, &dbda, fnvlist_num_pairs(bmarks),
+	    ZFS_SPACE_CHECK_RESERVED);
 	fnvlist_free(dbda.dbda_success);
 	return (rv);
 }

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -1401,7 +1401,7 @@ dsl_dataset_snapshot(nvlist_t *snaps, nv
 	if (error == 0) {
 		error = dsl_sync_task(firstname, dsl_dataset_snapshot_check,
 		    dsl_dataset_snapshot_sync, &ddsa,
-		    fnvlist_num_pairs(snaps) * 3);
+		    fnvlist_num_pairs(snaps) * 3, ZFS_SPACE_CHECK_NORMAL);
 	}
 
 	if (suspended != NULL) {
@@ -1514,7 +1514,7 @@ dsl_dataset_snapshot_tmp(const char *fsn
 	}
 
 	error = dsl_sync_task(fsname, dsl_dataset_snapshot_tmp_check,
-	    dsl_dataset_snapshot_tmp_sync, &ddsta, 3);
+	    dsl_dataset_snapshot_tmp_sync, &ddsta, 3, ZFS_SPACE_CHECK_RESERVED);
 
 	if (needsuspend)
 		zil_resume(cookie);
@@ -1885,7 +1885,8 @@ dsl_dataset_rename_snapshot(const char *
 	ddrsa.ddrsa_recursive = recursive;
 
 	return (dsl_sync_task(fsname, dsl_dataset_rename_snapshot_check,
-	    dsl_dataset_rename_snapshot_sync, &ddrsa, 1));
+	    dsl_dataset_rename_snapshot_sync, &ddrsa,
+	    1, ZFS_SPACE_CHECK_RESERVED));
 }
 
 /*
@@ -2060,7 +2061,8 @@ dsl_dataset_rollback(const char *fsname,
 	ddra.ddra_result = result;
 
 	return (dsl_sync_task(fsname, dsl_dataset_rollback_check,
-	    dsl_dataset_rollback_sync, &ddra, 1));
+	    dsl_dataset_rollback_sync, &ddra,
+	    1, ZFS_SPACE_CHECK_RESERVED));
 }
 
 struct promotenode {
@@ -2581,7 +2583,8 @@ dsl_dataset_promote(const char *name, ch
 	ddpa.cr = CRED();
 
 	return (dsl_sync_task(name, dsl_dataset_promote_check,
-	    dsl_dataset_promote_sync, &ddpa, 2 + numsnaps));
+	    dsl_dataset_promote_sync, &ddpa,
+	    2 + numsnaps, ZFS_SPACE_CHECK_RESERVED));
 }
 
 int
@@ -2926,7 +2929,7 @@ dsl_dataset_set_refquota(const char *dsn
 	ddsqra.ddsqra_value = refquota;
 
 	return (dsl_sync_task(dsname, dsl_dataset_set_refquota_check,
-	    dsl_dataset_set_refquota_sync, &ddsqra, 0));
+	    dsl_dataset_set_refquota_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE));
 }
 
 static int
@@ -3041,7 +3044,8 @@ dsl_dataset_set_refreservation(const cha
 	ddsqra.ddsqra_value = refreservation;
 
 	return (dsl_sync_task(dsname, dsl_dataset_set_refreservation_check,
-	    dsl_dataset_set_refreservation_sync, &ddsqra, 0));
+	    dsl_dataset_set_refreservation_sync, &ddsqra,
+	    0, ZFS_SPACE_CHECK_NONE));
 }
 
 /*

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  */
 
 /*
@@ -282,7 +282,7 @@ dsl_deleg_set(const char *ddname, nvlist
 
 	return (dsl_sync_task(ddname, dsl_deleg_check,
 	    unset ? dsl_deleg_unset_sync : dsl_deleg_set_sync,
-	    &dda, fnvlist_num_pairs(nvp)));
+	    &dda, fnvlist_num_pairs(nvp), ZFS_SPACE_CHECK_RESERVED));
 }
 
 /*

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -506,7 +506,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snap
 
 	error = dsl_sync_task(nvpair_name(pair),
 	    dsl_destroy_snapshot_check, dsl_destroy_snapshot_sync,
-	    &dsda, 0);
+	    &dsda, 0, ZFS_SPACE_CHECK_NONE);
 	fnvlist_free(dsda.dsda_successful_snaps);
 
 	return (error);
@@ -899,7 +899,8 @@ dsl_destroy_head(const char *name)
 		objset_t *os;
 
 		error = dsl_sync_task(name, dsl_destroy_head_check,
-		    dsl_destroy_head_begin_sync, &ddha, 0);
+		    dsl_destroy_head_begin_sync, &ddha,
+		    0, ZFS_SPACE_CHECK_NONE);
 		if (error != 0)
 			return (error);
 
@@ -923,7 +924,7 @@ dsl_destroy_head(const char *name)
 	}
 
 	return (dsl_sync_task(name, dsl_destroy_head_check,
-	    dsl_destroy_head_sync, &ddha, 0));
+	    dsl_destroy_head_sync, &ddha, 0, ZFS_SPACE_CHECK_NONE));
 }
 
 /*

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -22,7 +22,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2014 Joyent, Inc. All rights reserved.
  */
 
@@ -642,7 +642,8 @@ dsl_dir_activate_fs_ss_limit(const char 
 	int error;
 
 	error = dsl_sync_task(ddname, dsl_dir_actv_fs_ss_limit_check,
-	    dsl_dir_actv_fs_ss_limit_sync, (void *)ddname, 0);
+	    dsl_dir_actv_fs_ss_limit_sync, (void *)ddname, 0,
+	    ZFS_SPACE_CHECK_RESERVED);
 
 	if (error == EALREADY)
 		error = 0;
@@ -1496,7 +1497,7 @@ dsl_dir_set_quota(const char *ddname, zp
 	ddsqra.ddsqra_value = quota;
 
 	return (dsl_sync_task(ddname, dsl_dir_set_quota_check,
-	    dsl_dir_set_quota_sync, &ddsqra, 0));
+	    dsl_dir_set_quota_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE));
 }
 
 int
@@ -1617,7 +1618,7 @@ dsl_dir_set_reservation(const char *ddna
 	ddsqra.ddsqra_value = reservation;
 
 	return (dsl_sync_task(ddname, dsl_dir_set_reservation_check,
-	    dsl_dir_set_reservation_sync, &ddsqra, 0));
+	    dsl_dir_set_reservation_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE));
 }
 
 static dsl_dir_t *
@@ -1899,7 +1900,8 @@ dsl_dir_rename(const char *oldname, cons
 	ddra.ddra_cred = CRED();
 
 	return (dsl_sync_task(oldname,
-	    dsl_dir_rename_check, dsl_dir_rename_sync, &ddra, 3));
+	    dsl_dir_rename_check, dsl_dir_rename_sync, &ddra,
+	    3, ZFS_SPACE_CHECK_RESERVED));
 }
 
 int

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -691,17 +691,12 @@ dsl_pool_adjustedsize(dsl_pool_t *dp, bo
 	uint64_t space, resv;
 
 	/*
-	 * Reserve about 1.6% (1/64), or at least 32MB, for allocation
-	 * efficiency.
-	 * XXX The intent log is not accounted for, so it must fit
-	 * within this slop.
-	 *
 	 * If we're trying to assess whether it's OK to do a free,
 	 * cut the reservation in half to allow forward progress
 	 * (e.g. make it possible to rm(1) files from a full pool).
 	 */
 	space = spa_get_dspace(dp->dp_spa);
-	resv = MAX(space >> 6, SPA_MINDEVSIZE >> 1);
+	resv = spa_get_slop_space(dp->dp_spa);
 	if (netfree)
 		resv >>= 1;
 

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -834,7 +834,7 @@ dsl_props_set(const char *dsname, zprop_
 		nblks = 2 * fnvlist_num_pairs(props);
 
 	return (dsl_sync_task(dsname, dsl_props_set_check, dsl_props_set_sync,
-	    &dpsa, nblks));
+	    &dpsa, nblks, ZFS_SPACE_CHECK_RESERVED));
 }
 
 typedef enum dsl_prop_getflags {

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -367,7 +367,7 @@ int
 dsl_scan_cancel(dsl_pool_t *dp)
 {
 	return (dsl_sync_task(spa_name(dp->dp_spa), dsl_scan_cancel_check,
-	    dsl_scan_cancel_sync, NULL, 3));
+	    dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED));
 }
 
 static void dsl_scan_visitbp(blkptr_t *bp,
@@ -1807,5 +1807,5 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_
 	(void) spa_vdev_state_exit(spa, NULL, 0);
 
 	return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check,
-	    dsl_scan_setup_sync, &func, 0));
+	    dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_NONE));
 }

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/dmu.h>
@@ -64,7 +64,8 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *
  */
 int
 dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc,
-    dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified)
+    dsl_syncfunc_t *syncfunc, void *arg,
+    int blocks_modified, zfs_space_check_t space_check)
 {
 	spa_t *spa;
 	dmu_tx_t *tx;
@@ -84,6 +85,7 @@ top:
 	dst.dst_pool = dp;
 	dst.dst_txg = dmu_tx_get_txg(tx);
 	dst.dst_space = blocks_modified << DST_AVG_BLKSHIFT;
+	dst.dst_space_check = space_check;
 	dst.dst_checkfunc = checkfunc != NULL ? checkfunc : dsl_null_checkfunc;
 	dst.dst_syncfunc = syncfunc;
 	dst.dst_arg = arg;
@@ -117,13 +119,14 @@ top:
 
 void
 dsl_sync_task_nowait(dsl_pool_t *dp, dsl_syncfunc_t *syncfunc, void *arg,
-    int blocks_modified, dmu_tx_t *tx)
+    int blocks_modified, zfs_space_check_t space_check, dmu_tx_t *tx)
 {
 	dsl_sync_task_t *dst = kmem_zalloc(sizeof (*dst), KM_SLEEP);
 
 	dst->dst_pool = dp;
 	dst->dst_txg = dmu_tx_get_txg(tx);
 	dst->dst_space = blocks_modified << DST_AVG_BLKSHIFT;
+	dst->dst_space_check = space_check;
 	dst->dst_checkfunc = dsl_null_checkfunc;
 	dst->dst_syncfunc = syncfunc;
 	dst->dst_arg = arg;
@@ -140,25 +143,34 @@ void
 dsl_sync_task_sync(dsl_sync_task_t *dst, dmu_tx_t *tx)
 {
 	dsl_pool_t *dp = dst->dst_pool;
-	uint64_t quota, used;
 
 	ASSERT0(dst->dst_error);
 
 	/*
-	 * Check for sufficient space.  We just check against what's
-	 * on-disk; we don't want any in-flight accounting to get in our
-	 * way, because open context may have already used up various
-	 * in-core limits (arc_tempreserve, dsl_pool_tempreserve).
+	 * Check for sufficient space.
+	 *
+	 * When the sync task was created, the caller specified the
+	 * type of space checking required.  See the comment in
+	 * zfs_space_check_t for details on the semantics of each
+	 * type of space checking.
+	 *
+	 * We just check against what's on-disk; we don't want any
+	 * in-flight accounting to get in our way, because open context
+	 * may have already used up various in-core limits
+	 * (arc_tempreserve, dsl_pool_tempreserve).
 	 */
-	quota = dsl_pool_adjustedsize(dp, B_FALSE) -
-	    metaslab_class_get_deferred(spa_normal_class(dp->dp_spa));
-	used = dp->dp_root_dir->dd_phys->dd_used_bytes;
-	/* MOS space is triple-dittoed, so we multiply by 3. */
-	if (dst->dst_space > 0 && used + dst->dst_space * 3 > quota) {
-		dst->dst_error = SET_ERROR(ENOSPC);
-		if (dst->dst_nowaiter)
-			kmem_free(dst, sizeof (*dst));
-		return;
+	if (dst->dst_space_check != ZFS_SPACE_CHECK_NONE) {
+		uint64_t quota = dsl_pool_adjustedsize(dp,
+		    dst->dst_space_check == ZFS_SPACE_CHECK_RESERVED) -
+		    metaslab_class_get_deferred(spa_normal_class(dp->dp_spa));
+		uint64_t used = dp->dp_root_dir->dd_phys->dd_used_bytes;
+		/* MOS space is triple-dittoed, so we multiply by 3. */
+		if (dst->dst_space > 0 && used + dst->dst_space * 3 > quota) {
+			dst->dst_error = SET_ERROR(ENOSPC);
+			if (dst->dst_nowaiter)
+				kmem_free(dst, sizeof (*dst));
+			return;
+		}
 	}
 
 	/*

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
@@ -317,7 +317,8 @@ dsl_dataset_user_hold(nvlist_t *holds, m
 	dduha.dduha_minor = cleanup_minor;
 
 	ret = dsl_sync_task(nvpair_name(pair), dsl_dataset_user_hold_check,
-	    dsl_dataset_user_hold_sync, &dduha, fnvlist_num_pairs(holds));
+	    dsl_dataset_user_hold_sync, &dduha,
+	    fnvlist_num_pairs(holds), ZFS_SPACE_CHECK_RESERVED);
 	fnvlist_free(dduha.dduha_chkholds);
 
 	return (ret);
@@ -600,7 +601,7 @@ dsl_dataset_user_release_impl(nvlist_t *
 	ddura.ddura_chkholds = fnvlist_alloc();
 
 	error = dsl_sync_task(pool, dsl_dataset_user_release_check,
-	    dsl_dataset_user_release_sync, &ddura, 0);
+	    dsl_dataset_user_release_sync, &ddura, 0, ZFS_SPACE_CHECK_NONE);
 	fnvlist_free(ddura.ddura_todelete);
 	fnvlist_free(ddura.ddura_chkholds);
 

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -689,7 +689,8 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp)
 			 * feature descriptions object.
 			 */
 			error = dsl_sync_task(spa->spa_name, NULL,
-			    spa_sync_version, &ver, 6);
+			    spa_sync_version, &ver,
+			    6, ZFS_SPACE_CHECK_RESERVED);
 			if (error)
 				return (error);
 			continue;
@@ -701,7 +702,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp)
 
 	if (need_sync) {
 		return (dsl_sync_task(spa->spa_name, NULL, spa_sync_props,
-		    nvp, 6));
+		    nvp, 6, ZFS_SPACE_CHECK_RESERVED));
 	}
 
 	return (0);
@@ -782,7 +783,7 @@ spa_change_guid(spa_t *spa)
 	guid = spa_generate_guid(NULL);
 
 	error = dsl_sync_task(spa->spa_name, spa_change_guid_check,
-	    spa_change_guid_sync, &guid, 5);
+	    spa_change_guid_sync, &guid, 5, ZFS_SPACE_CHECK_RESERVED);
 
 	if (error == 0) {
 		spa_config_sync(spa, B_FALSE, B_TRUE);

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/spa.h>
@@ -324,7 +324,7 @@ spa_history_log_nvl(spa_t *spa, nvlist_t
 
 	/* Kick this off asynchronously; errors are ignored. */
 	dsl_sync_task_nowait(spa_get_dsl(spa), spa_history_log_sync,
-	    nvarg, 0, tx);
+	    nvarg, 0, ZFS_SPACE_CHECK_NONE, tx);
 	dmu_tx_commit(tx);
 
 	/* spa_history_log_sync will free nvl */
@@ -465,7 +465,7 @@ log_internal(nvlist_t *nvl, const char *
 		spa_history_log_sync(nvl, tx);
 	} else {
 		dsl_sync_task_nowait(spa_get_dsl(spa),
-		    spa_history_log_sync, nvl, 0, tx);
+		    spa_history_log_sync, nvl, 0, ZFS_SPACE_CHECK_NONE, tx);
 	}
 	/* spa_history_log_sync() will free nvl */
 }

Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==============================================================================
--- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c	Thu Jul 10 05:36:04 2014	(r268481)
+++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c	Thu Jul 10 07:16:55 2014	(r268482)
@@ -354,6 +354,32 @@ zfs_deadman_init()
 #endif	/* !illumos */
 
 /*
+ * Normally, we don't allow the last 3.2% (1/(2^spa_slop_shift)) of space in
+ * the pool to be consumed.  This ensures that we don't run the pool
+ * completely out of space, due to unaccounted changes (e.g. to the MOS).

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list