Description: -z flag to zero the device but not bother rereading it.
Author: Peter Samuelson <psamuelson@efolder.net>

--- e2fsprogs-1.42.8.orig/misc/badblocks.c
+++ e2fsprogs-1.42.8/misc/badblocks.c
@@ -89,7 +89,7 @@ unsigned int sys_page_size = 4096;
 static void usage(void)
 {
 	fprintf(stderr, _(
-"Usage: %s [-b block_size] [-i input_file] [-o output_file] [-svwnf]\n"
+"Usage: %s [-b block_size] [-i input_file] [-o output_file] [-svwnfz]\n"
 "       [-c blocks_at_once] [-d delay_factor_between_reads] [-e max_bad_blocks]\n"
 "       [-p num_passes] [-t test_pattern [-t test_pattern [...]]]\n"
 "       device [last_block [first_block]]\n"),
@@ -100,7 +100,7 @@ static void usage(void)
 static void exclusive_usage(void)
 {
 	fprintf(stderr,
-		_("%s: The -n and -w options are mutually exclusive.\n\n"),
+		_("%s: The -n, -w and -z options are mutually exclusive.\n\n"),
 		program_name);
 	exit(1);
 }
@@ -615,6 +615,9 @@ static unsigned int test_rw (int dev, bl
 	if (t_flag) {
 		pattern = t_patts;
 		nr_pattern = t_flag;
+	} else if (w_flag == 3) {
+		pattern = &patterns[3];
+		nr_pattern = 1;
 	} else {
 		pattern = patterns;
 		nr_pattern = sizeof(patterns) / sizeof(patterns[0]);
@@ -662,6 +665,9 @@ static unsigned int test_rw (int dev, bl
 		if (s_flag | v_flag)
 			fputs(_(done_string), stderr);
 		flush_bufs();
+		if (w_flag == 3)
+			continue;
+
 		if (s_flag | v_flag)
 			fputs(_("Reading and comparing: "), stderr);
 		num_blocks = last_block;
@@ -1074,7 +1080,7 @@ int main (int argc, char ** argv)
 
 	if (argc && *argv)
 		program_name = *argv;
-	while ((c = getopt (argc, argv, "b:d:e:fi:o:svwnc:p:h:t:BX")) != EOF) {
+	while ((c = getopt (argc, argv, "b:d:e:fi:o:svwnc:p:h:t:zBX")) != EOF) {
 		switch (c) {
 		case 'b':
 			block_size = parse_uint(optarg, "block size");
@@ -1147,6 +1153,12 @@ int main (int argc, char ** argv)
 				t_patts[t_flag++] = pattern;
 			}
 			break;
+		case 'z':
+			if (w_flag)
+				exclusive_usage();
+			test_func = test_rw;
+			w_flag = 3;
+			break;
 		case 'B':
 			use_buffered_io = 1;
 			break;
