From: Michael Clark <michael@metaparadigm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>, Jens Axboe <axboe@suse.de>
Subject: Re: userspace block driver?
Date: Wed, 16 Nov 2005 11:13:46 +0800 [thread overview]
Message-ID: <437AA3EA.4030405@metaparadigm.com> (raw)
In-Reply-To: <4371A4ED.9020800@pobox.com>
Jeff Garzik wrote:
>
> Has anybody put any thought towards how a userspace block driver would
> work?
>
> Consider a block device implemented via an SSL network connection. I
> don't want to put SSL in the kernel, which means the only other
> alternative is to pass data to/from a userspace daemon.
>
> Anybody have any favorite methods? [similar to] mmap'd packet socket?
> ramfs?
Here is a user block device i've been using for my own userspace block
device drivers for some years now:
http://gort.metaparadigm.com/userblk/
This code is 2.6 based. 2.6 has made it much more reliable to do this
due to the separation of writeback into the 'pdflush' thread lessening
the likely hood of deadlocks. I've had very good results with this code
under quite heavy memory pressure (you need a carefully written
userspace which mlocks itself into memory and avoids doing certain things).
I wrote it because the nbd and enbd implementations didn't provide a
nice and/or simple interface for a local userspace daemon.
enbd was closer to what I needed but when I looked at it I thought it's
blocking on a ioctl was an ugly design - plus it was overcomplicated
with enbd specific features.
I chose to use a kernel <-> user comms model based on Alan Cox's psdev
with a char device using read and write and a mmap area for the block
request data (potentially allowing me to implement zero copy in the
future by mapping the bio into the user address space).
It is named 'ub' as it was written way before the USB driver although as
I hadn't published my work no one was aware of this. I should come up
with a new name. Perhaps 'bdu'?
I'm actually using the code in a production environment on a lab of 25
linux machines with a hybrid network block device / local disk caching
implementation in userspace (to make netboot less disk intensive -
similar to how Apple's netboot system work's). The userspace
implementation also does local COW onto disk (to avoid the need for a
stateless readonly type linux system which is hard to achieve). I have
source for this available if anyone is interested. The link above only
contains a simple userspace example implementation.
The 'metaboot' system which uses 'ub' does a lot of smart things such as
'commit' and 'rollback' of block deltas and has a cache coherency
protocol to only invalidate changed blocks on clients local caches so I
can upgrade a bunch of quasi netboot/cache machines with minimal network
traffic (much more scalable then normal fatclient netbooting).
I can put up a webpage with links to CVS, etc it anyone is interested.
~mc
prev parent reply other threads:[~2005-11-16 3:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-09 7:27 userspace block driver? Jeff Garzik
2005-11-09 7:37 ` Neil Brown
2005-11-09 7:46 ` Jeff Garzik
2005-11-09 7:54 ` Jens Axboe
2005-11-09 8:01 ` Jeff Garzik
2005-11-09 12:42 ` Paulo Marques
2005-11-09 12:54 ` Miklos Szeredi
2005-11-09 14:04 ` Miklos Szeredi
2005-11-11 0:12 ` Andrew Morton
2005-11-11 5:59 ` Miklos Szeredi
2005-11-09 10:12 ` Lars Marowsky-Bree
2005-11-09 7:50 ` Chris Wright
2005-11-09 7:55 ` Oliver Neukum
2005-11-09 8:37 ` Avi Kivity
2005-11-09 13:32 ` Jonathan Corbet
2005-11-09 20:56 ` Guennadi Liakhovetski
2005-11-12 23:42 ` Guennadi Liakhovetski
2005-11-10 13:13 ` Pavel Machek
2005-11-16 3:13 ` Michael Clark [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=437AA3EA.4030405@metaparadigm.com \
--to=michael@metaparadigm.com \
--cc=axboe@suse.de \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox