From: Brian Geffon <bgeffon@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-block@vger.kernel.org,
Suleiman Souhlal <suleiman@google.com>,
Jesse Barnes <jsbarnes@google.com>,
Brian Geffon <bgeffon@google.com>
Subject: [PATCH] zram: Allow backing device to be assigned after init
Date: Fri, 1 Oct 2021 11:16:27 -0700 [thread overview]
Message-ID: <20211001181627.394921-1-bgeffon@google.com> (raw)
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
next reply other threads:[~2021-10-01 18:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 18:16 Brian Geffon [this message]
2021-10-01 23:22 ` [PATCH] zram: Allow backing device to be assigned after init 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211001181627.394921-1-bgeffon@google.com \
--to=bgeffon@google.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=jsbarnes@google.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=senozhatsky@chromium.org \
--cc=suleiman@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).