From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: [RFC PATCH 3/6] rnbd-clt: kill read_only from struct rnbd_clt_dev
Date: Mon, 20 Jun 2022 11:49:20 +0800 [thread overview]
Message-ID: <20220620034923.35633-4-guoqing.jiang@linux.dev> (raw)
In-Reply-To: <20220620034923.35633-1-guoqing.jiang@linux.dev>
The member is not needed since we can call get_disk_ro to achieve the
same goal.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
drivers/block/rnbd/rnbd-clt.c | 8 ++------
drivers/block/rnbd/rnbd-clt.h | 1 -
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 6c4970878d23..0bade2680eb9 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -949,7 +949,7 @@ static int rnbd_client_open(struct block_device *block_device, fmode_t mode)
{
struct rnbd_clt_dev *dev = block_device->bd_disk->private_data;
- if (dev->read_only && (mode & FMODE_WRITE))
+ if (get_disk_ro(dev->gd) && (mode & FMODE_WRITE))
return -EPERM;
if (dev->dev_state == DEV_STATE_UNMAPPED ||
@@ -1402,12 +1402,8 @@ static int rnbd_clt_setup_gen_disk(struct rnbd_clt_dev *dev, int idx)
set_capacity(dev->gd, dev->nsectors);
- if (dev->access_mode == RNBD_ACCESS_RO) {
- dev->read_only = true;
+ if (dev->access_mode == RNBD_ACCESS_RO)
set_disk_ro(dev->gd, true);
- } else {
- dev->read_only = false;
- }
/*
* Network device does not need rotational
diff --git a/drivers/block/rnbd/rnbd-clt.h b/drivers/block/rnbd/rnbd-clt.h
index 2e2e8c4a85c1..26fb91d800e3 100644
--- a/drivers/block/rnbd/rnbd-clt.h
+++ b/drivers/block/rnbd/rnbd-clt.h
@@ -117,7 +117,6 @@ struct rnbd_clt_dev {
char *pathname;
enum rnbd_access_mode access_mode;
u32 nr_poll_queues;
- bool read_only;
bool wc;
bool fua;
u32 max_hw_sectors;
--
2.34.1
next prev parent reply other threads:[~2022-06-20 3:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 3:49 [RFC PATCH 0/6] reduce the size of rnbd_clt_dev Guoqing Jiang
2022-06-20 3:49 ` [RFC PATCH 1/6] rnbd-clt: open code send_msg_open in rnbd_clt_map_device Guoqing Jiang
2022-06-21 15:11 ` Jinpu Wang
2022-06-22 11:14 ` Guoqing Jiang
2022-06-20 3:49 ` [RFC PATCH 2/6] rnbd-clt: don't free rsp in msg_open_conf for map scenario Guoqing Jiang
2022-06-22 10:57 ` Jinpu Wang
2022-06-20 3:49 ` Guoqing Jiang [this message]
2022-06-22 10:57 ` [RFC PATCH 3/6] rnbd-clt: kill read_only from struct rnbd_clt_dev Jinpu Wang
2022-06-20 3:49 ` [RFC PATCH 4/6] rnbd-clt: reduce the size of " Guoqing Jiang
2022-06-22 10:58 ` Jinpu Wang
2022-06-20 3:49 ` [RFC PATCH 5/6] rnbd-clt: adjust the layout " Guoqing Jiang
2022-06-22 10:58 ` Jinpu Wang
2022-06-20 3:49 ` [RFC PATCH 6/6] rnbd-clt: refactor rnbd_clt_change_capacity Guoqing Jiang
2022-06-22 10:57 ` Jinpu Wang
2022-06-22 11:12 ` Guoqing Jiang
2022-06-21 12:16 ` [RFC PATCH 0/6] reduce the size of rnbd_clt_dev Jinpu Wang
2022-06-22 11:15 ` Guoqing Jiang
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=20220620034923.35633-4-guoqing.jiang@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=axboe@kernel.dk \
--cc=haris.iqbal@ionos.com \
--cc=jinpu.wang@ionos.com \
--cc=linux-block@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.