Skip to content

Commit 6086aeb

Browse files
Sebastian Andrzej Siewioraxboe
authored andcommitted
zram: Remove ZRAM_LOCK
The ZRAM_LOCK was used for locking and after the addition of spinlock_t the bit set and cleared but there no reader of it. Remove the ZRAM_LOCK bit. Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9518e5b commit 6086aeb

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,16 @@ static int zram_read_page(struct zram *zram, struct page *page, u32 index,
5959

6060
static int zram_slot_trylock(struct zram *zram, u32 index)
6161
{
62-
int ret;
63-
64-
ret = spin_trylock(&zram->table[index].lock);
65-
if (ret)
66-
__set_bit(ZRAM_LOCK, &zram->table[index].flags);
67-
return ret;
62+
return spin_trylock(&zram->table[index].lock);
6863
}
6964

7065
static void zram_slot_lock(struct zram *zram, u32 index)
7166
{
7267
spin_lock(&zram->table[index].lock);
73-
__set_bit(ZRAM_LOCK, &zram->table[index].flags);
7468
}
7569

7670
static void zram_slot_unlock(struct zram *zram, u32 index)
7771
{
78-
__clear_bit(ZRAM_LOCK, &zram->table[index].flags);
7972
spin_unlock(&zram->table[index].lock);
8073
}
8174

@@ -1293,7 +1286,7 @@ static void zram_free_page(struct zram *zram, size_t index)
12931286
zram_set_handle(zram, index, 0);
12941287
zram_set_obj_size(zram, index, 0);
12951288
WARN_ON_ONCE(zram->table[index].flags &
1296-
~(1UL << ZRAM_LOCK | 1UL << ZRAM_UNDER_WB));
1289+
~(1UL << ZRAM_UNDER_WB));
12971290
}
12981291

12991292
/*

drivers/block/zram/zram_drv.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545

4646
/* Flags for zram pages (table[page_no].flags) */
4747
enum zram_pageflags {
48-
/* zram slot is locked */
49-
ZRAM_LOCK = ZRAM_FLAG_SHIFT,
50-
ZRAM_SAME, /* Page consists the same element */
48+
ZRAM_SAME = ZRAM_FLAG_SHIFT, /* Page consists the same element */
5149
ZRAM_WB, /* page is stored on backing_device */
5250
ZRAM_UNDER_WB, /* page is under writeback */
5351
ZRAM_HUGE, /* Incompressible page */

0 commit comments

Comments
 (0)