Subject: Re: VOP_BMAP question
To: None <email@example.com>
From: Juergen Hannken-Illjes <firstname.lastname@example.org>
Date: 12/23/2003 19:09:53
On Tue, Dec 23, 2003 at 09:55:37AM -0800, Bill Studenmund wrote:
> On Fri, Dec 19, 2003 at 10:13:22PM +0100, Juergen Hannken-Illjes wrote:
> > How does VOP_BMAP() handle fragments?
> > Given a file with holes obtained from ftruncate(), what does VOP_BMAP()
> > return in its argument "bnp" if it finds a fragment?
> > Is it the block number of the fragment or will it return (daddr_t)-1?
> > Is it always ok to write a full block to "bnp"?
> I think you've been bitten by an ffs ambiguity (since only ffs has
> What ffs calls a fragment in its documentation (the 1k in an 8k/1k file
> system) is what the kernel internally calls a block. Since VOP_BMAP()
> deals with kernel things, a "fragment" is a block, so there is no problem.
So ufs_bmaparray() first sets "maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1"
which is "64k / 8k - 1 == 7" from example above. Then it computes "*runp" as
the number of 1k blocks (fragments) that are contiguous.
bsize = vnd->sc_vp->v_mount->mnt_stat.f_iosize;
error = VOP_BMAP(vnd->sc_vp, bn / bsize, &vp, &nbn, &nra);
sz = (1 + nra) * bsize;
This looks like it would run on "blocks" instead of "fragments".
Juergen Hannken-Illjes - email@example.com - TU Braunschweig (Germany)