zram: check bd_openers instead bd_holders
PATCH 1/1 zram: check bd_openers instead bd_holders
Quoted 39 lines · Sergey Senozhatsky
Quoted 38 lines · Minchan Kim
Quoted 36 lines · Sergey Senozhatsky
Quoted 27 lines · Sergey Senozhatsky
So, guys, how about doing it differently, in less lines of code, hopefully. Don't move reset_store()'s work to
zram_reset_device(). Instead, moveset_capacity(zram->disk, 0); revalidate_disk(zram->disk);out from
zram_reset_device()toreset_store(). this two function are executed only when called fromreset_store()anyway. this also will let us drop `bool reset capacity' param fromzram_reset_device().so we will do in
reset_store()mutex_lock(bdev->bd_mutex); fsync_bdev(bdev); zram_reset_device(zram); set_capacity(zram->disk, 0); mutex_unlock(&bdev->bd_mutex); revalidate_disk(zram->disk); bdput(bdev);Quoted 3 lines
and change
zram_reset_device(zram, false)call to simplyzram_reset_device(zram)in__exitzram_exit(void).Hello,
Minchan, Ganesh, I sent a patch last night, with the above solution. looks ok to you?
Quoted 8 lines
Quoted 2 lines
Just I sent a feedback.
thanks.
yeah, !FMODE_EXCL mode.how do you want to handle it -- you want to send a separate patch or you want me to send incremental one-liner and ask Andrew to squash them?
Send a new patch based on yours.
Thanks.
Quoted 1 line · Minchan Kim
Signed-off-by Minchan Kim <[email protected]>
Quoted 9 lines
--- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/zram/zram_drv.c +0
-0
drivers/block/zram/zram_drv.c static ssize_t reset_store(struct device *dev, · line 817
Quoted 8 lines
drivers/block/zram/zram_drv.c +1
-1@@ -811,7 +811,7 @@ static ssize_t reset_store(struct device *dev,mutex_lock (&bdev->bd_mutex);/* Do not reset an active device! */ -if (bdev->bd_holders) { +if (bdev->bd_openers) { ret = -EBUSY ; goto out; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>