svn commit: r218603 - head/sbin/tunefs
Bruce Evans
brde at optusnet.com.au
Sun Feb 13 10:51:35 UTC 2011
On Sat, 12 Feb 2011, Konstantin Belousov wrote:
> Log:
> When creating a directory entry for the journal, always read at least
> the fragment, and write the full block. Reading less might not work
> due to device sector size bigger then size of direntries in the
> last directory fragment.
I think it should always write full fragments too (and the kernel should
always read/write in units of fragments, not sectors of any size).
> Modified: head/sbin/tunefs/tunefs.c
> ==============================================================================
> --- head/sbin/tunefs/tunefs.c Sat Feb 12 12:52:12 2011 (r218602)
> +++ head/sbin/tunefs/tunefs.c Sat Feb 12 13:12:45 2011 (r218603)
> @@ -733,16 +740,19 @@ dir_extend(ufs2_daddr_t blk, ufs2_daddr_
> {
> char block[MAXBSIZE];
>
> - if (bread(&disk, fsbtodb(&sblock, blk), block, size) <= 0) {
> + if (bread(&disk, fsbtodb(&sblock, blk), block,
> + roundup(size, sblock.fs_fsize)) <= 0) {
Rounding up to a fragment boundary is spelled fragroundup(fs, size) in
ffs. This use fs->fs_qfmask and fs->fs_fmask for optimality. It is
unclear if the kernel macros work in userland, but here we already
use fsbtodb() which uses fs->fsbtodb for optimality.
[I've just learned again about fragroundup() after trying to fix rounding
in cluster_read(). See blksize(). Since cluster_read() doesn't know
about the fragment size or the fs dependencies in blksize(), it cannot
read ahead correctly across i/o size boundaries (exactly one of which
occurs near EOF for almost all files with fragments in ffs). This bug is
missing in old breadn() -- it can even handle multiple i/o size boundaries,
since it is passed a separate size for every block.]
Bruce
More information about the svn-src-all
mailing list