]>
Commit | Line | Data |
---|---|---|
0a2e4279 ŁK |
1 | bio: use kmalloc alignment for bio slab |
2 | ||
3 | Various subsystems can ask the bio subsystem to create a bio slab cache | |
4 | with some free space before the bio. This free space can be used for any | |
5 | purpose. Device mapper uses this feature to place some target-specific and | |
6 | device-mapper specific data before the bio, so that the target-specific | |
7 | data doesn't have to be allocated separatedly. | |
8 | ||
9 | This mechanism is used in place of kmalloc, so we need that the allocated | |
10 | slab have the same memory alignment as memory allocated with kmalloc. | |
11 | ||
12 | This patch changes the function bio_find_or_create_slab so that it uses | |
13 | ARCH_KMALLOC_MINALIGN alignment when creating the slab cache. This patch | |
14 | is needed so that dm-crypt can use per-bio data for encryption - the | |
15 | crypto subsystem assumes that these data have the same alignment as | |
16 | kmallocated memory. | |
17 | ||
18 | Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> | |
19 | ||
20 | --- | |
21 | fs/bio.c | 3 ++- | |
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
23 | ||
24 | Index: linux-3.14-rc3/fs/bio.c | |
25 | =================================================================== | |
26 | --- linux-3.14-rc3.orig/fs/bio.c 2014-02-23 23:53:50.000000000 +0100 | |
27 | +++ linux-3.14-rc3/fs/bio.c 2014-02-23 23:55:00.000000000 +0100 | |
28 | @@ -112,7 +112,8 @@ static struct kmem_cache *bio_find_or_cr | |
29 | bslab = &bio_slabs[entry]; | |
30 | ||
31 | snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry); | |
32 | - slab = kmem_cache_create(bslab->name, sz, 0, SLAB_HWCACHE_ALIGN, NULL); | |
33 | + slab = kmem_cache_create(bslab->name, sz, ARCH_KMALLOC_MINALIGN, | |
34 | + SLAB_HWCACHE_ALIGN, NULL); | |
35 | if (!slab) | |
36 | goto out_unlock; | |
37 |