From owner-freebsd-fs@FreeBSD.ORG Fri Apr 9 14:26:03 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F4051065672; Fri, 9 Apr 2010 14:26:03 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2D97C8FC0A; Fri, 9 Apr 2010 14:26:01 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA20592; Fri, 09 Apr 2010 17:25:59 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4BBF38F7.80205@freebsd.org> Date: Fri, 09 Apr 2010 17:25:59 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.24 (X11/20100319) MIME-Version: 1.0 To: freebsd-fs@freebsd.org, freebsd-geom@freebsd.org References: <201003261528.o2QFSAuI037251@chez.mckusick.com> <4BB4D9FB.3000706@freebsd.org> In-Reply-To: <4BB4D9FB.3000706@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: g_vfs_open and bread(devvp, ...) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2010 14:26:03 -0000 I came up with a small demonstration for why I bothered with this issue at all. To reproduce the experiment you would need this image: http://people.freebsd.org/~avg/test_img.gz and avgfs:) http://people.freebsd.org/~avg/avgfs/ The image needs to be gunzip-ed, of course. avgfs:) needs to be compiled, avgfs.ko loaded. The demonstration is to be executed on an unpatched system, e.g. head before r205860, or a branch other than head, or recent head with r206097 and r205860 reverted. Then do the following. I. Inspect test image. $ hd test_img.img | more II. Test bread() through avgfs vnode. 1. Present the image as a disk with 2K sector size mdconfig -a -t vnode -f test_img.img -S 2048 -u 0 2. Mount the image using avgfs:) mount -t avg /dev/md0 /mnt 3. Read some data blocks in one go and examine the result. dd if=/mnt/thefile bs=10k count=1 | hd 4. Re-read the same data using 2K blocks and examine the result. dd if=/mnt/thefile bs=2k count=5 | hd 5. Cleanup. umount /mnt III. Test bread() through devvp. 1. Mount the image using avgfs:) with devvp option. mount -t avg -o devvp /dev/md0 /mnt 2. Read some data blocks in one go and examine the result. dd if=/mnt/thefile bs=10k count=1 | hd 3. Re-read the same data using 2K blocks and examine the result. dd if=/mnt/thefile bs=2k count=5 | hd 4. Cleanup. umount /mnt mdconfig -d -u 0 kldunload avgfs SPOILER. In my testing only III.3 produces an unexpected result: 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000800 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| * 00001000 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 |................| * 00001800 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 |................| * 00002000 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| * The result is explained here: http://lists.freebsd.org/pipermail/freebsd-fs/2008-February/004268.html Repeat the experiment on a patched system. See if the change was worth bothering. P.S. avgfs:) is explained here: http://permalink.gmane.org/gmane.os.freebsd.devel.file-systems/8886 -- Andriy Gapon