From: Alex Elder <elder@inktank.com>
To: Josh Durgin <josh.durgin@inktank.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 2/6] rbd: kill rbd_update_mapping_size()
Date: Tue, 07 May 2013 10:41:11 -0500 [thread overview]
Message-ID: <51892097.3050407@inktank.com> (raw)
In-Reply-To: <5189161C.9070604@inktank.com>
On 05/07/2013 09:56 AM, Josh Durgin wrote:
> Alex Elder <elder@inktank.com> wrote:
>
>> Since rbd_update_mapping_size() is now a trivial wrapper, just open
>> code it in its two callers.
>>
>> Signed-off-by: Alex Elder <elder@inktank.com>
>> ---
>> drivers/block/rbd.c | 17 ++++++-----------
>> 1 file changed, 6 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
>> index a0f1fe5..0a24cdf 100644
>> --- a/drivers/block/rbd.c
>> +++ b/drivers/block/rbd.c
>> @@ -3118,15 +3118,6 @@ static int rbd_read_header(struct rbd_device
>> *rbd_dev,
>> return ret;
>> }
>>
>> -static void rbd_update_mapping_size(struct rbd_device *rbd_dev)
>> -{
>> - if (rbd_dev->spec->snap_id != CEPH_NOSNAP)
>> - return;
>> -
>> - if (rbd_dev->mapping.size != rbd_dev->header.image_size)
>> - rbd_dev->mapping.size = rbd_dev->header.image_size;
>> -}
>> -
>> /*
>> * only read the first part of the ondisk header, without the snaps info
>> */
>> @@ -3143,7 +3134,9 @@ static int rbd_dev_v1_refresh(struct rbd_device
>> *rbd_dev)
>>
>> /* Update image size, and check for resize of mapped image */
>> rbd_dev->header.image_size = h.image_size;
>> - rbd_update_mapping_size(rbd_dev);
>> + if (rbd_dev->spec->snap_id == CEPH_NOSNAP)
>> + if (rbd_dev->mapping.size != rbd_dev->header.image_size)
>> + rbd_dev->mapping.size = rbd_dev->header.image_size;
>
> Using && instead of two conditions would be a bit cleaner. Maybe you
> have later patches that depend on this though. Open coding looks fine to
> me in any case.
Honestly, that's the way I had it, but I looked at both
and liked this better, I think because the lines ended up
long or something.
I'll take another look before I commit it.
-Alex
> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
>
>>
>> /* rbd_dev->header.object_prefix shouldn't change */
>> kfree(rbd_dev->header.snap_sizes);
>> @@ -4074,7 +4067,9 @@ static int rbd_dev_v2_refresh(struct rbd_device
>> *rbd_dev)
>> ret = rbd_dev_v2_image_size(rbd_dev);
>> if (ret)
>> goto out;
>> - rbd_update_mapping_size(rbd_dev);
>> + if (rbd_dev->spec->snap_id == CEPH_NOSNAP)
>> + if (rbd_dev->mapping.size != rbd_dev->header.image_size)
>> + rbd_dev->mapping.size = rbd_dev->header.image_size;
>>
>> ret = rbd_dev_v2_snap_context(rbd_dev);
>> dout("rbd_dev_v2_snap_context returned %d\n", ret);
>
next prev parent reply other threads:[~2013-05-07 15:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 1:36 [PATCH 0/6] rbd: miscellaneous cleanups Alex Elder
2013-05-07 1:37 ` [PATCH 1/6] rbd: update capacity in rbd_dev_refresh() Alex Elder
2013-05-07 22:49 ` Josh Durgin
2013-05-07 1:37 ` [PATCH 2/6] rbd: kill rbd_update_mapping_size() Alex Elder
2013-05-07 14:56 ` Josh Durgin
2013-05-07 15:41 ` Alex Elder [this message]
2013-05-07 1:37 ` [PATCH 3/6] rbd: don't print warning if not mapping a parent Alex Elder
2013-05-07 14:21 ` Josh Durgin
2013-05-07 1:38 ` [PATCH 4/6] rbd: don't look up snapshot id in rbd_dev_mapping_set() Alex Elder
2013-05-07 14:26 ` Josh Durgin
2013-05-07 1:38 ` [PATCH 5/6] rbd: kill rbd_dev_clear_mapping() Alex Elder
2013-05-07 14:26 ` Josh Durgin
2013-05-07 1:38 ` [PATCH 6/6] rbd: always set read-only flag in rbd_add() Alex Elder
2013-05-07 22:51 ` Josh Durgin
2013-05-08 12:50 ` Alex Elder
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=51892097.3050407@inktank.com \
--to=elder@inktank.com \
--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