vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| re this switches vnd to use pool for it's buffer structures. in particular it might be a bit faster as well as safe in the interrupt context (vndiodone()). please test in both vnd and svnd modes and report results. 10x cu -- paranoic mickey (my employers have changed but, the name has remained) Index: vnd.c ================================================== ================= RCS file: /cvs/src/sys/dev/vnd.c,v retrieving revision 1.53 diff -u -r1.53 vnd.c --- vnd.c 5 Jan 2005 06:38:15 -0000 1.53 +++ vnd.c 30 Mar 2005 22:10:17 -0000 @@ -67,6 +67,7 @@ #include <sys/errno.h> #include <sys/buf.h> #include <sys/malloc.h> +#include <sys/pool.h> #include <sys/ioctl.h> #include <sys/disklabel.h> #include <sys/device.h> @@ -111,10 +112,13 @@ struct buf *vb_obp; }; -#define getvndbuf() \ - ((struct vndbuf *)malloc(sizeof(struct vndbuf), M_DEVBUF, M_WAITOK)) -#define putvndbuf(vbp) \ - free((caddr_t)(vbp), M_DEVBUF) +/* + * struct vndbuf allocator + */ +struct pool vndbufpl; + +#define getvndbuf() pool_get(&vndbufpl, PR_WAITOK) +#define putvndbuf(vbp) pool_put(&vndbufpl, vbp); struct vnd_softc { struct device sc_dev; @@ -205,6 +209,10 @@ bzero(mem, size); vnd_softc = (struct vnd_softc *)mem; numvnd = num; + + pool_init(&vndbufpl, sizeof(struct vndbuf), 0, 0, 0, "vndbufpl", NULL); + pool_setlowat(&vndbufpl, 16); + pool_sethiwat(&vndbufpl, 1024); } int |