From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932876AbbBZOLe (ORCPT ); Thu, 26 Feb 2015 09:11:34 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35768 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932848AbbBZOLL (ORCPT ); Thu, 26 Feb 2015 09:11:11 -0500 From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Jerome Marchand , Nitin Gupta , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH 8/8] zram: report every added and removed device Date: Thu, 26 Feb 2015 23:10:43 +0900 Message-Id: <1424959843-20409-9-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.3.1.167.g7f4ba4b In-Reply-To: <1424959843-20409-1-git-send-email-sergey.senozhatsky@gmail.com> References: <1424959843-20409-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/block/zram/zram_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 1436970..91537b1 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1170,6 +1170,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 device_id; out_free_disk: @@ -1196,6 +1198,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); @@ -1283,7 +1287,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) @@ -1310,7 +1313,6 @@ static int __init zram_init(void) goto out_error; } - pr_info("Created %u device(s)\n", num_devices); return 0; out_error: -- 2.3.1.167.g7f4ba4b