lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150423023859.GF24928@blaptop>
Date:	Thu, 23 Apr 2015 11:38:59 +0900
From:	Minchan Kim <minchan@...nel.org>
To:	Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Subject: Re: [PATCHv2 07/10] zram: report every added and removed device

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 <sergey.senozhatsky@...il.com>
> ---
>  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 <minchan@...nel.org>

>  	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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ