git: sys/dev/disk/dm: Fix dm-delay deps behavior for compatibility with Linux

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sat Oct 17 12:25:44 PDT 2015


commit 66fee7cc1080d3f2889ac6f6ea3e0eeeb15f2fec
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sun Oct 18 03:17:38 2015 +0900

    sys/dev/disk/dm: Fix dm-delay deps behavior for compatibility with Linux
    
    dmsetup(8)'s deps subcommand should not show two underlying
    devices for both read and write if those are the same devices.
    This is how Linux dm-delay behaves.
    
    Also note that DragonFly and NetBSD's deps implementation is
    inefficient in the sense that each target needs to implement
    deps ioctl. dm core should be able to tell dependencies without
    using target specific ioctl code. dm core in Linux kernel is
    implemented this way and this is better plus less error prone.
    
    ===== using the existing code
      # kldload dm
      # dmsetup create delay1 --table '0 1000 delay /dev/da3 0 10'
      # dmsetup deps /dev/mapper/delay1
      1 dependencies  : (0, 504430623)
      # dmsetup create delay2 --table '0 1000 delay /dev/da3 0 10 /dev/da3 0 10'
      # dmsetup deps /dev/mapper/delay2
      2 dependencies  : (0, 504430623) (0, 504430623)
      # dmsetup create delay3 --table '0 1000 delay /dev/da3 0 10 /dev/da4 0 10'
      # dmsetup deps /dev/mapper/delay3
      2 dependencies  : (0, 504430623) (0, 504430631)
    
    ===== using this commit, deps for delay2 differs
      # kldload dm
      # dmsetup create delay1 --table '0 1000 delay /dev/da3 0 10'
      # dmsetup deps /dev/mapper/delay1
      1 dependencies  : (0, 504430623)
      # dmsetup create delay2 --table '0 1000 delay /dev/da3 0 10 /dev/da3 0 10'
      # dmsetup deps /dev/mapper/delay2
      1 dependencies  : (0, 504430623)
      # dmsetup create delay3 --table '0 1000 delay /dev/da3 0 10 /dev/da4 0 10'
      # dmsetup deps /dev/mapper/delay3
      2 dependencies  : (0, 504430623) (0, 504430631)

Summary of changes:
 sys/dev/disk/dm/targets/delay/dm_target_delay.c | 33 ++++++++++++-------------
 1 file changed, 16 insertions(+), 17 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/66fee7cc1080d3f2889ac6f6ea3e0eeeb15f2fec


-- 
DragonFly BSD source repository



More information about the Commits mailing list