• Damien Le Moal's avatar
    null_blk: cleanup discard handling · 49c7089f
    Damien Le Moal authored
    null_handle_discard() is called from both null_handle_rq() and
    null_handle_bio(). As these functions are only passed a nullb_cmd
    structure, this forces pointer dereferences to identiify the discard
    operation code and to access the sector range to be discarded.
    Simplify all this by changing the interface of the functions
    null_handle_discard() and null_handle_memory_backed() to pass along
    the operation code, operation start sector and number of sectors. With
    this change null_handle_discard() can be called directly from
    null_handle_memory_backed().
    
    Also add a message warning that the discard configuration attribute has
    no effect when memory backing is disabled.
    
    No functional change is introduced by this patch.
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    49c7089f
null_blk_main.c 48.6 KB