Re: [PATCH 1/2] zram: free meta out of init_lock

From: Jerome Marchand
Date: Fri Jan 23 2015 - 08:08:01 EST


On 01/23/2015 06:58 AM, Minchan Kim wrote:
> We don't need to call zram_meta_free, zcomp_destroy and zs_free
> under init_lock. What we need to prevent race with init_lock
> in reset is setting NULL into zram->meta (ie, init_done).
> This patch does it.
>
> Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>

Acked-by: Jerome Marchand <jmarchan@xxxxxxxxxx>

On a side note, when zram->meta replaced init_done, no comment was
added in zram structure to explain that. Things could be made more
explicit.

---
Subject: [PATCH] zram: explicitely state that zram->meta is used to determine
the init state

zram->meta is used to determine the initialization state of a zram structure.
This patch adds a comment to zram structure to make this clear.

Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx>
---
drivers/block/zram/zram_drv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index b05a816..551569a 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -99,7 +99,7 @@ struct zram_meta {
};

struct zram {
- struct zram_meta *meta;
+ struct zram_meta *meta; /* also used to determine the init state */
struct request_queue *queue;
struct gendisk *disk;
struct zcomp *comp;
--
1.9.3

Attachment: signature.asc
Description: OpenPGP digital signature