Skip to contentSkip to conversation

directory defrag

DISCUSSION Russell Coker 3 participants 3 messages Apr 14, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

The current defragmentation options seem to only support defragmenting named files/directories or a recursive defragmentation of files and directories.

I'd like to recursively defragment directories. One of my systems has a large number of large files, the files are write-once and read performance is good enough. However performance of "ls -al" is often very poor, presumably due to metadata fragmentation.

The other thing I'd still like is the ability to force all metadata allocation to be from specified disks. I'd like to have a pair of SSDs for RAID-1 storage of metadata and a set of hard drives for RAID-1 storage of data.

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#1 lore raw

Russell Coker wrote (ao):

Quoted 5 lines

The current defragmentation options seem to only support defragmenting named files/directories or a recursive defragmentation of files and directories.

I'd like to recursively defragment directories.

find / -xdev -type d -execdir btrfs filesystem defrag -c {} +

Would that work for you?

Sander

#2 lore raw
In reply to Russell Coker
Quoted 7 lines · Russell Coker

The current defragmentation options seem to only support defragmenting named files/directories or a recursive defragmentation of files and directories.

I'd like to recursively defragment directories. One of my systems has a large number of large files, the files are write-once and read performance is good enough. However performance of "ls -al" is often very poor, presumably due to metadata fragmentation.

Ie. the directory metadata in the b-tree. That's possible, but not all of the code is there. So fare only whole-tree defragmentation is implemented, ie. the extent tree or any subvolume tree. We'd have to extend the defrag api to take a key range and then use it to span the directory key range.