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

levin li levin108 at gmail.com
Wed Jan 23 08:56:24 CET 2013


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

v3 -- > v4:

1. Refactor the code in proc.c and device.c
2. Split the big patch into some small patches
3. Fixed coding style to pass checkpatch.pl check

v2 -- > v3:

1. Make it Ok for QEMU to run VDIs from the driver
2. Code refactor
3. Use the format 'del vdiname:snap_tag[snap_id]' to delete a device

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 linux" > /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 (8):
  sheep: modify sheepdog_proto.h to make it usable in linux kernel
    module
  sheepdev: use proc entry to control adding/removing devices
  sheepdev: add connect.c for network operations
  sheepdev: add sheep.c to process the sheepdog protocol
  sheepdev: make it possible to add or remove a sheep device
  sheepdev: create kernel threads to process the IO request in the
    driver
  sheepdev: make it safe to open a snapshot VDI
  sheepdev: add Makefile.in and modify configure.ac to adopt sheepdev

 Makefile.am              |   4 +
 configure.ac             |   9 +
 include/sheepdog_proto.h |  11 +-
 sheepdev/Kbuild          |  13 +
 sheepdev/connect.c       | 178 +++++++++
 sheepdev/device.c        | 996 +++++++++++++++++++++++++++++++++++++++++++++++
 sheepdev/proc.c          | 148 +++++++
 sheepdev/sheep.c         | 246 ++++++++++++
 sheepdev/sheepdev.h      | 138 +++++++
 9 files changed, 1740 insertions(+), 3 deletions(-)
 create mode 100644 sheepdev/Kbuild
 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/sheepdev.h

-- 
1.7.11.7




More information about the sheepdog mailing list