Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Apr 2010 17:25:59 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        freebsd-fs@freebsd.org, freebsd-geom@freebsd.org
Subject:   Re: g_vfs_open and bread(devvp, ...)
Message-ID:  <4BBF38F7.80205@freebsd.org>
In-Reply-To: <4BB4D9FB.3000706@freebsd.org>
References:  <201003261528.o2QFSAuI037251@chez.mckusick.com> <4BB4D9FB.3000706@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



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