Skip to content

Enospc rework

Josef Bacik linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14Btrfs: add bytes_readonly to the spaceinfo at oncefs/btrfs/extent-tree.c+11 -180 replies
2/14Btrfs: fix callers of btrfs_block_rsv_migratefs/btrfs/ctree.h fs/btrfs/delayed-inode.c fs/btrfs/extent-tree.c +3 more+18 -250 replies
3/14Btrfs: always reserve metadata for delalloc extentsfs/btrfs/extent-tree.c+13 -221 reply
4/14Btrfs: change delayed reservation fallback behaviorfs/btrfs/delayed-inode.c+23 -410 replies
5/14Btrfs: warn_on for unaccounted spacesfs/btrfs/extent-tree.c+8 -63 replies
6/14Btrfs: add tracepoint for adding block groupsfs/btrfs/extent-tree.c include/trace/events/btrfs.h+42 -00 replies
7/14Btrfs: introduce ticketed enospc infrastructurefs/btrfs/ctree.h fs/btrfs/extent-tree.c+375 -1515 replies
8/14Btrfs: trace pinned extentsfs/btrfs/extent-tree.c+8 -00 replies
9/14Btrfs: fix delalloc reservation amount tracepointfs/btrfs/extent-tree.c+3 -10 replies
10/14Btrfs: add tracepoints for flush eventsfs/btrfs/ctree.h fs/btrfs/extent-tree.c include/trace/events/btrfs.h+103 -100 replies
11/14Btrfs: add fsid to some tracepointsinclude/trace/events/btrfs.h+11 -60 replies
12/14Btrfs: fix release reserved extents trace pointsfs/btrfs/extent-tree.c+1 -51 reply
13/14Btrfs: don't bother kicking async if there's nothing to reclaimfs/btrfs/extent-tree.c+3 -00 replies
14/14Btrfs: don't do nocow check unless we have tofs/btrfs/file.c+22 -221 reply

Reviews trailers per patch

3 of 14 patches have a Reviewed-by or Acked-by.

PatchLiu BoAustin S. Hemmelgarn
1/14
2/14
3/14R-b
4/14
5/14
6/14
7/14R-b T-b
8/14
9/14
10/14
11/14
12/14R-b
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] Enospc rework

1) Huge latency spikes. One guy starts flushing, he doesn't wake up until the flushers are finished doing work and then checks to see if he can continue. Meanwhile everybody is backed up waiting for that guy to finish getting his reservation.

2) The flushers flush everything. They have no idea when to stop, so it just flushes all of delalloc or all of the delayed inodes. At first they try to flush a little bit and hope they can get away with it, but the tighter you get on space the more it becomes flush the world and hope for the best.

3) Some of the flushing isn't async, yay more latency.

The new approach introduces the idea of tickets for reservations. If you cannot make your reservation immediately you initialize a ticket with how much space you need and you put yourselve on a list. If you cannot flush anything (things like dirty'ing an inode) then you add yourself to the priority queue and wait for a little bit. If you can flush then you add yourself to the normal queue and wait for flushing to happen. Each ticket has it's own waitqueue so as we add space back into the system we can satisfy reservations immediately and immediately wake the waiters back up, which greatly reduces latencies.

I've been testing these patches for a while and will be building on them from here, but the results are pretty excellent so far. In the fs_mark test with all metadata here are the results (on an empty file system)

Without Patch
Average Files/sec: 212897.2
p50 Files/sec: 207495
p90 Files/sec: 196709
p99 Files/sec: 189682

Creat Max Latency in usec
p50: 264665
p90: 456347.2
p99: 659489.32
max: 1001413

With Patch
Average Files/sec: 238613.4
p50 Files/sec: 235764
p90 Files/sec: 223308
p99 Files/sec: 216291

Creat Max Latency in usec
p50: 206771.5
p90: 355430.6
p99: 469634.98
max: 512389

So as you can see there is quite a bit better latency and better throughput overall. There will be more work as I test the worst case scenarios and get the worst latencies down further, but this is the initial work. Thanks,

Josef