LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: [PATCHv2 7/7] zram: report every added and removed device
Date: Sun, 1 Mar 2015 17:42:43 +0900 [thread overview]
Message-ID: <1425199363-15590-8-git-send-email-sergey.senozhatsky@gmail.com> (raw)
In-Reply-To: <1425199363-15590-1-git-send-email-sergey.senozhatsky@gmail.com>
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>
---
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 5664b75..b870916 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -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);
@@ -1293,7 +1297,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)
@@ -1320,7 +1323,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
next prev parent reply other threads:[~2015-03-01 8:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 8:42 [PATCHv2 0/7] introduce dynamic device creation/removal Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 1/7] zram: cosmetic ZRAM_ATTR_RO code formatting tweak Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 2/7] zram: use idr instead of `zram_devices' array Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 3/7] zram: factor out device reset from reset_store() Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 4/7] zram: reorganize code layout Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 5/7] zram: add dynamic device add/remove functionality Sergey Senozhatsky
2015-03-01 8:42 ` [PATCHv2 6/7] zram: remove max_num_devices limitation Sergey Senozhatsky
2015-03-01 8:42 ` Sergey Senozhatsky [this message]
2015-03-03 6:51 ` [PATCHv2 0/7] introduce dynamic device creation/removal Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425199363-15590-8-git-send-email-sergey.senozhatsky@gmail.com \
--to=sergey.senozhatsky@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=sergey.senozhatsky.work@gmail.com \
--subject='Re: [PATCHv2 7/7] zram: report every added and removed device' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).