]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
zram: report every added and removed device
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 7 Apr 2015 23:44:45 +0000 (09:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 7 Apr 2015 23:44:45 +0000 (09:44 +1000)
With dynamic device creation/removal printing num_devices in zram_init()
doesn't 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>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/zram_drv.c

index d539882ced7b010e9b3fcad79c5a1afbb2b461a4..b6b556567eb4666cdcc018d3d7a49ca661a8486c 100644 (file)
@@ -1149,6 +1149,8 @@ static int zram_add(int device_id)
        strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
        zram->meta = NULL;
        zram->max_comp_streams = 1;
+
+       pr_info("Added device: %s\n", zram->disk->disk_name);
        return 0;
 
 out_free_disk:
@@ -1175,6 +1177,8 @@ static void zram_remove(struct zram *zram)
        zram_reset_device_internal(zram);
        idr_remove(&zram_index_idr, zram->disk->first_minor);
        blk_cleanup_queue(zram->disk->queue);
+
+       pr_info("Removed device: %s\n", zram->disk->disk_name);
        del_gendisk(zram->disk);
        put_disk(zram->disk);
        kfree(zram);
@@ -1299,7 +1303,6 @@ static void destroy_devices(void)
        idr_for_each(&zram_index_idr, &zram_exit_cb, NULL);
        idr_destroy(&zram_index_idr);
        unregister_blkdev(zram_major, "zram");
-       pr_info("Destroyed device(s)\n");
 }
 
 static int __init zram_init(void)
@@ -1327,7 +1330,6 @@ static int __init zram_init(void)
                        goto out_error;
        }
 
-       pr_info("Created %u device(s)\n", num_devices);
        return 0;
 
 out_error: