• Mike Snitzer's avatar
    dm: pass NULL bdev to bio_alloc_clone · ca522482
    Mike Snitzer authored
    Most DM targets will remap the clone bio passed to their ->map
    function using bio_set_bdev(). So this change to pass NULL bdev to
    bio_alloc_clone avoids clone-time work that sets up resources for a
    bdev association that will not be used in practice (e.g. clone issued
    to underlying device will not use DM device's blk-cgroups resources).
    
    But clone->bi_bdev is still initialized following bio_alloc_clone to
    preserve DM target expectations that clone->bi_bdev will be set.
    Follow-up work is needed to audit DM targets to remove accesses to a
    clone->bi_bdev that the target didn't initialize with bio_set_dev().
    
    Depends-on: 7ecc56c6 ("block: allow passing a NULL bdev to bio_alloc_clone/bio_init_clone")
    Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
    ca522482
dm.c 75.4 KB