Subject: strategy() question
To: None <tech-kern@netbsd.org>
From: Stephan Uphoff <ups@stups.com>
List: tech-kern
Date: 08/10/2003 17:02:00
Hi,

Recently when Greg Lehey posted his netbsd Vinum patch I send
him an email that a disk strategy function should not be called
from a buffer callback (b_biodone) function.

Apparently I was "mostly" wrong as most block device drivers 
in NetBSD can be called from interrupt context.

This is great and can speed up storage stacks ( software raid ..)
file systems ( meta data write order).  
  
A certain kind of callback safe strategy seems to even be required.
However there are some inconsistencies that confuse me:

The implementation of swapping to regular (local) files (sw_reg_start 
,sw_reg_iodone)  requires that the driver's strategy function must at
least be callable when the same device is calling biodone() .
   (sw_reg_iodone() is called from biodone() .
    sw_reg_iodone() calls sw_reg_start()
    sw_reg_start() calls the file's VOP_STRATEGY() )
 
The following methods can be used to meet this requirement
	- Implement strategy in an interrupt safe way (sd,wd,...)
	- Call biodone() outside of an interrupt by using for
          example a worker thread (raidframe?)

Is this correct and intended ?

The vnd driver for example would not meet the requirement.

Using ccd or vinum on a mix of block devices that include
interrupt safe and non interrupt safe strategy routine implementations
would not meet the requirement.

Any help appreciated.

Thanks
	Stephan