All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: make btrfs_dirty_inode() to always reserve metadata space
Date: Tue, 12 Jan 2021 20:29:04 +0800	[thread overview]
Message-ID: <ad973dfe-0ff8-72c2-9b22-770999f3f379@gmx.com> (raw)
In-Reply-To: <e68db844-ec96-0ab4-1654-bd8cea6e78e0@suse.com>



On 2021/1/12 下午8:19, Nikolay Borisov wrote:
>
>
> On 8.01.21 г. 7:36 ч., Qu Wenruo wrote:
>> There are several qgroup flush related bugs fixed recently, all of them
>> are caused by the fact that we can trigger qgroup metadata space
>> reservation holding a transaction handle.
>>
>> Thankfully the only situation to trigger above reservation is
>> btrfs_dirty_inode().
>>
>> Currently btrfs_dirty_inode() will try join transactio first, then
>> update the inode.
>> If btrfs_update_inode() fails with -ENOSPC, then it retry to start
>> transaction to reserve metadata space.
>>
>> This not only forces us to reserve metadata space with a transaction
>> handle hold, but can't handle other errors like -EDQUOT.
>>
>> This patch will make btrfs_dirty_inode() to call
>> btrfs_start_transaction() directly without first try joining then
>> starting, so that in try_flush_qgroup() we won't hold a trans handle.
>>
>> This will slow down btrfs_dirty_inode() but my fstests doesn't show too
>> much different for most test cases, thus it may be worthy to skip such
>> performance "optimization".
>
> btrfs_dirty_inode is called everytime file_update_time is called or
> atime is updated. Given the default mount option is to use lazy a_time
> I'd say we needn't worry about it. file_update_time, however, is called
> within the write path so this change potentially makes file write more
> expensive. So instead of testing with fstests it needs proper
> benchmarking with fio.

Thanks for the benchmark tool.

One of my biggest question is what tool should be used to properly
benchmark the patch.

Although I don't have extra physical machine, at least I can test with a
VM with cache=none mode using a dedicated SSD for this case.

Will update the patch to include the new benchmark result.

Thanks,
Qu

>
> <snip>
>

  reply	other threads:[~2021-01-12 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  5:36 [PATCH] btrfs: make btrfs_dirty_inode() to always reserve metadata space Qu Wenruo
2021-01-12 12:19 ` Nikolay Borisov
2021-01-12 12:29   ` Qu Wenruo [this message]
2021-01-12 15:24 ` [btrfs] e86bb85b1f: stress-ng.utime.ops_per_sec -70.1% regression kernel test robot
2021-01-12 15:24   ` kernel test robot
2021-01-13  7:15   ` Qu Wenruo
2021-01-13  7:15     ` Qu Wenruo
2021-02-18 15:28 ` [PATCH] btrfs: make btrfs_dirty_inode() to always reserve metadata space Nikolay Borisov
2021-02-19  0:19   ` Qu Wenruo
2021-02-18 16:14 ` Josef Bacik
2021-02-19  0:31   ` Qu Wenruo

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=ad973dfe-0ff8-72c2-9b22-770999f3f379@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=wqu@suse.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 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.