Package: e2fsprogs
Version: 1.42.13-1
Severity: wishlist
Tags: upstream

Hey Ted.

It would be nice if filefrag supports btrfs compression.
Right now, it seems to assume that each 128KiB compression "block"
is one extent, though, AFAIU discussion on linux-btrfs,
it's in realliy one extent.

Example:
/var/log/daemon.1.log is on a btrfs with *no* compression:
# filefrag -v /var/log/daemon.log.1 
Filesystem type is: 9123683e
File size of /var/log/daemon.log.1 is 1436385 (351 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..     220:   62079406..  62079626:    221:            
   1:      221..     255:   13664057..  13664091:     35:   62079627:
   2:      256..     319:   15844162..  15844225:     64:   13664092:
   3:      320..     350:   13515969..  13515999:     31:   15844226: last,eof
/var/log/daemon.log.1: 4 extents found

=> it actually *is* fragmented.

Copying it somewhere else, with no --reflink set:
# cp /var/log/daemon.log.1 ~/
# filefrag -v ~/daemon.log.1
Filesystem type is: 9123683e
File size of /root/daemon.log.1 is 1436385 (351 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..     350:   42929147..  42929497:    351:             last,eof
/root/daemon.log.1: 1 extent found


Now copying it to another btrfs, mounted with compress-force=zlib:
# cp /var/log/daemon.log.1 /mnt/
# filefrag -v /mnt/daemon.log.1 
Filesystem type is: 9123683e
File size of /mnt/daemon.log.1 is 1436385 (351 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..      31:       3072..      3103:     32:             encoded
   1:       32..      63:       3078..      3109:     32:       3104: encoded
   2:       64..      95:       3084..      3115:     32:       3110: encoded
   3:       96..     127:       3090..      3121:     32:       3116: encoded
   4:      128..     159:       3096..      3127:     32:       3122: encoded
   5:      160..     191:       3102..      3133:     32:       3128: encoded
   6:      192..     223:       3108..      3139:     32:       3134: encoded
   7:      224..     255:       3114..      3145:     32:       3140: encoded
   8:      256..     287:       3120..      3151:     32:       3146: encoded
   9:      288..     319:       3125..      3156:     32:       3152: encoded
  10:      320..     350:       3132..      3162:     31:       3157: 
last,encoded,eof
/mnt/daemon.log.1: 11 extents found

Shows exactly those 128KiB blocks distribution.


Cheers,
Chris.

Reply via email to