Seems to be some inconsistency with btrfs check --clear-space-cache v1. It only worked after clearing v2 space cache. See below result.

Background. Since some time I was running with space_cache mount option. I recently changed to space_cache=v2 and used "clear_cache" mount option to clear out the old v1 cache. From reading this mailings list I found that I should really use btrfs check --clear-space-cache v1 to truly clear the old version space cache.

btrfs-progs-4.13
kernel-4.13

   # btrfs check --clear-space-cache v1 /dev/sdb1
   couldn't open RDWR because of unsupported option features (3).
   ERROR: cannot open file system

   # btrfs check /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   checking extents
   checking free space tree
   cache and super generation don't match, space cache will be invalidated
   checking fs roots
   checking csums
   checking root refs
   found 305286168601 bytes used, no error found
   total csum bytes: 246501768
   total tree bytes: 415334400
   total fs tree bytes: 87130112
   total extent tree bytes: 45481984
   btree space waste bytes: 65894664
   file data blocks allocated: 5691562237952
     referenced 341901901824

   # btrfs check --clear-space-cache v1 /dev/sdb1
   couldn't open RDWR because of unsupported option features (3).
   ERROR: cannot open file system

   # btrfs check --clear-space-cache v2 /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   Clear free space cache v2
   free space cache v2 cleared

   # btrfs check --clear-space-cache v2 /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   no free space cache v2 to clear

   # btrfs check --clear-space-cache v1 /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   Clearing free space cache
   Free space cache cleared

   # btrfs check /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   checking extents
   checking free space tree
   checking fs roots
   checking csums
   checking root refs
   found 305220087844 bytes used, no error found
   total csum bytes: 246501768
   total tree bytes: 415236096
   total fs tree bytes: 87130112
   total extent tree bytes: 45481984
   btree space waste bytes: 65905890
   file data blocks allocated: 5691495915520
     referenced 341835579392

Now, why do I not get "no free space cache v1 to clear" when running it several times more?

   # btrfs check --clear-space-cache v1 /dev/sdb1
   Checking filesystem on /dev/sdb1
   UUID: e0ea1dc2-948a-488c-ad46-98236939b373
   Clearing free space cache

The exact same happen on my other volumes, both single devices and RAID1.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to