Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2016 15:22:55 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r308765 - in stable/10: sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.sbin/watchdogd
Message-ID:  <201611171522.uAHFMtn9076585@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Nov 17 15:22:55 2016
New Revision: 308765
URL: https://svnweb.freebsd.org/changeset/base/308765

Log:
  Revert r308753: some unrelated changes were included into the commit

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/10/usr.sbin/watchdogd/watchdogd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Nov 17 15:19:33 2016	(r308764)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Nov 17 15:22:55 2016	(r308765)
@@ -6945,22 +6945,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 				continue;
 			}
 
-			/*
-			 * We rely on the L1 portion of the header below, so
-			 * it's invalid for this header to have been evicted out
-			 * of the ghost cache, prior to being written out. The
-			 * ARC_FLAG_L2_WRITING bit ensures this won't happen.
-			 */
-			ASSERT(HDR_HAS_L1HDR(hdr));
-
-			ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
-			ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
-			ASSERT3U(arc_hdr_size(hdr), >, 0);
-			uint64_t size = arc_hdr_size(hdr);
-			uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
-			    size);
-
-			if ((write_psize + asize) > target_sz) {
+			if ((write_asize + HDR_GET_LSIZE(hdr)) > target_sz) {
 				full = B_TRUE;
 				mutex_exit(hash_lock);
 				ARCSTAT_BUMP(arcstat_l2_write_full);
@@ -6995,6 +6980,21 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			list_insert_head(&dev->l2ad_buflist, hdr);
 			mutex_exit(&dev->l2ad_mtx);
 
+			/*
+			 * We rely on the L1 portion of the header below, so
+			 * it's invalid for this header to have been evicted out
+			 * of the ghost cache, prior to being written out. The
+			 * ARC_FLAG_L2_WRITING bit ensures this won't happen.
+			 */
+			ASSERT(HDR_HAS_L1HDR(hdr));
+
+			ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
+			ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
+			ASSERT3U(arc_hdr_size(hdr), >, 0);
+			uint64_t size = arc_hdr_size(hdr);
+			uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
+			    size);
+
 			(void) refcount_add_many(&dev->l2ad_alloc, size, hdr);
 
 			/*

Modified: stable/10/usr.sbin/watchdogd/watchdogd.c
==============================================================================
--- stable/10/usr.sbin/watchdogd/watchdogd.c	Thu Nov 17 15:19:33 2016	(r308764)
+++ stable/10/usr.sbin/watchdogd/watchdogd.c	Thu Nov 17 15:22:55 2016	(r308765)
@@ -80,8 +80,7 @@ static u_int timeout = WD_TO_128SEC;
 static u_int exit_timeout = WD_TO_NEVER;
 static u_int pretimeout = 0;
 static u_int timeout_sec;
-static u_int nap = 1;
-static int passive = 0;
+static u_int passive = 0;
 static int is_daemon = 0;
 static int is_dry_run = 0;  /* do not arm the watchdog, only
 			       report on timing of the watch
@@ -89,6 +88,7 @@ static int is_dry_run = 0;  /* do not ar
 static int do_timedog = 0;
 static int do_syslog = 1;
 static int fd = -1;
+static int nap = 1;
 static int carp_thresh_seconds = -1;
 static char *test_cmd = NULL;
 
@@ -685,15 +685,10 @@ seconds_to_pow2ns(int seconds)
 static void
 parseargs(int argc, char *argv[])
 {
-	struct timespec ts;
 	int longindex;
 	int c;
 	const char *lopt;
 
-	/* Get the default value of timeout_sec from the default timeout. */
-	pow2ns_to_ts(timeout, &ts);
-	timeout_sec = ts.tv_sec;
-
 	/*
 	 * if we end with a 'd' aka 'watchdogd' then we are the daemon program,
 	 * otherwise run as a command line utility.
@@ -736,9 +731,9 @@ parseargs(int argc, char *argv[])
 		case 't':
 			timeout_sec = atoi(optarg);
 			timeout = parse_timeout_to_pow2ns(c, NULL, optarg);
-			if (debugging)
-				printf("Timeout is 2^%d nanoseconds\n",
-				    timeout);
+ 			if (debugging)
+ 				printf("Timeout is 2^%d nanoseconds\n",
+ 				    timeout);
 			break;
 		case 'T':
 			carp_thresh_seconds =
@@ -776,9 +771,6 @@ parseargs(int argc, char *argv[])
 		}
 	}
 
-	if (nap > timeout_sec / 2)
-		nap = timeout_sec / 2;
-
 	if (carp_thresh_seconds == -1)
 		carp_thresh_seconds = nap;
 
@@ -787,7 +779,10 @@ parseargs(int argc, char *argv[])
 	if (is_daemon && timeout < WD_TO_1SEC)
 		errx(EX_USAGE, "-t argument is less than one second.");
 	if (pretimeout_set) {
-		if (pretimeout >= timeout_sec) {
+		struct timespec ts;
+
+		pow2ns_to_ts(timeout, &ts);
+		if (pretimeout >= (uintmax_t)ts.tv_sec) {
 			errx(EX_USAGE,
 			    "pretimeout (%d) >= timeout (%d -> %ld)\n"
 			    "see manual section TIMEOUT RESOLUTION",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611171522.uAHFMtn9076585>