diff options
| author | Mikulas Patocka <mpatocka@redhat.com> | 2014-03-28 15:51:55 -0400 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2014-04-06 20:51:02 -0400 |
| commit | cd433c25f43eb054f62b7b48f1d0349f65b1740c (patch) | |
| tree | 5c0a658872d04ea61555abbaf3b8373012a16ea8 | |
| parent | 3e7d3e49af8f81e691eb982bb9dd20744b98cc77 (diff) | |
| download | linux-dm-cd433c25f43eb054f62b7b48f1d0349f65b1740c.tar.gz | |
block: use kmalloc alignment for bio slab
Notice: this object is not reachable from any branch.
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: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Jens Axboe <axboe@fb.com> # via private exchange on facebook
Notice: this object is not reachable from any branch.
| -rw-r--r-- | fs/bio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bio.c b/fs/bio.c index 8754e7b6eb493..371b6464914aa 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -112,7 +112,8 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) bslab = &bio_slabs[entry]; snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry); - slab = kmem_cache_create(bslab->name, sz, 0, SLAB_HWCACHE_ALIGN, NULL); + slab = kmem_cache_create(bslab->name, sz, ARCH_KMALLOC_MINALIGN, + SLAB_HWCACHE_ALIGN, NULL); if (!slab) goto out_unlock; |
