• Mikulas Patocka's avatar
    block: use kmalloc alignment for bio slab · 6a241483
    Mikulas Patocka authored
    Various subsystems can ask the bio subsystem to create a bio slab cache
    with some free space before the bio.  This free space can be used for any
    purpose.  Device mapper uses this per-bio-data feature to place some
    target-specific and device-mapper specific data before the bio, so that
    the target-specific data doesn't have to be allocated separately.
    
    This per-bio-data mechanism is used in place of kmalloc, so we need the
    allocated slab to have the same memory alignment as memory allocated
    with kmalloc.
    
    Change bio_find_or_create_slab() so that it uses ARCH_KMALLOC_MINALIGN
    alignment when creating the slab cache.  This is needed so that dm-crypt
    can use per-bio-data for encryption - the crypto subsystem assumes this
    data will have the same alignment as kmalloc'ed memory.
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Acked-by: default avatarJens Axboe <axboe@fb.com>
    6a241483
bio.c 49.6 KB