All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Jinpu Wang <jinpu.wang@ionos.com>
Cc: haris.iqbal@ionos.com, axboe@kernel.dk, linux-block@vger.kernel.org
Subject: Re: [RFC PATCH 6/6] rnbd-clt: refactor rnbd_clt_change_capacity
Date: Wed, 22 Jun 2022 19:12:51 +0800	[thread overview]
Message-ID: <b5b2ca6a-cc90-9065-e737-da7f2e6f27ef@linux.dev> (raw)
In-Reply-To: <CAMGffE=N2hAvBQB_kt1ZcnqNBg7SHxZ=3jquR0fogatoad6WKA@mail.gmail.com>



On 6/22/22 6:57 PM, Jinpu Wang wrote:
> On Mon, Jun 20, 2022 at 5:50 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
>> 1. process_msg_open_rsp checks if capacity changed or not before call
>> rnbd_clt_change_capacity while the checking also make sense for
>> rnbd_clt_resize_dev_store, let's move the checking into the function.
>>
>> 2. change the parameter type to 'sector_t' then we don't need to cast
>> it from rnbd_clt_resize_dev_store, and update rnbd_clt_resize_disk too.
>>
>> 3. no need to checking the return value, make it return void.
>>
> better to split this into 3 patches.

Will do.

>> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
>> ---
>>   drivers/block/rnbd/rnbd-clt-sysfs.c |  2 +-
>>   drivers/block/rnbd/rnbd-clt.c       | 24 ++++++++++++------------
>>   drivers/block/rnbd/rnbd-clt.h       |  2 +-
>>   3 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c
>> index 2be5d87a3ca6..e7c7d9a68168 100644
>> --- a/drivers/block/rnbd/rnbd-clt-sysfs.c
>> +++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
>> @@ -376,7 +376,7 @@ static ssize_t rnbd_clt_resize_dev_store(struct kobject *kobj,
>>          if (ret)
>>                  return ret;
>>
>> -       ret = rnbd_clt_resize_disk(dev, (size_t)sectors);
>> +       ret = rnbd_clt_resize_disk(dev, sectors);
>>          if (ret)
>>                  return ret;
>>
>> diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
>> index 2c63cd5ac09d..6c6c4ba3d41d 100644
>> --- a/drivers/block/rnbd/rnbd-clt.c
>> +++ b/drivers/block/rnbd/rnbd-clt.c
>> @@ -68,13 +68,18 @@ static inline bool rnbd_clt_get_dev(struct rnbd_clt_dev *dev)
>>          return refcount_inc_not_zero(&dev->refcount);
>>   }
>>
>> -static int rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
>> -                                   size_t new_nsectors)
>> +static void rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
>> +                                    sector_t new_nsectors)
>>   {
>> -       rnbd_clt_info(dev, "Device size changed from %llu to %zu sectors\n",
>> +       if (get_capacity(dev->gd) != new_nsectors)
>> +               return;
> This change is broken, it leads to resize no longer work, should be "=="

Yes, thanks for catch it.

Thanks,
Guoqing

  reply	other threads:[~2022-06-22 11:13 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 ` [RFC PATCH 3/6] rnbd-clt: kill read_only from struct rnbd_clt_dev Guoqing Jiang
2022-06-22 10:57   ` 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 [this message]
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=b5b2ca6a-cc90-9065-e737-da7f2e6f27ef@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.