From: Alex Elder <alex.elder@linaro.org>
To: Josh Durgin <josh.durgin@inktank.com>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] rbd: only set disk to read-only once
Date: Tue, 01 Oct 2013 16:21:27 -0500 [thread overview]
Message-ID: <524B3CD7.4030807@linaro.org> (raw)
In-Reply-To: <1380604559-5331-3-git-send-email-josh.durgin@inktank.com>
On 10/01/2013 12:15 AM, Josh Durgin wrote:
> rbd_open(), called every time the device is opened, calls
> set_device_ro(). There's no reason to set the device read-only or
> read-write every time it is opened. Just do this once during device
> setup, using set_disk_ro() instead because the struct block_device
> isn't available to us there.
Looks good; set_disk_ro() sort of makes more sense anyway without
any partitions.
Reviewed-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
> ---
> drivers/block/rbd.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index b3b1b57..fc3ebd9 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -490,7 +490,6 @@ static int rbd_open(struct block_device *bdev, fmode_t mode)
> return -ENOENT;
>
> (void) get_device(&rbd_dev->dev);
> - set_device_ro(bdev, rbd_dev->mapping.read_only);
>
> return 0;
> }
> @@ -4949,6 +4948,7 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
> if (ret)
> goto err_out_disk;
> set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
> + set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
>
> ret = rbd_bus_add_dev(rbd_dev);
> if (ret)
>
prev parent reply other threads:[~2013-10-01 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 3:25 [PATCH v4] rbd: add ioctl for rbd Guangliang Zhao
2013-10-01 5:15 ` [PATCH 0/2] clean up read only mode Josh Durgin
2013-10-08 3:40 ` Guangliang Zhao
2013-10-01 5:15 ` [PATCH 1/2] rbd: move calls that may sleep out of spin lock range Josh Durgin
2013-10-01 21:17 ` Alex Elder
2013-10-01 5:15 ` [PATCH 2/2] rbd: only set disk to read-only once Josh Durgin
2013-10-01 21:21 ` Alex Elder [this message]
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=524B3CD7.4030807@linaro.org \
--to=alex.elder@linaro.org \
--cc=ceph-devel@vger.kernel.org \
--cc=josh.durgin@inktank.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).