Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Feb 2008 11:47:34 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Andriy Gapon <avg@icyb.net.ua>
Cc:        freebsd-fs@FreeBSD.org, freebsd-hackers@FreeBSD.org, Pav Lucistnik <pav@FreeBSD.org>, Bruce Evans <bde@zeta.org.au>
Subject:   Re: fs/udf: vm pages "overlap" while reading large dir 
Message-ID:  <4299.1202816854@critter.freebsd.dk>
In-Reply-To: Your message of "Tue, 12 Feb 2008 13:24:34 %2B0200." <47B181F2.2070808@icyb.net.ua> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <47B181F2.2070808@icyb.net.ua>, Andriy Gapon writes:

>2.3. this code passes to bread blkno that is calculated as 4*sector,
>where sector is a number of a physical 2048-byte sector. [**]
>[**] - I think that this is a requirement of buffcache system, because
>internally it performs many calculations that seem to assume that block
>size is always 512.

Yes, the buf-cache works in 512 bytes units throughout.

>3.1. for a fresh buf getlbk would assign the following:
>bsize = bo->bo_bsize;
>offset = blkno * bsize;

That's clearly wrong.

We need to assert that the blkno is aligned to the start of a sector
and use the 512 byte units, so I guess it would be:

    offset = dbtob(blkno);
    KASSERT(!(offset & (bsize - 1)), ("suitable diagnostic"));


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



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