From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757526AbbDWCjI (ORCPT ); Wed, 22 Apr 2015 22:39:08 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35582 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756181AbbDWCjF (ORCPT ); Wed, 22 Apr 2015 22:39:05 -0400 Date: Thu, 23 Apr 2015 11:38:59 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCHv2 07/10] zram: report every added and removed device Message-ID: <20150423023859.GF24928@blaptop> References: <1429185356-11096-1-git-send-email-sergey.senozhatsky@gmail.com> <1429185356-11096-8-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429185356-11096-8-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2015 at 08:55:53PM +0900, Sergey Senozhatsky wrote: > 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 > --- > 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 c2d9b76..71bedb0 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1239,6 +1239,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: > @@ -1265,6 +1267,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); trivial: why did you add the info in the middle of logic functions? Without special reason, let's add it top of the zram_remove. Acked-by: Minchan Kim > del_gendisk(zram->disk); > put_disk(zram->disk); > kfree(zram); > @@ -1281,7 +1285,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) > @@ -1300,7 +1303,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.rc2 > -- Kind regards, Minchan Kim