|
& |
|
NetBSD-SoC: Write and improve LVM driver
What is it?
Logical Volume Manager LVM is a method of allocating space on mass storage devices like disks. LVM
is more flexible than standard partitioning schemes. NetBSD uses device-mapper compatible driver
to get Linux libdevmapper and lvm2tools working.
Status
NetBSD device-mapper driver implementation
device-mapper devices - devs dm_dev.c
This entity is created with DM_DEV_CREATE ioctl, and stores info
about every device in device mapper driver. It has two slots for
active and inactive table, list of active physical devices added
to this device and list of upcalled devices (for targets which use
more than one physical device e.g. mirror, snapshot etc..).
device-mapper physical devices - pdevs dm_pdev.c
This structure contains opened device VNODES. Because I physical
device can be found in more than one table loaded to different
dm devices. When device is destroyed I decrement all reference
counters for all added pdevs (I remove pdevs with ref_cnt == 0).
device-mapper tables - table dm_table.c, dm_ioctl.c
Table describe how is dm device made. What blocks are mapped with
what target. In our implementation every table contains pointer to
target specific config data. These config_data are allocated in
DM_TABLE_LOAD function with target_init routine. Every table
contains pointer to used target.
device-mapper targets - target dm_target.c
Target describes mapping of logical blocks to physical. It has
function pointers to function which does init, strategy, destroy,
upcall functions.
P.S I want to thank reinod@ for great help and guidance :).
- _April 21, 2008: Community Bonding Period -- Students get to know mentors, read documentation, get up to speed to begin working on their projects.
- April 21, 2008Design Period start write, discuss design of new libdevmapper - kernel communication
protocol.
- May 26, 2008: Students begin coding for their GSoC projects; Google begins issuing initial student payments
- July 7, 2008: Mentors and students can begin submitting mid-term evaluations.
- July 14, 2008: Mid-term evaluation deadline; Google begins issuing mid-term student payments provided passing student survey is on file.
- August 11, 2008: Suggested 'pencils down' date. Take a week to scrub code, write tests, improve documentation, etc.
- August 18, 2008: Firm 'pencils down' date. Mentors, students
and organization administrators can begin submitting final evaluations to
Google.
- September 1, 2008: Final evaluation deadline; Google begins issuing student and mentoring organization payments provided forms and evaluations are on file.
Deliverables
Mandatory (must-have) components:
- design NetBSD kernel interface for LVM
- implement the kernel interface
- modify libdevmapper, dmsetup to use new interface
Optional (would-be-nice) components:
- demonstrate original Linux tools working with new libdevmapper
- configure linear LVM partition
Documentation
Device-mapper to libdevmapper protocol
- 1) Device mapper device in a POV of LVM it is an Logical Volume.
Logical Volume is virtual block device is made from logical blocks.
These blocks are mapped to real device blocks with algorithm called
target.
Functions available to dm device:
create, remove, list, status of device.
-
2) device mapper target is function which defines how are Logical blocks
mapped to physical. There are many targets linear, stripe, mirror etc.
Functions available to dm device:
list available targets. They can be added with module in linux.
-
3) dm table.
Every device-mapper device consits from one or more tables. Table specify
Start, length of logical blocks and target which is used to map them to
physical blocks.
{start} {length} {target} | {device} {target parameters}
after | are target specific parameters listed.
Functions available to dm device:
load, unload, table_status.
List of available ioct calls
DM_VERSION
DM_REMOVE_ALL
DM_LIST_DEVICES
DM_DEV_CREATE
DM_DEV_REMOVE
DM_DEV_RENAME
DM_DEV_SUSPEND
DM_DEV_STATUS
DM_DEV_WAIT
DM_TABLE_LOAD
DM_TABLE_CLEAR
DM_TABLE_DEPS
DM_TABLE_STATUS
DM_LIST_VERSIONS
DM_TARGET_MSG
DM_DEV_SET_GEOMETRY
- DM_VERSION
in: struct dm-ioctl
out: struct dm-ioctl
Fuction:
sends libdevmapper ioctl protocol version to kernel and ask for kernel version.
If major and minor numbers are good we can continue.
-
DM_REMOVE_ALL
in: none
out: none
Function:
This ioctl will remove all DM devices/tables from DM driver.
-
DM_LIST_DEVICES
in: none
out: List of structures describing all devices created in driver.
Function:
List all devices created in driver. (linux use struct dm_name_list)
Implementation:
Kernel driver will place list of struct dm_name_list behind
struct dm_ioctl in userspace. Kernel driver will list through
the all devices and copyout info about them.
-
DM_DEV_CREATE
in: struct dm-ioctl(name/uuid)
out: none
Function:
Create device in dm driver, with specified name/uuid(uuid is prefered).
(linux use struct dm_name_list)
-
DM_DEV_REMOVE
in: struct dm-ioctl(name/uuid)
out: none
Function:
Remove device from dm driver list, also remove device tables.
-
DM_DEV_RENAME
in: struct dm-ioctl(name/uuid) and string found after dm-ioctl struct in buffer
out: none
Function:
Rename device from name to string.
Implementation:
Kernel driver will find device with name from struct dm_ioctl-name/uuid.
Change name of selected device to string foun behind struc dm_ioctl header
in userspace buffer.
-
DM_DEV_SUSPEND
in: dm-ioctl(name/uuid)
out: none
Function:
Suspend all io's on device, after this ioctl. Already started io's will be done.
Newer can't be started.
-
DM_DEV_STATUS
in: dm-ioctl(name/uuid)
out: dm-ioctl (minor,open_count,target_count)
Function:
Return status info about selected device
Implementation:
Kernel driver will find device with name from struct dm_ioctl-name/uuid.
Change values minor,open_count,target_count in dm_ioctl struct for
selected device.
-
DM_DEV_WAIT
in: dm-ioctl(name/uuid)
out: none
Function:
Wait for device event to happen.
-
DM_TABLE_LOAD
in: dm-ioctl(name/uuid),table specification
out: none
Function:
Load table to selected device. Table is loaded to unused slot and than switched.
(linux use struct dm_target_spec)
Implementation:
Kernel driver will find device with name from struct dm_ioctl-name/uuid.
Table is added to the inactive slot. Every device can have more than one
table loaded. Tables are stored in SLIST. This ioctl also open physical
device spedcified in table and add it to dm_device specific pdev list.
-
DM_TABLE_CLEAR
in: dm-ioctl(name/uuid)
out: none
Function:
Remove table from unused slot.
-
DM_TABLE_DEPS
in: dm-ioctl(name/uuid)
out: list of dependiences devices
Function:
Return set of device dependiences e.g. mirror device for mirror target etc..
-
DM_TABLE_STATUS
in: dm-ioctl(name/uuid)
out: list of used tables from selected devices (linux use struct dm_target_spec)
Function:
List all tables in active slot in device with name name/uuid.
Implementation:
Kernel driver will find device with name from struct dm_ioctl-name/uuid.
DM driver will copyout dm_target_spec structures behidn struct dm_ioctl.
-
DM_LIST_VERSIONS
in: none
out: list of all targets in device-mapper driver (linux use struct dm_target_versions)
Function:
List all available targets to libdevmapper.
Implementation:
Technical Details
I have written design document about new interface for NetBSD device-mapper kernel driver. File is here. Interface is uses NetBSD proplib library.
Development
For development I use Monotone RCS system. I have created public accessible monotone
database at address. But I will commit important
changes to sourceforge cvs server, too. I set up viewmtn server to view monotone db
with web browser at http://147.175.97.81:8080.
Status
I have created blog about my Soc project development. Blog is located at address. I will do my best to keep
this blog updated.
|
Adam Hamsik <haaaad@gmail.com> |
$Id: index.html,v 1.8 2008/07/09 13:44:18 haad Exp $ |
|