[sheepdog] [PATCH v3 0/9] Introduce Sheepdog Block Device (SBD)

Liu Yuan namei.unix at gmail.com
Mon May 26 07:18:33 CEST 2014


v3:
 - kill SPINLOCK macro hack by not using 'gnu99'  
 - make this module compile with 2.6.32 series kernel (centos 6)

v2:
 - enhance memory allocation when near out of memory of system
 - add slab allocator
 - use vmalloc for aiocb->buf to avoid memory allocation failure

This is similar to Ceph's RBD. The main motivation is to replace complex
and ineffecient middle ware (such as iscsi softwafe) with simple software stacks
to expose sheepdog storage as Linux block device interface, which means that we
can make use of page cache as a client cache for buffered read/write optionally
and behaves as a normal Linux block device(s) in your local file system.

I implement a high performance(hopefully) aio framework for sending/recving data
and compared with iscsi tgt or sheepfs, this kernel module should provide much
better performance because of shortest code path.

With single major allocation scheme, we support 31 partitions for a sheep block
device at most and 32768 devices can be attached to local fs for a single node.

TODO
- support cloned sheep vdi
- auto-reconncect to sheep daemon if connection is off/crashed
- better error handling
- block device multi-queue support for recent kernel
- live snapshot of sbd
- support hyper volume

You can access this patch set at origin/sbd.
 $ git pull;
 $ git checkout -b sbd origin/sbd

To complile:
 $ cd shepdog/sbd/;make
 $ insmod sbd.ko

Usage:

We control the device the same way as RBD.

# associate vdi 'test' to /dev/sbd0
$ echo 127.0.0.1 7000 test > /sys/bus/sbd/add

# remove the device sbd0
$ echo 0 > /sys/bus/sbd/remove

# list the mapped devices
$ cat /sys/buf/sbd/list

To get best of performance,

# echo 4096 > /sys/block/sbd0/queue/max_sectors_kb

Which means io scheduler will try its best to handle us 4MB request.
Liu Yuan (9):
  sheep: some macro preparation for sbd kernem modual
  sbd: introduce basic framework for Sheepdog Block Device
  sbd: implement write operation
  sbd: implement read operation
  sbd: add list interface to control file
  sbd: add support for single major allocation scheme
  sbd: some error handling refinements
  sbd: improve memory allocation when memory hit low
  sbd: use kmem_cache for sheep aiocb and request

 include/sheepdog_proto.h |  22 +-
 sbd/Kbuild               |   5 +
 sbd/Makefile             |   8 +
 sbd/sbd.h                | 143 ++++++++++
 sbd/sheep.c              | 680 +++++++++++++++++++++++++++++++++++++++++++++++
 sbd/sheep_block_device.c | 424 +++++++++++++++++++++++++++++
 6 files changed, 1275 insertions(+), 7 deletions(-)
 create mode 100644 sbd/Kbuild
 create mode 100644 sbd/Makefile
 create mode 100644 sbd/sbd.h
 create mode 100644 sbd/sheep.c
 create mode 100644 sbd/sheep_block_device.c

-- 
1.8.1.2




More information about the sheepdog mailing list