From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933002AbbD0NWm (ORCPT ); Mon, 27 Apr 2015 09:22:42 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36741 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932896AbbD0NWc (ORCPT ); Mon, 27 Apr 2015 09:22:32 -0400 From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [PATCHv3 6/9] zram: report every added and removed device Date: Mon, 27 Apr 2015 22:21:48 +0900 Message-Id: <1430140911-7818-7-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.4.0.rc3.3.g6eb1401 In-Reply-To: <1430140911-7818-1-git-send-email-sergey.senozhatsky@gmail.com> References: <1430140911-7818-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 (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 Acked-by: Minchan Kim Signed-off-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index b875517..ec6396c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1236,6 +1236,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: @@ -1252,6 +1254,7 @@ out_free_dev: static void zram_remove(struct zram *zram) { + pr_info("Removed device: %s\n", zram->disk->disk_name); /* * Remove sysfs first, so no one will perform a disksize * store while we destroy the devices @@ -1278,7 +1281,6 @@ static void destroy_devices(void) idr_for_each(&zram_index_idr, &zram_remove_cb, NULL); idr_destroy(&zram_index_idr); unregister_blkdev(zram_major, "zram"); - pr_info("Destroyed device(s)\n"); } static int __init zram_init(void) @@ -1297,7 +1299,6 @@ static int __init zram_init(void) goto out_error; } - pr_info("Created %u device(s)\n", num_devices); return 0; out_error: -- 2.4.0.rc3.3.g6eb1401