• Tomasz Majchrzak's avatar
    md: add bad block support for external metadata · 35b785f7
    Tomasz Majchrzak authored
    Add new rdev flag which external metadata handler can use to switch
    on/off bad block support. If new bad block is encountered, notify it via
    rdev 'unacknowledged_bad_blocks' sysfs file. If bad block has been
    cleared, notify update to rdev 'bad_blocks' sysfs file.
    
    When bad blocks support is being removed, just clear rdev flag. It is
    not necessary to reset badblocks->shift field. If there are bad blocks
    cleared or added at the same time, it is ok for those changes to be
    applied to the structure. The array is in blocked state and the drive
    which cannot handle bad blocks any more will be removed from the array
    before it is unlocked.
    
    Simplify state_show function by adding a separator at the end of each
    string and overwrite last separator with new line.
    Signed-off-by: default avatarTomasz Majchrzak <tomasz.majchrzak@intel.com>
    Reviewed-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
    Signed-off-by: default avatarShaohua Li <shli@fb.com>
    35b785f7
md.c 233 KB