lkml.org 
[lkml]   [2020]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RESEND] drivers/block/zram/zram_drv.c: remove WARN_ON_ONCE() in free_block_bdev()
Date
From: Yue Hu <huyue2@yulong.com>

Currently, free_block_bdev() only happens after alloc_block_bdev() which
will ensure blk_idx bit to be set using test_and_set_bit(). So no need to
do WARN_ON_ONCE(!was_set) again when freeing.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
drivers/block/zram/zram_drv.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1bdb579..61b10ab 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -570,10 +570,7 @@ static unsigned long alloc_block_bdev(struct zram *zram)

static void free_block_bdev(struct zram *zram, unsigned long blk_idx)
{
- int was_set;
-
- was_set = test_and_clear_bit(blk_idx, zram->bitmap);
- WARN_ON_ONCE(!was_set);
+ clear_bit(blk_idx, zram->bitmap);
atomic64_dec(&zram->stats.bd_count);
}

--
1.9.1
\
 
 \ /
  Last update: 2020-03-23 09:53    [W:0.033 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site