# Re: btrfs mount takes too long time

- From: Anand Jain \<hidden\>
- Date: 2021-08-30 01:27:22 
- List: linux-btrfs
- Page: https://ratatoskr.run/linux-btrfs/2021/08/7546069
- Thread: https://ratatoskr.run/linux-btrfs/2021/08/7546069/t.md

```text

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 [ref] 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.
>>>
>>
```
