aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2015-06-25 18:00:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 20:00:36 -0400
commitd12b63c927e0e90de4b55d5084f947707c6d8cf4 (patch)
tree792189338f88eab5ccbb49829951a2ee79001ad3 /drivers/block
parentc3cdb40e66344553898daa3ccd068c03173a3f42 (diff)
zram: report every added and removed device
With dynamic device creation/removal (which will be introduced later in the series) printing num_devices in zram_init() will not make a lot of sense, as well as printing the number of destroyed devices in destroy_devices(). Print per-device action (added/removed) in zram_add() and zram_remove() instead. Example: [ 3645.259652] zram: Added device: zram5 [ 3646.152074] zram: Added device: zram6 [ 3650.585012] zram: Removed device: zram5 [ 3655.845584] zram: Added device: zram8 [ 3660.975223] zram: Removed device: zram6 Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 70aac2e564e9..4429f546b532 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1238,6 +1238,8 @@ static int zram_add(int device_id)
1238 strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); 1238 strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
1239 zram->meta = NULL; 1239 zram->meta = NULL;
1240 zram->max_comp_streams = 1; 1240 zram->max_comp_streams = 1;
1241
1242 pr_info("Added device: %s\n", zram->disk->disk_name);
1241 return 0; 1243 return 0;
1242 1244
1243out_free_disk: 1245out_free_disk:
@@ -1254,6 +1256,7 @@ out_free_dev:
1254 1256
1255static void zram_remove(struct zram *zram) 1257static void zram_remove(struct zram *zram)
1256{ 1258{
1259 pr_info("Removed device: %s\n", zram->disk->disk_name);
1257 /* 1260 /*
1258 * Remove sysfs first, so no one will perform a disksize 1261 * Remove sysfs first, so no one will perform a disksize
1259 * store while we destroy the devices 1262 * store while we destroy the devices
@@ -1280,7 +1283,6 @@ static void destroy_devices(void)
1280 idr_for_each(&zram_index_idr, &zram_remove_cb, NULL); 1283 idr_for_each(&zram_index_idr, &zram_remove_cb, NULL);
1281 idr_destroy(&zram_index_idr); 1284 idr_destroy(&zram_index_idr);
1282 unregister_blkdev(zram_major, "zram"); 1285 unregister_blkdev(zram_major, "zram");
1283 pr_info("Destroyed device(s)\n");
1284} 1286}
1285 1287
1286static int __init zram_init(void) 1288static int __init zram_init(void)
@@ -1299,7 +1301,6 @@ static int __init zram_init(void)
1299 goto out_error; 1301 goto out_error;
1300 } 1302 }
1301 1303
1302 pr_info("Created %u device(s)\n", num_devices);
1303 return 0; 1304 return 0;
1304 1305
1305out_error: 1306out_error: