Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Oct 2017 10:24:34 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r324297 - stable/11/usr.sbin/diskinfo
Message-ID:  <201710051024.v95AOYou088780@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Oct  5 10:24:34 2017
New Revision: 324297
URL: https://svnweb.freebsd.org/changeset/base/324297

Log:
  MFC r324086: Alike to ZFS disable cache flush after first ENOTSUP error.

Modified:
  stable/11/usr.sbin/diskinfo/diskinfo.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- stable/11/usr.sbin/diskinfo/diskinfo.c	Thu Oct  5 07:18:16 2017	(r324296)
+++ stable/11/usr.sbin/diskinfo/diskinfo.c	Thu Oct  5 10:24:34 2017	(r324297)
@@ -630,7 +630,7 @@ slogbench(int fd, int isreg, off_t mediasize, u_int se
 {
 	off_t off;
 	u_int size;
-	int error, n, N;
+	int error, n, N, nowritecache = 0;
 
 	printf("Synchronous random writes:\n");
 	for (size = sectorsize; size <= MAXTX; size *= 2) {
@@ -641,12 +641,18 @@ slogbench(int fd, int isreg, off_t mediasize, u_int se
 			for (n = 0; n < 250; n++) {
 				off = random() % (mediasize / size);
 				parwrite(fd, size, off * size);
+				if (nowritecache)
+					continue;
 				if (isreg)
 					error = fsync(fd);
 				else
 					error = ioctl(fd, DIOCGFLUSH);
-				if (error < 0)
-					err(EX_IOERR, "Flush error");
+				if (error < 0) {
+					if (errno == ENOTSUP)
+						nowritecache = 1;
+					else
+						err(EX_IOERR, "Flush error");
+				}
 			}
 			N += 250;
 		} while (delta_t() < 1.0);



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