From mboxrd@z Thu Jan 1 00:00:00 1970
From: Pat LaVarre
Subject: Re: zeroes read back more often than appended
Date: 21 Oct 2003 10:46:57 -0600
Sender: linux-fsdevel-owner@vger.kernel.org
Message-ID: <1066754816.12021.1.camel@patehci2>
References: <1065553341.8172.45.camel@patehci2>
<20031007204951.A25423@falcon.csc.calpoly.edu>
<1065732882.5176.14.camel@patehci2> <1065747151.2314.12.camel@patehci2>
<1065803984.3037.7.camel@patehci2> <1065809754.3037.105.camel@patehci2>
<1066091916.3011.2.camel@patehci2> <1066096137.3314.32.camel@patehci2>
<1066692050.2814.33.camel@patehci2> <1066747637.8228.7.camel@patehci2>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Return-path:
Received: from email-out1.iomega.com ([147.178.1.82]:62914 "EHLO
email.iomega.com") by vger.kernel.org with ESMTP id S263212AbTJUQrJ
(ORCPT );
Tue, 21 Oct 2003 12:47:09 -0400
Received: from royntex01.iomegacorp.com (unknown [147.178.90.120])
by email.iomega.com (Postfix) with ESMTP id 711E018C8
for ; Tue, 21 Oct 2003 10:47:08 -0600 (MDT)
To: linux-fsdevel@vger.kernel.org
In-Reply-To: <1066747637.8228.7.camel@patehci2>
List-Id: linux-fsdevel.vger.kernel.org
Yes indeed, again I see udf reading of more zeroes than appended, if I
try 2.6.0-test8 with SMP, with PREEMPT, on seek-write backing store, via
the trivially revised whd.c and fswhd script quoted as a patch below.
Why so carefully do nothing different in a more complex way?
So that now more easily we can try changing those variables. In
particular, I hope to show failures without SMP, without PREEMPT, on
preallotted backing store, in such tests as:
fswhd 0 768 mkudffs 0xFF600 0xC8 0x3
Pat LaVarre
diff -Nur o/tty.txt bin/tty.txt
--- o/tty.txt 1969-12-31 17:00:00.000000000 -0700
+++ bin/tty.txt 2003-10-21 09:20:38.113900136 -0600
@@ -0,0 +1,18 @@
+$
+$ cd /mnt/hda11; fswhd 255 1 mkudffs 0xFF600 0xC8 0x1
+Linux 2.6.0-test8 i686
+/mnt/hda11
+dd if=/dev/zero of=dd.bin bs=1M seek=255 count=1 2>/dev/null
+-rw-rw-r-- 1 pat pat 268435456 Oct 21 09:18 dd.bin
+mkudffs 1.0.0b2 for UDF FS 1.0.0-cvs, 2002/02/09
+0
+hexdump -C whd0.bin | head -3
+00000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa |................|
+*
+034cd000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
++++ 2.dmesg 2003-10-21 09:19:06.301857688 -0600
++fffff
++UDF-fs DEBUG fs/udf/balloc.c:192:udf_bitmap_free_blocks: bit 2951 already set
++UDF-fs DEBUG fs/udf/balloc.c:193:udf_bitmap_free_blocks: byte=ffffff80
++UDF-fs DEBUG fs/udf/balloc.c:192:udf_bitmap_free_blocks: bit 2951 already set
+$
diff -Nur o/whd.c bin/whd.c
--- o/whd.c 1969-12-31 17:00:00.000000000 -0700
+++ bin/whd.c 2003-10-21 08:45:30.000000000 -0600
@@ -0,0 +1,67 @@
+#include
+#include
+#include
+#include
+
+static FILE * fi[1234];
+
+int main(int argc, char * argv[]) // 0xFF600 0xC8
+{
+ int width;
+ int height;
+ int depth;
+ char * chars;
+ char nonzero;
+ int h;
+ int d;
+ int rc;
+
+ --argc; ++argv;
+ assert(argc == 3);
+ rc = sscanf(argv[0], "0x%X", &width);
+ assert(rc == 1);
+ rc = sscanf(argv[1], "0x%X", &height);
+ assert(rc == 1);
+ rc = sscanf(argv[2], "0x%X", &depth);
+ assert(rc == 1);
+ assert(depth < (sizeof fi / sizeof fi[0]));
+
+ nonzero = '\xAA';
+ chars = malloc(width);
+ assert(chars != NULL);
+ memset(&chars[0], nonzero, width);
+
+ for (d = 0; d < depth; ++d) {
+ char st[123];
+ sprintf(&st[0], "whd%d.bin", d);
+ fi[d] = fopen(&st[0], "wb");
+ assert(fi[d] != NULL);
+ }
+
+ for (h = 0; h < height; ++h) {
+ fprintf(stderr, "\r%d ", height - h - 1);
+ for (d = 0; d < depth; ++d) {
+ rc = fwrite(chars, 1, width, fi[d]);
+ if (rc != width) {
+ perror("fwrite");
+ exit(-__LINE__);
+ }
+ }
+ }
+
+ for (d = 0; d < depth; ++d) {
+ rc = fclose(fi[d]);
+ assert(rc == 0);
+ }
+
+ fprintf(stderr, "\n");
+
+ for (d = 0; d < depth; ++d) {
+ char st[123];
+ sprintf(&st[0], "hexdump -C whd%d.bin | head -3", d);
+ fprintf(stderr, "%s\n", st);
+ (void) system(st);
+ }
+
+ return 0;
+}
diff -Nur o/fswhd bin/fswhd
--- o/fswhd 1969-12-31 17:00:00.000000000 -0700
+++ bin/fswhd 2003-10-21 09:15:34.103116800 -0600
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+uname -msr
+pwd
+rm dd.bin
+cmd="dd if=/dev/zero of=dd.bin bs=1M seek=$1 count=$2"
+echo "$cmd 2>/dev/null"
+$cmd 2>/dev/null
+ls -l dd.bin
+
+sudo losetup /dev/loop0 dd.bin
+sudo $3 2>&1 | head -1
+sudo $3 /dev/loop0 >/dev/null
+
+sudo mount /dev/loop0 /mnt/loop0
+sudo chown `id -u`:`id -g` /mnt/loop0/.
+dmesg >1.dmesg
+cd /mnt/loop0
+whd $4 $5 $6
+cd -
+dmesg >2.dmesg
+
+diff -u 1.dmesg 2.dmesg | grep '^\+' | head -5
+rm 1.dmesg 2.dmesg
+sudo umount /mnt/loop0
+sudo losetup -d /dev/loop0