From: Ole Langbehn <neurolabs.de@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: [4.4.1] btrfs-transacti frequent high CPU usage despite little fragmentation
Date: Sat, 19 Mar 2016 21:31:46 +0100	[thread overview]
Message-ID: <56EDB732.9060605@gmail.com> (raw)
In-Reply-To: <pan$c1998$42b65a7e$8b396259$757615d8@cox.net>
[-- Attachment #1.1: Type: text/plain, Size: 3271 bytes --]
Duncan,
thanks again for your effort, I highly appreciate it.
On 19.03.2016 00:06, Duncan wrote:
> autodefrag
Got it, thanks.
> Nocow interacts with snapshots.  
Thanks for presenting that in that much detail.
> What can happen then, and used to happen frequently before 3.17, tho much 
> less frequently but it can still happen now, is that over time and with 
> use, the filesystem will allocate all available space as one type, 
> typically data chunks, and then run out of space in the other type of 
> chunk, typically metadata, and have no unallocated space from which to 
> allocate more.   So you'll have lots of space left, but it'll be all tied 
> up in only partially used chunks of the one type and you'll be out of 
> space in the other type.
> 
> And by the time you actually start getting ENOSPC errors as a result of 
> the situation, there's often too little space left to create even the one 
> additional chunk necessary for a balance to write the data from other 
> chunks into, in ordered to combine some of the less used chunks into 
> fewer chunks at 100% usage (but for the last one, of course).
> 
> And you were already in a tight spot in that regard and may well have had 
> errors if you had simply tried an unfiltered balance, because data chunks 
> are typically 1 GiB in size (and can be upto 10 GiB in some circumstances 
> on large enough filesystems, tho I think the really large sizes require 
> multi-device), and you were down to 300-ish MiB of unallocated space, not 
> enough to create a new 1 GiB data chunk.
>
> And considering the filesystem's near terabyte scale, to be down to under 
> a GiB of unallocated space is even more startling, particularly on newer 
> kernels where empty chunks are normally reclaimed automatically (tho as 
> the usage=0 balances reclaimed some space for you, obviously not all of 
> them had been reclaimed in your case).
As I said before, this fs has (with 99.9% probability) never seen
kernels <3.18. I'm curious why it came to the point of only having
300MiB unallocated, or what could potentially lead to this.
> Meanwhile, discussion in another thread reminded me of another factor, 
> quotas.
Sure thing I had quotas enabled without the direct need for them ;).
I've been using
https://github.com/agronick/btrfs-size/
which uses quotas in order to display human readable snapshot sizes.
As a wrap up to the chunk allocation issue (the balance has finished):
# btrfs filesystem usage /
Overall:
    Device size:                 915.32GiB
    Device allocated:            169.04GiB
    Device unallocated:          746.28GiB
    Device missing:                  0.00B
    Used:                        155.51GiB
    Free (estimated):            758.33GiB      (min: 758.33GiB)
    Data ratio:                       1.00
    Metadata ratio:                   1.00
    Global reserve:              512.00MiB      (used: 0.00B)
Data,single: Size:164.01GiB, Used:151.95GiB
   /dev/sda2     164.01GiB
Metadata,single: Size:5.00GiB, Used:3.55GiB
   /dev/sda2       5.00GiB
System,single: Size:32.00MiB, Used:48.00KiB
   /dev/sda2      32.00MiB
Unallocated:
   /dev/sda2     746.28GiB
Cheers,
Ole
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
     prev parent reply	other threads:[~2016-03-19 20:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16  9:45 [4.4.1] btrfs-transacti frequent high CPU usage despite little fragmentation Ole Langbehn
2016-03-17 10:51 ` Duncan
2016-03-18  9:33   ` Ole Langbehn
2016-03-18 23:06     ` Duncan
2016-03-19 20:31       ` Ole Langbehn [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=56EDB732.9060605@gmail.com \
    --to=neurolabs.de@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).