fs/udf: vm pages "overlap" while reading large dir

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Feb 12 03:47:38 PST 2008


In message <47B181F2.2070808 at 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 at 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.


More information about the freebsd-fs mailing list