Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2017 15:58:41 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324086 - head/usr.sbin/diskinfo
Message-ID:  <201709281558.v8SFwf4H026295@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Sep 28 15:58:41 2017
New Revision: 324086
URL: https://svnweb.freebsd.org/changeset/base/324086

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

Modified:
  head/usr.sbin/diskinfo/diskinfo.c

Modified: head/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- head/usr.sbin/diskinfo/diskinfo.c	Thu Sep 28 15:23:38 2017	(r324085)
+++ head/usr.sbin/diskinfo/diskinfo.c	Thu Sep 28 15:58:41 2017	(r324086)
@@ -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?201709281558.v8SFwf4H026295>