How does enabling btrfs quotas impact the system

btrfs

I use btrfs snapshots quite a bit, and one of the things that interests me is how much space a given snapshot takes up – or to be more specific – how much exclusive data a btrfs snapshot is taking up, so that I know if I delete the snapshot, how much space I would free up.

The only way I know of finding out this information is by enabling btrfs quotas with

# btrfs quota enable /

and running

# btrfs qgroup show /

This is very effective. The thing is – I don't actually use btrfs quotas for anything other than this, which means I have the choice of either always having btrfs quotas enabled, or enabling them temporarily just before running the "btrfs qgroup show /" command, and immediately disabling them. Also, last I heard, btrfs quotas were still experimental (am I wrong?).

Basically what I want to know is:

  1. Does keeping btrfs quotas enabled impact system stability?
  2. Does keeping btrfs quotas enabled impact system performance?

I realize that the "to be safe" answer is to only enable quotas when I need them, but I'm actually making a script that runs "btrfs qgroup show /" and prints the output in a more readable form, and adding code that enables and disables quotas all the time slows down the script considerably, and adds complexity, so I'd rather keep quotas enabled all the time, but I have no clue if there's a downside to it.

Best Answer

I run use btrfs for my personal NAS. It's a 3.7T filesystem with over a thousand snapshots. I use the snapshots to sync backups to external drives. For my use case, enabling quotas has detrimental effects on system stability and performance. BTRFS transactions can become stalled for hours doing quota calculations. This causes any process that touches that filesystem to hang in uninterruptible disk sleep. Even ls or df will hang and become unkillable until the quota calculations complete.

I think if I were to use far fewer snapshots I would not experience this problem. Quotas do seem to perform tolerably well for some people's workloads, just not mine.

Related Question