From: Mike Christie <mchristi@redhat.com>
To: josef@toxicpanda.com, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/1] nbd: add netlink reconfigure resize support
Date: Mon, 27 May 2019 18:30:22 -0500 [thread overview]
Message-ID: <5CEC730E.20003@redhat.com> (raw)
In-Reply-To: <20190526214918.9495-1-mchristi@redhat.com>
On 05/26/2019 04:49 PM, Mike Christie wrote:
> If the device is setup with ioctl we can resize the device after the
> initial setup, but if the device is setup with netlink we cannot use the
> resize related ioctls and there is no netlink reconfigure size ATTR
> handling code.
>
> This patch adds netlink reconfigure resize support to match the ioctl
> interface.
>
> Signed-off-by: Mike Christie <mchristi@redhat.com>
> ---
>
> V2:
> - Merge reconfig and connect resize related code to helper and avoid
> multiple nbd_size_set calls.
>
> drivers/block/nbd.c | 29 +++++++++++++++++++----------
> 1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 053958a8a2ba..d75b67c12392 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1674,6 +1674,21 @@ nbd_device_policy[NBD_DEVICE_ATTR_MAX + 1] = {
> [NBD_DEVICE_CONNECTED] = { .type = NLA_U8 },
> };
>
> +static void nbd_genl_set_size(struct genl_info *info, struct nbd_device *nbd)
> +{
> + struct nbd_config *config = nbd->config;
> + u64 bsize = config->blksize;
> + u64 bytes = config->bytesize;
> +
> + if (info->attrs[NBD_ATTR_SIZE_BYTES])
> + bytes = nla_get_u64(info->attrs[NBD_ATTR_SIZE_BYTES]);
> +
> + if (info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES])
> + bsize = nla_get_u64(info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]);
> +
> + nbd_size_set(nbd, bsize, div64_u64(bytes, bsize));
> +}
> +
I'm sorry. I do not know what I am thinking. Ignore this patch too. It
is bad. It will always be called in the reconfig case.
next prev parent reply other threads:[~2019-05-27 23:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-26 21:49 [PATCH 1/1] nbd: add netlink reconfigure resize support Mike Christie
2019-05-27 23:30 ` Mike Christie [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-05-16 0:38 Mike Christie
2019-05-26 20:43 ` Mike Christie
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=5CEC730E.20003@redhat.com \
--to=mchristi@redhat.com \
--cc=josef@toxicpanda.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.