From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: Cleanup for using BTRFS_SETGET_STACK instead of raw convert
Date: Wed, 03 Jul 2013 08:43:43 +0800 [thread overview]
Message-ID: <51D373BF.2090100@cn.fujitsu.com> (raw)
In-Reply-To: <20130702173612.GN18204@twin.jikos.cz>
于 2013年07月03日 01:36, David Sterba 写道:
> On Wed, Jun 26, 2013 at 01:27:08PM +0800, Qu Wenruo wrote:
>> --- a/btrfs-convert.c
>> +++ b/btrfs-convert.c
>> @@ -1802,7 +1802,7 @@ static int prepare_system_chunk_sb(struct btrfs_super_block *super)
>> btrfs_set_stack_chunk_num_stripes(chunk, 1);
>> btrfs_set_stack_chunk_sub_stripes(chunk, 0);
>> chunk->stripe.devid = super->dev_item.devid;
> This should use the btrfs_set_* accessors too, right?
I'm afraid not. :(
chunk->stripe.devid is __le64 and so the same is dev_item.devid.
btrfs_set_* is calling cpu_to_le64, but neither of them is u64.
If using btrfs_set_*, we need to first convert le64 to cpu and then
convert back.
So here I didn't use the btrfs_set_* functions.
>
>> - chunk->stripe.offset = cpu_to_le64(0);
>> + btrfs_set_stack_stripe_offset(&chunk->stripe, 0);
>> memcpy(chunk->stripe.dev_uuid, super->dev_item.uuid, BTRFS_UUID_SIZE);
>> btrfs_set_super_sys_array_size(super, sizeof(*key) + sizeof(*chunk));
>> return 0;
>> --- a/btrfs-image.c
>> +++ b/btrfs-image.c
>> @@ -1332,7 +1332,7 @@ static void update_super_old(u8 *buffer)
>> btrfs_set_stack_chunk_num_stripes(chunk, 1);
>> btrfs_set_stack_chunk_sub_stripes(chunk, 0);
>> chunk->stripe.devid = super->dev_item.devid;
> same here, and there's one more in update_super().
Same reason above.
>
>> - chunk->stripe.offset = cpu_to_le64(0);
>> + btrfs_set_stack_stripe_offset(&chunk->stripe, 0);
>> memcpy(chunk->stripe.dev_uuid, super->dev_item.uuid, BTRFS_UUID_SIZE);
>> btrfs_set_super_sys_array_size(super, sizeof(*key) + sizeof(*chunk));
>> csum_block(buffer, 4096);
--
-----------------------------------------------------
Qu Wenruo
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 6 Wenzhu Road, Nanjing, 210012, China
TEL: +86+25-86630566-8526
COINS: 7998-8526
FAX: +86+25-83317685
MAIL: quwenruo@cn.fujitsu.com
-----------------------------------------------------
prev parent reply other threads:[~2013-07-03 0:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 5:27 [PATCH] btrfs-progs: Cleanup for using BTRFS_SETGET_STACK instead of raw convert Qu Wenruo
2013-07-02 17:26 ` David Sterba
2013-07-03 0:47 ` Qu Wenruo
2013-07-02 17:36 ` David Sterba
2013-07-03 0:43 ` Qu Wenruo [this message]
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=51D373BF.2090100@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@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.