linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: A L <crimsoncottage@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: btrfs check --clear-space-cache v1 fails if not --clear-space-cache v2 first
Date: Fri, 8 Sep 2017 21:51:32 +0200	[thread overview]
Message-ID: <67a9a252-22ad-7057-fd91-c8abec0f4df9@gmail.com> (raw)

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.

                 reply	other threads:[~2017-09-08 19:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67a9a252-22ad-7057-fd91-c8abec0f4df9@gmail.com \
    --to=crimsoncottage@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).