linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zram: Allow backing device to be assigned after init
@ 2021-10-01 18:16 Brian Geffon
  2021-10-01 23:22 ` Andrew Morton
  2021-10-04 18:28 ` Minchan Kim
  0 siblings, 2 replies; 10+ messages in thread
From: Brian Geffon @ 2021-10-01 18:16 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Minchan Kim, Nitin Gupta, Sergey Senozhatsky, Jonathan Corbet,
	linux-kernel, linux-doc, linux-block, Suleiman Souhlal,
	Jesse Barnes, Brian Geffon

There does not appear to be a technical reason to not
allow the zram backing device to be assigned after the
zram device is initialized.

This change will allow for the backing device to be assigned
as long as no backing device is already assigned. In that
event backing_dev would return -EEXIST.

Signed-off-by: Brian Geffon <bgeffon@google.com>
---
 drivers/block/zram/zram_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fcaf2750f68f..12b4555ee079 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -462,9 +462,9 @@ static ssize_t backing_dev_store(struct device *dev,
 		return -ENOMEM;
 
 	down_write(&zram->init_lock);
-	if (init_done(zram)) {
-		pr_info("Can't setup backing device for initialized device\n");
-		err = -EBUSY;
+	if (zram->backing_dev) {
+		pr_info("Backing device is already assigned\n");
+		err = -EEXIST;
 		goto out;
 	}
 
-- 
2.33.0.800.g4c38ced690-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-05 17:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 18:16 [PATCH] zram: Allow backing device to be assigned after init Brian Geffon
2021-10-01 23:22 ` Andrew Morton
2021-10-04 14:33   ` Brian Geffon
2021-10-04 18:28 ` Minchan Kim
2021-10-04 18:40   ` Brian Geffon
2021-10-04 20:54     ` Minchan Kim
2021-10-05 15:01       ` Brian Geffon
2021-10-05 15:18         ` Brian Geffon
2021-10-05 16:37           ` Minchan Kim
2021-10-05 17:08             ` Brian Geffon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).