aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorGanesh Mahendran <opensource.ganesh@gmail.com>2015-02-12 18:00:51 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 21:54:12 -0500
commit3eba0c6a56c04f2b017b43641a821f1ebfb7fb4c (patch)
treeae8732c7012ccee1573769e2a686eb98df173bca /drivers/block
parentee98016010ae036a5b27300d83bd99ef3fd5776e (diff)
mm/zpool: add name argument to create zpool
Currently the underlay of zpool: zsmalloc/zbud, do not know who creates them. There is not a method to let zsmalloc/zbud find which caller they belong to. Now we want to add statistics collection in zsmalloc. We need to name the debugfs dir for each pool created. The way suggested by Minchan Kim is to use a name passed by caller(such as zram) to create the zsmalloc pool. /sys/kernel/debug/zsmalloc/zram0 This patch adds an argument `name' to zs_create_pool() and other related functions. Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Seth Jennings <sjennings@variantweb.net> Cc: Nitin Gupta <ngupta@vflare.org> Cc: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/zram/zram_drv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index eca4b67274c1..8e233edd7a09 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -327,9 +327,10 @@ static void zram_meta_free(struct zram_meta *meta, u64 disksize)
327 kfree(meta); 327 kfree(meta);
328} 328}
329 329
330static struct zram_meta *zram_meta_alloc(u64 disksize) 330static struct zram_meta *zram_meta_alloc(int device_id, u64 disksize)
331{ 331{
332 size_t num_pages; 332 size_t num_pages;
333 char pool_name[8];
333 struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL); 334 struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
334 335
335 if (!meta) 336 if (!meta)
@@ -342,7 +343,8 @@ static struct zram_meta *zram_meta_alloc(u64 disksize)
342 goto out_error; 343 goto out_error;
343 } 344 }
344 345
345 meta->mem_pool = zs_create_pool(GFP_NOIO | __GFP_HIGHMEM); 346 snprintf(pool_name, sizeof(pool_name), "zram%d", device_id);
347 meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM);
346 if (!meta->mem_pool) { 348 if (!meta->mem_pool) {
347 pr_err("Error creating memory pool\n"); 349 pr_err("Error creating memory pool\n");
348 goto out_error; 350 goto out_error;
@@ -783,7 +785,7 @@ static ssize_t disksize_store(struct device *dev,
783 return -EINVAL; 785 return -EINVAL;
784 786
785 disksize = PAGE_ALIGN(disksize); 787 disksize = PAGE_ALIGN(disksize);
786 meta = zram_meta_alloc(disksize); 788 meta = zram_meta_alloc(zram->disk->first_minor, disksize);
787 if (!meta) 789 if (!meta)
788 return -ENOMEM; 790 return -ENOMEM;
789 791