[NetBSD logo]    &    [Google logo]

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 :).

Deliverables

Mandatory (must-have) components:

Optional (would-be-nice) components:

Documentation

Device-mapper to libdevmapper protocol

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
  1. 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.
  2. DM_REMOVE_ALL
    in: none
    out: none
    Function: This ioctl will remove all DM devices/tables from DM driver.
  3. 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.
  4. 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)
  5. DM_DEV_REMOVE
    in: struct dm-ioctl(name/uuid)
    out: none
    Function: Remove device from dm driver list, also remove device tables.
  6. 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.
  7. 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.
  8. 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.
  9. DM_DEV_WAIT
    in: dm-ioctl(name/uuid)
    out: none
    Function: Wait for device event to happen.
  10. 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.
  11. DM_TABLE_CLEAR
    in: dm-ioctl(name/uuid)
    out: none
    Function: Remove table from unused slot.
  12. 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..
  13. 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.
  14. 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:
    1. 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.


      SourceForge.net Logo
      Adam Hamsik <haaaad@gmail.com>
      $Id: index.html,v 1.8 2008/07/09 13:44:18 haad Exp $