Subject: RFC struct buf{} redesign
To: None <tech-kern@NetBSD.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 02/23/2007 14:40:56
--PmA2V3Z32TCmWXqI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Dear folks,

i've been fighting struct buf{} again and really the whole buf system needs 
a spanking... its uses are so diverse and its getting such a clutter IMHO. 
This time i was bitten by the fact that biodone() unlike physio() doesn't 
use a workqueue and gets called from interrupt context(!)

Would it be good to inventarise the uses of struct buf and come up with a 
more clean solution? I've seen it use for :
	- buffer cache, i.e. caching data
	- passing of data to device driver
	- using the B_CALL as initiator of new actions when one finishes 
	  (cgd f.e.)
	- splitting up a request using nestiobuf() (and B_CALL)
	- providing a vehicle to have multiple callbacks/contexts using 
	  nestiobuf's B_CALL
	- counting of pending actions
	- ....

I think its better to split the functions up:
	- buffering of metadata (also proven to work fine with UBC (see 
	  UDF))
	- passing of data to drivers (getiobuf() was initial start of this)
	- nested buffer for splitting up a request.
	- all finished bufs ought to called back on a kthread (workqueue 
	  like in physio())
	- call back queueing, a TAILQ() of functions with private data 
	  pointer? with an abort function to prevent further calling?
	- adding of pending/finished callbacks counters? (clustering of 
	  reads/writes)
	- .....

Implementing changes to struct buf{} is indeed difficult due to the many, 
many uses but the current situation gets more and more out-of-control.

With regards,
Reinoud


--PmA2V3Z32TCmWXqI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRd7u2IKcNwBDyKpoAQI+oAf/b0w8wE7onaG2k5erztfVaojd0M03xiTI
X9cmRLpknWAHOpXvo+XJUDEGWpO3rE1KpJj6bU1KUzUuiWFBqG0B34LTjVS7EQeT
H0MeOVkPHpjFLm0a4AZYmSJc1OImMRSUpcAc2sbcLRIfOeWqcY7CbQx3QPPVx50l
YNKp+utrxmdFdTS4LqEvZCckzQYcLuPnxiftaNDrK7Ex+egXGNyQ1GYPYRJIe72h
Jjuu24kwu0ANspg156TMRDcfX/WT94AWejMsMaH++rwum7eyhVY04OisAUg+DZu0
C2dmEkn7wP3snICYVp5RVGmHUjI5Ws5WI2hbvrIWXJzUZdEIl+WqIQ==
=YB8p
-----END PGP SIGNATURE-----

--PmA2V3Z32TCmWXqI--