Re: [PATCH 1/1] nbd: add netlink reconfigure resize support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
> 
> 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.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux