• Lukas Czerner's avatar
    xfs: check if device support discard in xfs_ioc_trim() · be715140
    Lukas Czerner authored
    Right now we, are relying on the fact that when we attempt to
    actually do the discard, blkdev_issue_discar() returns -EOPNOTSUPP
    and the user is informed that the device does not support discard.
    
    However, in the case where the we do not hit any suitable free
    extent to trim in FITRIM code, it will finish without any error.
    This is very confusing, because it seems that FITRIM was successful
    even though the device does not actually supports discard.
    
    Solution: Check for the discard support before attempt to search for
    free extents.
    Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
    Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    be715140
xfs_discard.c 5.18 KB