]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/md/bcache/util.h
treewide: use kv[mz]alloc* rather than opencoded variants
[mirror_ubuntu-artful-kernel.git] / drivers / md / bcache / util.h
index 5d13930f0f22fc42e40228cee8eee1ecb7cfa8e5..cb8d2ccbb6c6e7223aa0f806d45546c56421de7e 100644 (file)
@@ -43,11 +43,7 @@ struct closure;
        (heap)->used = 0;                                               \
        (heap)->size = (_size);                                         \
        _bytes = (heap)->size * sizeof(*(heap)->data);                  \
-       (heap)->data = NULL;                                            \
-       if (_bytes < KMALLOC_MAX_SIZE)                                  \
-               (heap)->data = kmalloc(_bytes, (gfp));                  \
-       if ((!(heap)->data) && ((gfp) & GFP_KERNEL))                    \
-               (heap)->data = vmalloc(_bytes);                         \
+       (heap)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL);            \
        (heap)->data;                                                   \
 })
 
@@ -136,12 +132,8 @@ do {                                                                       \
                                                                        \
        (fifo)->mask = _allocated_size - 1;                             \
        (fifo)->front = (fifo)->back = 0;                               \
-       (fifo)->data = NULL;                                            \
                                                                        \
-       if (_bytes < KMALLOC_MAX_SIZE)                                  \
-               (fifo)->data = kmalloc(_bytes, (gfp));                  \
-       if ((!(fifo)->data) && ((gfp) & GFP_KERNEL))                    \
-               (fifo)->data = vmalloc(_bytes);                         \
+       (fifo)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL);            \
        (fifo)->data;                                                   \
 })