linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Jingyun He <jingyun.ho@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: btrfs mount takes too long time
Date: Mon, 30 Aug 2021 21:04:33 +0800	[thread overview]
Message-ID: <03b2a09f-eb06-174d-60e2-be2690b27a8d@oracle.com> (raw)
In-Reply-To: <CAHQ7scUiNLVD_4---ArBet-0DqzfmmH5Y9JgQY0grYrUv8yhiQ@mail.gmail.com>

open_ctree() took 228254398 us. And 98% of it that is 225418272 us
was taken by btrfs_read_block_groups().

-------------------
  1) $ 225418272 us | } /* btrfs_read_block_groups [btrfs] */
  1) * 16934.96 us | btrfs_check_rw_degradable [btrfs]();
  0) 0.967 us | btrfs_apply_pending_changes [btrfs]();
  0) 0.239 us | btrfs_read_qgroup_config [btrfs]();
  0) * 21017.34 us | btrfs_get_root_ref [btrfs]();
  0) + 15.717 us | btrfs_start_pre_rw_mount [btrfs]();
  0) 0.865 us | btrfs_discard_resume [btrfs]();
  0) $ 228254398 us | } /* open_ctree [btrfs] */
-------------------

Now we need to run the same thing on btrfs_read_block_groups(),
could you please run.. [1] (no need of the time).

[1]
   $ umount /btrfs;
   $./ftracegraph btrfs_read_block_groups 3 "*:mod:btrfs" "mount 
/dev/vg/scratch0 /btrfs"

Thanks, Anand


On 30/08/2021 14:44, Jingyun He wrote:
> Hi, Anand,
> I have attached the new result.
> Kindly check.
> 
> Thank you.
> 
> On Mon, Aug 30, 2021 at 9:27 AM Anand Jain <anand.jain@oracle.com> wrote:
>>
>>
>> Our open_ctree() took around ~223secs (~3.7mins)
>>
>>    1) $ 223375750 us |  } /* open_ctree [btrfs] */
>>
>> Unfortunately, the default trace buffer per CPU (4K) wasn't sufficient
>> and, the trace-buffer rolled over.
>> So we still don't know how long we spent in btrfs_read_block_groups().
>> Sorry for my mistake we should go 1 step at a time and, we have to do
>> this until we narrow it down to a specific function.
>>
>> Could you please run with the depth = 2 (instead of 3) and use the time
>> command prefix. Also, pull a new ftracegraph as I have updated it to
>> display a proper time output.
>>
>> $ ftracegraph open_ctree 2 "*:mod:btrfs" "time mount /dev/vg/scratch0
>> /btrfs"
>>
>> Thanks, Anand
>>
>> On 29/08/2021 17:42, Jingyun He wrote:
>>> Hi, Anand
>>>
>>> I have attached the file.
>>> Could you kindly check this?
>>>
>>> Thank you.
>>>
>>> On Sun, Aug 29, 2021 at 7:47 AM Anand Jain <anand.jain@oracle.com> wrote:
>>>>
>>>> On 28/08/2021 19:58, Jingyun He wrote:
>>>>> Hello, all
>>>>> I'm new to btrfs, I have a HM-SMR 14TB disk, I have formatted it to
>>>>> btrfs to store the files.
>>>>>
>>>>> When the device is almost full, it needs about 5 mins to mount the device.
>>>>>
>>>>> Is it normal? is there any mount option that I can use to reduce the mount time?
>>>>>
>>>>
>>>>
>>>>     We need to figure out the function taking a longer time (maybe it is
>>>>     read-block-groups). I have similar reports on the non zoned device
>>>>     as well (with a few TB full of data). But there is no good data yet
>>>>     to analyse.
>>>>
>>>>     Could you please collect the trace data from the ftracegraph
>>>>     from here [1] (It needs trace-cmd).
>>>>
>>>>     [1] https://github.com/asj/btrfstrace.git
>>>>
>>>>     Run it as in the example below:
>>>>
>>>>     umount /btrfs;
>>>>
>>>>     ./ftracegraph open_ctree 3 "*:mod:btrfs" "mount /dev/vg/scratch0 /btrfs"
>>>>
>>>>     cat /tmp/ftracegraph.out
>>>>
>>>>
>>>> Thanks, Anand
>>>>
>>>>
>>>>
>>>>> Thank you.
>>>>>
>>>>

  parent reply	other threads:[~2021-08-30 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-28 11:58 btrfs mount takes too long time Jingyun He
2021-08-28 23:47 ` Anand Jain
     [not found]   ` <CAHQ7scVkHp8Lcfxx2QZXv2ghkW-nYpiFGntyZa0Toz2hU3S-tQ@mail.gmail.com>
2021-08-30  1:27     ` Anand Jain
     [not found]       ` <CAHQ7scUiNLVD_4---ArBet-0DqzfmmH5Y9JgQY0grYrUv8yhiQ@mail.gmail.com>
2021-08-30 13:04         ` Anand Jain [this message]
2021-08-30 13:04         ` Anand Jain
     [not found]           ` <CAHQ7scVOYuzz58KcO_fo2rph44CCC46ef=LFVZF8XzoKYq27ig@mail.gmail.com>
2021-08-31 11:09             ` Anand Jain
2021-08-31 13:10               ` Johannes Thumshirn
2021-08-31 16:47                 ` David Sterba
2021-09-07  5:29                   ` Naohiro Aota
     [not found]               ` <CAHQ7scXp9gTANB9gWHqQgXUsnF-YvTOKrK1waUScmqvHU_0ifw@mail.gmail.com>
2021-09-07  9:52                 ` Anand Jain
2021-09-01 16:11           ` Dāvis Mosāns
2021-09-01 21:30             ` Anand Jain
2021-09-02 16:56               ` Dāvis Mosāns
2021-09-03  9:56                 ` Anand Jain
2021-09-02 17:34               ` Joshua
2021-09-01 23:42             ` 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=03b2a09f-eb06-174d-60e2-be2690b27a8d@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=jingyun.ho@gmail.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;
as well as URLs for NNTP newsgroup(s).