Subject: Re: Make VOP_STRATEGY a real VOP
To: None <tech-kern@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 01/19/2004 23:13:11
On Mon, Jan 19, 2004 at 01:42:34PM -0800, Greywolf wrote:
> Thus spake Juergen Hannken-Illjes ("JH> ") sometime Today...
> 
> JH> VOP_STRATEGY is no real VOP because it is missing a vnode as a first
> JH> argument. I propose to convert  VOP_STRATEGY(bp)  to two functions
> JH> VOP_STRATEGY(vp, bp)  and  DEV_STRATEGY(bp)  as follows:
> JH>
> JH>  VOP_STRATEGY(vp, bp) will run the strategy routine for the  vp  arg
> JH>  and the conversion is like  VOP_STRATEGY(bp) -> VOP_STRATEGY(bp->b_vp, bp).
> 
> Given that example, that makes no sense whatsoever.  Why send bp->b_vp
> when you can extract b_vp from bp?
> 
> On the other hand, if you are not always sending bp->b_vp along with bp,
> it makes much sense.
> 
> JH>  DEV_STRATEGY(bp) is used for block-to-block device situations and calls
> JH>  the d_strategy() routine from device bp->b_dev.
> JH>
> JH> With these changes applied, VOP_STRATEGY is no longer a special-case VOP
> JH> and spec_strategy() always gets the vnode of the block device to call.
> JH> This will make it more easy to put copy-on-write data into the specinfo
> JH> of the block device.
> JH>
> JH> Comments?
> 
> Is this merely a matter of semantics, then?  I suppose consistency is
> a laudable goal and will probably simplify things down the road.  It just
> never made sense to send an object and a subordinate of that same object
> as two separate parameters, since you can extract the sub from the object.

The file system xxx_strategy() functions call on the vnode of the block device
which is not the same as bp->b_vp. Like this:

		vp = ap->amp->devvp;
		bp->b_dev = vp->v_rdev;
	-       VOCALL(vp->v_op, VOFFSET(vop_strategy), sp);
	+       error = VOP_STRATEGY(vp, bp);

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)