linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Sun, 26 May 2019 15:43:49 -0500	[thread overview]
Message-ID: <5CEAFA85.5000304@redhat.com> (raw)
In-Reply-To: <20190516003800.28373-1-mchristi@redhat.com>

Ignore this patch. I had copied nbd_genl_connect, but there is no need
to do 2 nbd_size_set calls if both attrs are set. I am going to resubmit
a new patch.

On 05/15/2019 07:38 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>
> ---
>  drivers/block/nbd.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 053958a8a2ba..68b9d4b2d1be 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1939,6 +1939,15 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>  		goto out;
>  	}
>  
> +	if (info->attrs[NBD_ATTR_SIZE_BYTES]) {
> +		u64 bytes = nla_get_u64(info->attrs[NBD_ATTR_SIZE_BYTES]);
> +		nbd_size_set(nbd, config->blksize,
> +			     div64_u64(bytes, config->blksize));
> +	}
> +	if (info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]) {
> +		u64 bsize = nla_get_u64(info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]);
> +		nbd_size_set(nbd, bsize, div64_u64(config->bytesize, bsize));
> +	}
>  	if (info->attrs[NBD_ATTR_TIMEOUT]) {
>  		u64 timeout = nla_get_u64(info->attrs[NBD_ATTR_TIMEOUT]);
>  		nbd->tag_set.timeout = timeout * HZ;
> 


  reply	other threads:[~2019-05-26 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16  0:38 [PATCH 1/1] nbd: add netlink reconfigure resize support Mike Christie
2019-05-26 20:43 ` Mike Christie [this message]
2019-05-26 21:49 Mike Christie
2019-05-27 23:30 ` 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=5CEAFA85.5000304@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 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).