[sheepdog] [PATCH v2 0/4] sheepdev: linux kernel module of block device driver for sheepdog

levin li levin108 at gmail.com
Mon Jan 7 07:42:44 CET 2013


From: levin li <xingke.lwp at taobao.com>

v1 -- > v2:

1. Rename module.c to device.c
2. Split proc operations from device.c to proc.c
3. Remove sheepdog_proto.h from sheepdev, use the one in include directory
4. Supprt write snapshot VDI
5. Kill the compile error in linux kernel 3.7
6. Modify some functions's name

---------------------------------------------------------------------
This module provides function for users to take sheepdog VDIs as block
devices in linux, users can register a VDI to its kernel space, it just
like that a new hard disk is added to the computer, users can create
partitions for the disk, format the disk or mount the disk, it provides
users a efficient way to use sheepdog as distributed storage system.

The usage is easy, after install the module sheepdev.ko, it creates a proc
entry '/proc/entry', you can write into the proc entry file to control
the driver.

Add a new block device from an existing sheepdog VDI:

# echo "add 127.0.0.1:7070 linux" > /proc/sheep

Or we can use default port 7000:

# echo "add 127.0.0.1 linux" > /proc/sheep

It would create a block device /dev/sheepa, you can format/mount this device:

# mkfs.ext4 /dev/sheepa
# mount -t ext4 /sheep/sheepa test

Remove a block device from the kernel:

# echo "del sheepa" > /proc/sheep

It can also add a new device from a snapshot VDI, in witch case sheepdev
creates a new writable VDI from the snapshot

# echo "add 127.0.0.1:7070 linux:1" > /proc/sheep

Here linux:1 means the VDI with name 'linux' and snapshot id '1'

or 

# echo "add 127.0.0.1:7070 linux:snap" > /proc/sheep

Here linux:snap means the VDI with name 'linux' and snapshot tag 'snap'

If we don't specify snapshot id or snapshot tag, it means to use the
current VDI.

levin li (4):
  sheep: modify sheepdog_proto.h to make it usable in linux kernel
    module
  sheepdev: linux kernel module of block device driver for sheepdog
  sheepdev: make it safe to open a snapshot VDI
  sheepdev: add kbuild and Makefile.in

 Makefile.am              |    4 +
 configure.ac             |    9 +
 include/sheepdog_proto.h |   11 +-
 sheepdev/Kbuild          |   13 +
 sheepdev/Makefile.in     |    8 +
 sheepdev/connect.c       |  178 +++++++++++
 sheepdev/device.c        |  774 ++++++++++++++++++++++++++++++++++++++++++++++
 sheepdev/proc.c          |  158 ++++++++++
 sheepdev/sheep.c         |  235 ++++++++++++++
 sheepdev/sheep.h         |  119 +++++++
 10 files changed, 1506 insertions(+), 3 deletions(-)
 create mode 100644 sheepdev/Kbuild
 create mode 100644 sheepdev/Makefile.in
 create mode 100644 sheepdev/connect.c
 create mode 100644 sheepdev/device.c
 create mode 100644 sheepdev/proc.c
 create mode 100644 sheepdev/sheep.c
 create mode 100644 sheepdev/sheep.h




More information about the sheepdog mailing list