Skip to contentSkip to conversation

zram: check bd_openers instead bd_holders

PATCH In review Minchan Kim 2 participants 2 messages Feb 3, 2015 Memory management

lore
Share & tools
lore
#0 lore raw

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, move

	set_capacity(zram->disk, 0);
	revalidate_disk(zram->disk);

out from zram_reset_device() to reset_store(). this two function are executed only when called from reset_store() anyway. this also will let us drop `bool reset capacity' param from zram_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 simply zram_reset_device(zram) in __exit zram_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.

Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Minchan Kim
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
index a32069f98afa..cc0e6a3ddb4f 100644

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>