From: Miao Xie <miaox@cn.fujitsu.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH V2 2/2] Btrfs: remove btrfs_sector_sum structure
Date: Fri, 26 Apr 2013 17:04:30 +0800 [thread overview]
Message-ID: <517A431E.3090608@cn.fujitsu.com> (raw)
In-Reply-To: <517A41AA.6030102@cn.fujitsu.com>
On Fri, 26 Apr 2013 16:58:18 +0800, Miao Xie wrote:
> On tue, 23 Apr 2013 16:54:35 -0400, Josef Bacik wrote:
>> On Wed, Apr 03, 2013 at 03:14:56AM -0600, Miao Xie wrote:
>>> Using the structure btrfs_sector_sum to keep the checksum value is
>>> unnecessary, because the extents that btrfs_sector_sum points to are
>>> continuous, we can find out the expected checksums by btrfs_ordered_sum's
>>> bytenr and the offset, so we can remove btrfs_sector_sum's bytenr. After
>>> removing bytenr, there is only one member in the structure, so it makes
>>> no sense to keep the structure, just remove it, and use a u32 array to
>>> store the checksum value.
>>>
>>> By this change, we don't use the while loop to get the checksums one by
>>> one. Now, we can get several checksum value at one time, it improved the
>>> performance by ~74% on my SSD (31MB/s -> 54MB/s).
>>>
>>> test command:
>>> # dd if=/dev/zero of=/mnt/btrfs/file0 bs=1M count=1024 oflag=sync
>>>
>>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>>> Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
> [SNIP]
>>> next_offset = (u64)-1;
>>> found_next = 0;
>>> + bytenr = sums->bytenr + total_bytes;
>>> file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
>>> - file_key.offset = sector_sum->bytenr;
>>> - bytenr = sector_sum->bytenr;
>>> + file_key.offset = bytenr;
>>> btrfs_set_key_type(&file_key, BTRFS_EXTENT_CSUM_KEY);
>>>
>>> - item = btrfs_lookup_csum(trans, root, path, sector_sum->bytenr, 1);
>>> + item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
>>> if (!IS_ERR(item)) {
>>> - leaf = path->nodes[0];
>>> - ret = 0;
>>> - goto found;
>>> + csum_offset = 0;
>>> + goto csum;
>>
>> Ok I've just spent the last 3 hours tracking down an fsync() problem that turned
>> out to be because of this patch. btrfs_lookup_csum() assumes you are just going
>> in 4k chunks, but we could be going in larger chunks. So as long as the bytenr
>> falls inside of this csum item it thinks its good. So what I'm seeing is this,
>> we have item
>>
>> [0-8k]
>>
>> and we are csumming
>>
>> [4k-12k]
>>
>> and then we're adding our new csum into the old one, the sizes match but the
>> bytenrs don't match. If you want a reproducer just run my fsync xfstest that I
>> just posted. I'm dropping this patch for now and I'll wait for you to fix it.
>> Thanks,
>
> Is the reproducer is the 311th case of xfstests?
> ([PATCH] xfstests 311: test fsync with dm flakey V2)
>
> If yes, I'm so sorry that we didn't reproduce the problem you said above. Could you
> give me your test option?
please ignore the attached patch, I sent it out by mistake.
Thanks
Miao
prev parent reply other threads:[~2013-04-26 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 8:11 [PATCH 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum structure Miao Xie
2013-03-28 9:03 ` [PATCH V2 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum, structure Miao Xie
2013-03-28 13:51 ` Chris Mason
2013-03-28 14:38 ` [PATCH 3/4] Btrfs: remove unnecessary variant in btrfs_sector_sum structure Liu Bo
2013-03-28 14:41 ` Liu Bo
2013-03-29 1:39 ` Miao Xie
2013-04-03 9:14 ` [PATCH V2 2/2] Btrfs: remove " Miao Xie
2013-04-23 20:54 ` Josef Bacik
2013-04-26 8:58 ` Miao Xie
2013-04-26 9:04 ` Miao Xie [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=517A431E.3090608@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=jbacik@fusionio.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox