SLABTOP BTRFS DURING MOUNTS
#############################

Its intersting to watch the mounts with slabtop and top. Btrfs moutns can take a minute because of the metadata work they do during the mount.

This script below is interesting to run on a box right before you commence a mount of a btrfs system it shows the output of slabtop (kernel modules ram use), specifically just the ones that mention btrfs, also its showing the resource use via top (showing load average, cpu utilization, ram use, and the top processes in use in the device)

SUMMARY: data is mounting if btrfs_extent_buffer is growing, once its mounted it will stabilize at a number, then when you write or read that btrfs_Extent_buffer will grow. in the mean time btrfs_free_space will stay at about the same size and btrfs_extent_map will as well (unless of course alot of writes happen to where those need to change accordingly). Remember these numbers represent the amount of metadata of BTRFS in the RAM (AKA: btrfs kernel module’s slab information – every module/driver has something in slabtop near about – I just grepped out the btrfs stuff)

NOTE: the only reason that btrfs_free_space exists even after the unmount is because the root here is also btrfs. (its only 4 gigs big, so before data, md127, is mounted btrfs_free_space is only 156K and then it grows to 406K through out the mount of data)

THE DATA IM MOUNTING (this is on 1 Raid device that is composed of 7 drives and 1 spare):

 

 

OUTPUT BELOW EXCLUDES OUTPUT OF “top” JUST HAS THE “slabtop” INFORMATION

BEFORE MOUNT:

NOTE: I only have btrfs_free_space because my root is btrfs (if my root was ext this wouldnt be here and it would be empty because there wouldnt be any btrfs modules to run)

NOTE: in arm units you will not have btrfs slabs when your in sysroot (unless you have md127 mounted)
DURING MOUNT (waiting on mount to complete):

NOTE: the second I mount the data volume, we get 2 more enteries for btrfs in slabtop and specifically we see btrfs_extent_buffer grow. Meanwhile the mount command is just sitting there acting like its stuck! (its not as you can see the btrfs_extent_buffer is growing)

 STILL DURING MOUNT (waiting on mount to complete):

NOTE: btrfs_extent_buffer is growing and making its way to the top of slabtop

AFTER MOUNT:

NOTE: the mount is complete, now the btrfs_extent_buffer has stabilized at 901 objects at 7208K (7 megs of RAM). You can cruise around the FS as I did and it will not grow or shrink (who knows maybe I needed to go deeper in)

DOING A READ HEAVY OPERATION:

NOTE: doing a deep read of everything on the FS, filesystem, made the btrfs_extent_buffer grow even more

READ EVERYTHING:  find /data -exec echo {} \; -exec cp {} /dev/null \;

DOING WRITE HEAVY OPERATION:

NOTE: a write operation is just as heavy and the btrfs_extent_buffer kept on growing (notice the btrfs_free_space map is nice and small considering we have ALOT of data)

NOTE: this is really just heavy on both read and write 50/50

WRITE HEAVY COMMAND:

DOING NOTHING (RIGHT BEFORE UNMOUNT):

NOTE: Right before the unmount of the filesystem that has the data, we did heavy read and write operations for a few seconds each.

1 SECOND INTO UNMOUNT: 

NOTE: during the unmount the btrfs_extent_buffer grows and then bam disappears

UNMOUNT:

NOTE: btrfs_extent_buffer disappeared and we are back to where we started more or les

Leave a Reply

Your email address will not be published. Required fields are marked *