Skip to content
  • Lukas Czerner's avatar
    blkdev: Do not return -EOPNOTSUPP if discard is supported · 8af1954d
    Lukas Czerner authored
    
    
    Currently we return -EOPNOTSUPP in blkdev_issue_discard() if any of the
    bio fails due to underlying device not supporting discard request.
    However, if the device is for example dm device composed of devices
    which some of them support discard and some of them does not, it is ok
    for some bios to fail with EOPNOTSUPP, but it does not mean that discard
    is not supported at all.
    
    This commit removes the check for bios failed with EOPNOTSUPP and change
    blkdev_issue_discard() to return operation not supported if and only if
    the device does not actually supports it, not just part of the device as
    some bios might indicate.
    
    This change also fixes problem with BLKDISCARD ioctl() which now works
    correctly on such dm devices.
    
    Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
    CC: Jens Axboe <jaxboe@fusionio.com>
    CC: Jeff Moyer <jmoyer@redhat.com>
    Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
    8af1954d