lkml.org 
[lkml]   [2008]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [5/7] Convert the blk allocator functions over to the mask allocator
Date

This is a separate patch because the block allocator functions are
only getting introduced by my earlier SCSI DMA cleanup patch kit.
This means this patch alone relies on them. Without that patchkit
applied earlier it can be safely dropped.

Right now blk_kmalloc rounds up to pages. There are only a few callers
so adding a sub allocator for that doesn't seem worthwhile.

Signed-off-by: Andi Kleen <ak@suse.de>

---
block/blk-settings.c | 7 +++++--
include/linux/blkdev.h | 4 ++--
2 files changed, 7 insertions(+), 4 deletions(-)

Index: linux/include/linux/blkdev.h
===================================================================
--- linux.orig/include/linux/blkdev.h
+++ linux/include/linux/blkdev.h
@@ -560,12 +560,12 @@ extern struct page *blk_alloc_pages(stru
extern void *blk_kmalloc(struct request_queue *q, unsigned size, gfp_t gfp);
static inline void blk_free_pages(struct page *p, int size)
{
- __free_pages(p, get_order(size));
+ __free_pages_mask(p, size);
}

static inline void blk_kfree(void *p, int size)
{
- kfree(p);
+ free_pages_mask(p, size);
}

struct req_iterator {
Index: linux/block/blk-settings.c
===================================================================
--- linux.orig/block/blk-settings.c
+++ linux/block/blk-settings.c
@@ -159,13 +159,16 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
struct page *blk_alloc_pages(struct request_queue *q,
gfp_t gfp, int size)
{
- return alloc_pages((q->bounce_gfp & ~GFP_NOIO) | gfp, get_order(size));
+ return alloc_pages_mask(gfp, size, blk_q_mask(q));
}
EXPORT_SYMBOL(blk_alloc_pages);

void *blk_kmalloc(struct request_queue *q, unsigned size, gfp_t gfp)
{
- return kmalloc(size, gfp | (q->bounce_gfp & ~GFP_NOIO));
+ /* Right now gets pages. That is ok for the few callers. Later
+ * might need to use a sub allocator.
+ */
+ return get_pages_mask(gfp, size, blk_q_mask(q));
}
EXPORT_SYMBOL(blk_kmalloc);


\
 
 \ /
  Last update: 2008-03-07 10:25    [W:0.066 / U:2.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site