pax_global_header00006660000000000000000000000064147710537640014530gustar00rootroot0000000000000052 comment=5ad147c9ec00e657393c85b195c9bcc0f4c35a54 btrfs-progs-6.14/000077500000000000000000000000001477105376400137325ustar00rootroot00000000000000btrfs-progs-6.14/.codespellrc000066400000000000000000000004421477105376400162320ustar00rootroot00000000000000[codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file skip = .git*,*.svg,*.css,.codespellrc,fsck-tests check-hidden = true ignore-regex = \b(Yann Collet|TOI)\b # annote - used as a noun # iput - function name ignore-words-list = annote,annotes,iput,uptodate btrfs-progs-6.14/.editorconfig000066400000000000000000000002341477105376400164060ustar00rootroot00000000000000[*] end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true charset = utf-8 indent_style = tab indent_size = 8 [*.py] indent_size = 4 btrfs-progs-6.14/.github/000077500000000000000000000000001477105376400152725ustar00rootroot00000000000000btrfs-progs-6.14/.github/workflows/000077500000000000000000000000001477105376400173275ustar00rootroot00000000000000btrfs-progs-6.14/.github/workflows/artifacts-static-build.yml000066400000000000000000000033661477105376400244240ustar00rootroot00000000000000# Build static binaries (published as artifacts) # - btrfs.static - the main tool # - btrfs.box.static - all-in-one tool (functionality selected by file name) name: Static binaries run-name: Static binaries on: push: branches: - master jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev - name: Configure run: ./autogen.sh && ./configure --disable-documentation - name: Make static run: make V=1 EXTRA_CFLAGS='-march=x86-64' static - name: Make box.static run: make V=1 EXTRA_CFLAGS='-march=x86-64' btrfs.box.static - name: Strip binaries run: strip btrfs.static btrfs.box.static - name: Calculate SHA256 checksums run: | sha256sum btrfs.static | tee btrfs.static.sha256 sha256sum btrfs.box.static | tee btrfs.box.static.sha256 - name: Save artifacts - btrfs.static uses: actions/upload-artifact@v4 with: name: btrfs.static path: btrfs.static - name: Save artifacts - btrfs.static.sha256 uses: actions/upload-artifact@v4 with: name: btrfs.static.sha256 path: btrfs.static.sha256 - name: Save artifacts - btrfs.box.static uses: actions/upload-artifact@v4 with: name: btrfs.box.static path: btrfs.box.static - name: Save artifacts - btrfs.box.static.sha256 uses: actions/upload-artifact@v4 with: name: btrfs.box.static.sha256 path: btrfs.box.static.sha256 btrfs-progs-6.14/.github/workflows/ci-build-test.yml000066400000000000000000000126061477105376400225240ustar00rootroot00000000000000# Backward compatibility build tests on various distros # # - all compatibility docker image build tests (no local build) # - images are not rebuilt when the workflow runs but are pulled from docker hub # and can be slightly out of date name: CI image tests run-name: CI image tests on: push: branches: - "ci/**" - devel - release-test - master jobs: check-centos7: name: CI Centos 7 runs-on: ubuntu-24.04 steps: - name: CI Centos7 run: sudo docker run kdave/ci-centos-7-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-libudev check-centos8: name: CI Centos 8 runs-on: ubuntu-24.04 steps: - name: CI Centos8 run: sudo docker run kdave/ci-centos-8-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-zoned --disable-libudev check-rockylinux9: name: CI RockyLinux 9 runs-on: ubuntu-24.04 steps: - name: CI RockyLinux 9 run: sudo docker run kdave/ci-rockylinux-9-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation check-leap153: name: CI Leap 15.3 runs-on: ubuntu-24.04 steps: - name: CI Leap 15.3 run: sudo docker run kdave/ci-opensuse-leap-15.3-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-zoned check-leap156: name: CI Leap 15.6 runs-on: ubuntu-24.04 steps: - name: CI Leap 15.6 run: sudo docker run kdave/ci-opensuse-leap-15.6-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-zoned check-musl: name: CI Musl runs-on: ubuntu-24.04 steps: - name: CI Musl run: sudo docker run kdave/ci-musl-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev - name: CI Musl (experimental) run: sudo docker run kdave/ci-musl-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev --enable-experimental check-musl-32bit: name: CI Musl (32bit) # Pin the version, on 24.04 it fails: # make: *** pselect jobs pipe: Function not implemented. Stop. # make: *** Waiting for unfinished jobs.... runs-on: ubuntu-22.04 steps: - name: CI Musl (32bit) run: sudo docker run kdave/ci-musl-i386 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev - name: CI Musl (32bit) (experimental) run: sudo docker run kdave/ci-musl-i386 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev --enable-experimental check-tumbleweed: name: CI Tumbleweed runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation - name: CI Tumbleweed (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --enable-experimental check-tumbleweed-libgcrypt: name: CI Tumbleweed (libgcrypt) runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed (libgcrypt) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libgcrypt - name: CI Tumbleweed (libgcrypt) (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libgcrypt --enable-experimental check-tumbleweed-libsodium: name: CI Tumbleweed (libsodium) runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed (libsodium) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libsodium - name: CI Tumbleweed (libsodium) (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libsodium --enable-experimental check-tumbleweed-libkcapi: name: CI Tumbleweed (libkcapi) runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed (libkcapi) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libkcapi - name: CI Tumbleweed (libkcapi) (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=libkcapi --enable-experimental check-tumbleweed-botan: name: CI Tumbleweed (Botan) runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed (Botan) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=botan - name: CI Tumbleweed (Botan) (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=botan --enable-experimental check-tumbleweed-openssl: name: CI Tumbleweed (OpenSSL) runs-on: ubuntu-24.04 steps: - name: CI Tumbleweed (OpenSSL) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=openssl - name: CI Tumbleweed (OpenSSL) (experimental) run: sudo docker run kdave/ci-opensuse-tumbleweed-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --with-crypto=openssl --enable-experimental btrfs-progs-6.14/.github/workflows/codeql.yml000066400000000000000000000052251477105376400213250ustar00rootroot00000000000000# CodeQL security checks (Advanced) # # Runner size impacts CodeQL analysis time. To learn more, please see: # - https://gh.io/recommended-hardware-resources-for-running-codeql # - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/using-larger-runners (GitHub.com only) # - https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. # - https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages # - https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # # Queries: # - https://docs.github.com/en/code-security/code-scanning/managing-your-code-scanning-configuration/c-cpp-built-in-queries name: "CodeQL (Advanced)" run-name: "CodeQL (Advanced)" on: push: branches: [ "devel", "master" ] pull_request: branches: [ "devel" ] jobs: analyze: name: Analyze (${{ matrix.language }}) runs-on: ubuntu-latest permissions: # required for all workflows security-events: write # required to fetch internal or private CodeQL packs packages: read # only required for workflows in private repositories actions: read contents: read strategy: fail-fast: false matrix: include: - language: c-cpp build-mode: manual - language: python build-mode: none steps: - name: Checkout repository uses: actions/checkout@v4 # (Add any setup steps before running the `github/codeql-action/init` action.) # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} # (Custom queries) queries: security-extended,security-and-quality - name: Update package cache run: sudo apt-get update -qqq - name: Add more build dependencies run: sudo apt-get install -y liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev - if: matrix.build-mode == 'manual' shell: bash run: | ./autogen.sh ./configure --disable-documentation --enable-experimental make -j 4 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" btrfs-progs-6.14/.github/workflows/codespell.yml000066400000000000000000000013721477105376400220270ustar00rootroot00000000000000# Check for typos on devel and pull rquests # - codespell configuration is within .codespellrc # - the workflow can be run separately from other workflows that trigger on # ci/* branches, use codespell/* as the prefix name: Codespell run-name: Codespell on: push: branches: - devel - 'ci/**' - 'codespell/**' pull_request: branches: - devel - 'ci/**' permissions: contents: read jobs: codespell: name: Check for spelling errors runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Annotate locations with typos uses: codespell-project/codespell-problem-matcher@v1 - name: Codespell uses: codespell-project/actions-codespell@v2 btrfs-progs-6.14/.github/workflows/coverage.yml000066400000000000000000000044061477105376400216510ustar00rootroot00000000000000# Code coverage when running all the tests, lcov published as artifacts name: Code coverage tests run-name: Code coverage tests on: push: branches: - coverage-test - master jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq lcov - name: Configure run: ./autogen.sh && ./configure --disable-documentation - name: Make run: make V=1 D=gcov - name: Tests cli run: sudo make D=gcov TEST_LOG=dump test-cli - name: Tests mkfs run: sudo make D=gcov TEST_LOG=dump test-mkfs - name: Tests check run: sudo make D=gcov TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make D=gcov TEST_LOG=dump test-check-lowmem - name: Tests misc run: sudo make D=gcov TEST_LOG=dump test-misc - name: Tests fuzz run: sudo make D=gcov TEST_LOG=dump test-fuzz - name: Tests convert run: sudo make D=gcov TEST_LOG=dump test-convert - name: Test internal APIs run: make D=gcov test-api - name: Libbtrfsutil test run: make D=gcov test-libbtrfsutil - name: Libbtrfs build test run: make D=gcov library-test - name: Tests hash (correctness) run: make D=gcov hash-vectest && ./hash-vectest - name: Generate lcov results run: | lcov -c -d . -o lcov-info genhtml --rc geninfo_unexecuted_blocks=1 -o lcov-out lcov-info - name: Save lcov results uses: actions/upload-artifact@v4 with: name: lcov-out path: lcov-out - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ${{ github.workspace }}/lcov-info - name: Save logs on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-results path: "tests/*-results.txt" if-no-files-found: ignore btrfs-progs-6.14/.github/workflows/devel.yml000066400000000000000000000173341477105376400211610ustar00rootroot00000000000000# Workflow for testing branch 'devel' # - build tests # - various runtime tests name: Devel build and tests run-name: Devel build and tests on: push: branches: - devel - 'ci/**' - 'CI/**' jobs: build-simple: name: Simple build tests, manual page build test strategy: matrix: compiler: [ gcc, clang ] runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v46 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx sphinx-rtd-theme-common python3-sphinx-rtd-theme - name: Configure run: ./autogen.sh && CC=${{ matrix.compiler }} ./configure --enable-experimental - name: Documentation run: make V=1 -C Documentation - name: Generate manual pages preview (html) if: ${{ matrix.compiler == 'gcc' }} env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | for file in ${ALL_CHANGED_FILES}; do echo "$file was changed, generate preview to summary" Documentation/html-preview.sh "$file" >> $GITHUB_STEP_SUMMARY done - run: echo '
' >> $GITHUB_STEP_SUMMARY - name: Generate manual pages preview (man) if: ${{ matrix.compiler == 'gcc' }} env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | for file in ${ALL_CHANGED_FILES}; do echo "$file was changed, generate preview to summary" Documentation/man-preview.sh "$file" >> $GITHUB_STEP_SUMMARY done - name: Make static run: make V=1 EXTRA_CFLAGS='-march=x86-64' static - name: Make box.static run: make V=1 EXTRA_CFLAGS='-march=x86-64' btrfs.box.static build-musl: name: Build test on musl runs-on: ubuntu-24.04 steps: - name: Musl build run: sudo docker run kdave/ci-musl-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev test-quick: name: Quick tests strategy: matrix: compiler: [ gcc, clang ] runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && CC=${{ matrix.compiler }} ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Test internal APIs run: make test-api - name: Libbtrfsutil test run: make test-libbtrfsutil - name: Libbtrfs build test run: make library-test - name: Libbtrfs build test (static) run: make library-test.static - name: Tests ioctl run: make ioctl-test - name: Tests hash (speed) run: make hash-speedtest && ./hash-speedtest 1 - name: Tests hash (correctness) run: make hash-vectest && ./hash-vectest test-mkfs: name: Test mkfs.btrfs runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests mkfs run: sudo make TEST_LOG=dump test-mkfs - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: mkfs-tests-results.txt path: tests/mkfs-tests-results.txt if-no-files-found: ignore test-check: name: Test btrfs check runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests check run: sudo make TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make TEST_LOG=dump test-check-lowmem - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: fsck-tests-results.txt path: tests/fsck-tests-results.txt if-no-files-found: ignore test-misc: name: Test misc runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests misc run: sudo make TEST_LOG=dump test-misc - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: misc-tests-results.txt path: tests/misc-tests-results.txt if-no-files-found: ignore test-convert: name: Test btrfs-convert runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests convert run: sudo make TEST_LOG=dump test-convert - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: convert-tests-results.txt path: tests/convert-tests-results.txt if-no-files-found: ignore test-other: name: Test cli, fuzz runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests cli run: sudo make TEST_LOG=dump test-cli - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: cli-tests-results.txt path: tests/cli-tests-results.txt if-no-files-found: ignore - name: Tests fuzz run: sudo make TEST_LOG=dump test-fuzz - name: Save logs to artifacts if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: fuzz-tests-results.txt path: tests/fuzz-tests-results.txt if-no-files-found: ignore btrfs-progs-6.14/.github/workflows/extended-build.yml000066400000000000000000000011171477105376400227470ustar00rootroot00000000000000# Build tests of various combinations of configure options # (pre-release tests) name: Extended build tests run-name: Extended build tests on: push: branches: - release-test jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr ccache - name: Run tests/build-tests.sh run: ./tests/build-tests.sh --ccache btrfs-progs-6.14/.github/workflows/pull-request.yml000066400000000000000000000036311477105376400225170ustar00rootroot00000000000000# Workflow for testing pull request against branches 'devel' or 'master' # # Derived from CI workflow for 'devel' but simplified to only the most common # tests, more problems could be caught by other workflows after merge. # # - build tests # - various runtime tests name: Pull request build and tests run-name: Pull request build and tests on: pull_request: branches: [ "devel", "master" ] jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 # - name: Musl build # run: sudo docker run kdave/ci-musl-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev - name: Make static run: make V=1 EXTRA_CFLAGS='-march=x86-64' static - name: Make box.static run: make V=1 EXTRA_CFLAGS='-march=x86-64' btrfs.box.static - name: Tests cli run: sudo make TEST_LOG=dump test-cli - name: Tests mkfs run: sudo make TEST_LOG=dump test-mkfs - name: Tests check run: sudo make TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make TEST_LOG=dump test-check-lowmem - name: Tests misc run: sudo make TEST_LOG=dump test-misc - name: Tests fuzz run: sudo make TEST_LOG=dump test-fuzz - name: Save logs on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-results path: "tests/*-results.txt" if-no-files-found: ignore btrfs-progs-6.14/.github/workflows/sanitize.yml000066400000000000000000000124131477105376400217010ustar00rootroot00000000000000# Run tests with sanitizers enabled # - UBSAN - undefined behaviour (default) # - ASAN - memory leaks etc # - TSAN - multi-threading issues name: Sanitizer checks run-name: Sanitizer checks on: push: branches: - devel - sanitize-test - master jobs: build-ubsan: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 D=ubsan - name: Tests cli run: sudo make D=ubsan TEST_LOG=dump test-cli - name: Tests mkfs run: sudo make D=ubsan TEST_LOG=dump test-mkfs - name: Tests check run: sudo make D=ubsan TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make D=ubsan TEST_LOG=dump test-check-lowmem - name: Tests misc run: sudo make D=ubsan TEST_LOG=dump test-misc - name: Tests fuzz run: sudo make D=ubsan TEST_LOG=dump test-fuzz - name: Tests convert run: sudo make D=ubsan TEST_LOG=dump test-convert - name: Test internal APIs run: make D=ubsan test-api - name: Libbtrfsutil test run: make D=ubsan test-libbtrfsutil - name: Libbtrfs build test run: make D=ubsan library-test - name: Tests hash (correctness) run: make D=ubsan hash-vectest && ./hash-vectest - name: Save logs on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-results path: "tests/*-results.txt" if-no-files-found: ignore build-asan: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 D=asan - name: Tests cli run: sudo make D=asan TEST_LOG=dump test-cli - name: Tests mkfs run: sudo make D=asan TEST_LOG=dump test-mkfs - name: Tests check run: sudo make D=asan TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make D=asan TEST_LOG=dump test-check-lowmem - name: Tests misc run: sudo make D=asan TEST_LOG=dump test-misc - name: Tests fuzz run: sudo make D=asan TEST_LOG=dump test-fuzz - name: Tests convert run: sudo make D=asan TEST_LOG=dump test-convert - name: Test internal APIs run: make D=asan test-api # Temporary: the library or python bindings are not linked with ASAN and test cannot be run # - name: Libbtrfsutil test # run: make D=asan test-libbtrfsutil # - name: Libbtrfs build test # run: make D=asan library-test - name: Tests hash (correctness) run: make D=asan hash-vectest && ./hash-vectest - name: Save logs on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-results path: "tests/*-results.txt" if-no-files-found: ignore build-tsan: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq - name: Configure run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 D=tsan - name: Tests cli run: sudo make D=tsan TEST_LOG=dump test-cli - name: Tests mkfs run: sudo make D=tsan TEST_LOG=dump test-mkfs - name: Tests check run: sudo make D=tsan TEST_LOG=dump test-check - name: Tests check (lowmem) run: sudo make D=tsan TEST_LOG=dump test-check-lowmem - name: Tests misc run: sudo make D=tsan TEST_LOG=dump test-misc - name: Tests fuzz run: sudo make D=tsan TEST_LOG=dump test-fuzz - name: Tests convert run: sudo make D=tsan TEST_LOG=dump test-convert - name: Test internal APIs run: make D=tsan test-api # Temporary: the library or python bindings are not linked with TSAN and test cannot be run # - name: Libbtrfsutil test # run: make D=tsan test-libbtrfsutil # - name: Libbtrfs build test # run: make D=tsan library-test - name: Tests hash (correctness) run: make D=tsan hash-vectest && ./hash-vectest - name: Save logs on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-results path: "tests/*-results.txt" if-no-files-found: ignore btrfs-progs-6.14/.github/workflows/test.yml000066400000000000000000000016741477105376400210410ustar00rootroot00000000000000# Testing workflow for CI developments, reacts to push of branch 'devel-ci' name: Testing CI build run-name: Testing CI on: push: branches: - devel-ci jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: uname -a - run: sudo modprobe btrfs - run: cat /proc/filesystems - run: gcc --version - run: df -HT - run: sudo apt-get update -qqq - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev - name: Configure run: ./autogen.sh && ./configure - name: Make run: make V=1 - name: Musl build run: sudo docker run kdave/ci-musl-x86_64 ./test-build $GITHUB_REF_NAME --disable-documentation --disable-backtrace --disable-libudev - name: Tests cli run: echo sudo make TEST_LOG=dump test-cli btrfs-progs-6.14/.gitignore000066400000000000000000000022721477105376400157250ustar00rootroot00000000000000*.o *.static.o *.o.d /.cc-defines.h /libbtrfs/version.h /btrfs /btrfs.static /btrfs-map-logical /btrfs-map-logical.static /btrfsck /mkfs.btrfs /mkfs.btrfs.static /btrfs-convert /btrfs-convert.static /btrfs-find-root /btrfs-find-root.static /btrfs-image /btrfs-image.static /btrfs-corrupt-block /btrfs-corrupt-block.static /btrfs-select-super /btrfs-select-super.static /btrfs-crc /btrfstune /btrfstune.static /btrfs-sb-mod /mktables /libbtrfs.a /libbtrfs.so* /library-test /library-test-static /libbtrfsutil.so* /libbtrfsutil.a /libbtrfsutil/libbtrfsutil.pc /fsstress /fssum /testsuite-id /tests/*-tests-results.txt /tests/test-console.txt /tests/test.img /tests/mnt/ *.restored /ioctl-test /send-test /quick-test /json-formatter-test /hash-speedtest /aclocal.m4 /autom4te.cache /config.cache /include/config.h /include/config.h.in /include/config.h.in~ /config/config.guess /config/config.sub /config/install-sh /config.log /config.status /configure /Makefile.inc /tags /TAGS /cscope.out /cscope.files /cscope.in.out /cscope.po.out .* !.editorconfig !.github !.readthedocs.yaml !.codespellrc /ci/images/*/devel.tar.gz /Documentation/Makefile /Documentation/_build /Documentation/contents.rst *.patch btrfs-progs-6.14/.readthedocs.yaml000066400000000000000000000002661477105376400171650ustar00rootroot00000000000000version: 2 build: os: ubuntu-22.04 tools: python: "3.12" sphinx: configuration: Documentation/conf.py python: install: - requirements: Documentation/requirements.txt btrfs-progs-6.14/64-btrfs-dm.rules000066400000000000000000000006031477105376400167520ustar00rootroot00000000000000SUBSYSTEM!="block", GOTO="btrfs_end" KERNEL!="dm-[0-9]*", GOTO="btrfs_end" ACTION!="add|change", GOTO="btrfs_end" ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end" # Once the device mapper symlink is created, tell btrfs about it # so we get the friendly name in /proc/mounts (and tools that read it) ENV{DM_NAME}=="?*", RUN{builtin}+="btrfs ready /dev/mapper/$env{DM_NAME}" LABEL="btrfs_end" btrfs-progs-6.14/64-btrfs-zoned.rules000066400000000000000000000005321477105376400174720ustar00rootroot00000000000000SUBSYSTEM!="block", GOTO="btrfs_end" ACTION!="add|change", GOTO="btrfs_end" ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end" # Zoned btrfs needs an IO scheduler that supports zone write locking and # currently mq-deadline is the only scheduler capable of this. ATTR{queue/zoned}=="host-managed", ATTR{queue/scheduler}="mq-deadline" LABEL="btrfs_end" btrfs-progs-6.14/CHANGES000066400000000000000000002522571477105376400147420ustar00rootroot00000000000000btrfs-progs-6.13 (2025-03-26) ----------------------------- * mkfs: * allow --sectorsize to be 2K for testing purposes of subpage mode (needs the same block size supported by kernel) * fix false error when no compression is requested and lzo is not compiled in * convert: support 2K block size in the source filesystem * defrag: new parameter -L/--level to specify compression levels (kernel 6.15), also supports the realtime levels * subvol delete: show names of recursively deleted child subvolumes * qgroup show: use sysfs to detect up to date consistency status * zoned mode: support zone capacity tracking * other: * CI new and updated workflows * documentation updates btrfs-progs-6.13 (2025-02-15) ----------------------------- * mkfs: * new option to enable compression * updated summary (subvolumes, compression) * completely remove option --leafsize, deprecated long ago * btrfstune: add option to remove squota * scrub: * start: new option --limit to set the bandwidth limit for the duration of the run * status: fix printing of Rate unit suffix (SI/IEC) * qgroup clean-stale: check if quotas are enabled before starting filesystem sync() * print builtin features and options in --version output (mkfs, convert, image, btrfstune) * build: * Botan minimum version is now 3.x * target to build compile_commands.json (for LSP) * other: * a bit more optimized crc32c code * sync some headers from kernel code * command help updates and fixes * build warning fixes * error message updates * cleanups and refactoring * updated tests * lots of documentation updates btrfs-progs-6.12 (2024-11-29) ----------------------------- * subvolume delete: add new option to do recursive subvolume deletion (for regular user delete only accessible subvolumes) * mkfs: * new option --subvol to create subvolumes in given paths, read-write, read-only and default * add hard link detection support for --rootdir option * fixes: * receive: message verbosity fixes * check: fix false positive report of missing checksum for extent holes * check: handle compressed extents when checking tree log * when asking Y/N user questions, flush the terminal so the question is displayed (e.g. btrfstune -S) * other * code refactoring, error handling * python packaging fixes * documentation updates * new tests btrfs-progs-6.11 (2024-09-17) ----------------------------- * check: * check items in tree-log * detect invalid file extent items for symlinks * properly detect inode cache and suggest removal by 'clear-ino-cache' * convert: fix symlink length checks * fi show: remove stray newline at the end of the output * fixes: * open devices in write-exclusive mode in most commands, prevent concurrent mount by other programs * rescue clear-ino-cache: fix subvolume iteration that can fail in some cases * map-logical: fix first extent searching condition * fi resize: warn if new size is below 256M * tree-checker: * slightly stricter file type validation * verify device extent items * other: * documentation updates * ship btrfs-ioctl manual page (incomplete) btrfs-progs-6.10 (2024-07-30) ----------------------------- * inspect: * list-chunks: new command to print information about chunks (i.e. the physical chunks as stored on devices), sortable; requires root as it's using SEARCH_TREE ioctl * tree-stats: * new option -t to print only the given tree * add long options for size units * filesystem df: with increased verbosity print per-type information from sysfs * version: print a line with built-in features or options (+FEATURE1 -FEATURE2) * image: document option -s and its potential problems * fixes: * scrub status: user selected base for Rate values * receive: escape special characters in paths and xattrs * dump-tree: escape special characters in paths and xattrs * image: sanitizing filenames did not work properly in all cases * convert: fix displayed restored image path on rollback * tune change csum: do conversion in smaller batches * other: * CI workflows updates (sanitizers, code spelling, manual page preview) * build fixes for uClibc * build fix for python 3.13 * documentation updates btrfs-progs-6.10.1 (2024-08-15) """"""""""""""""""""""""""""""" * mkfs: rework --rootdir traversal, skip hardlinks and create new inodes instead, also warn about them, this did not work as expected and will be fixed in the future * receive: search in older trees for UUIDs when detecting clone sources * libbtrfsutil: bindings available at https://pypi.org/project/btrfsutil * libbtrfs: * patchlevel version update 0.1.4 * cleanup in headers, removed unused definitions, no functional changes * don't ship list.h and rbtree.h * other: * documentation updates btrfs-progs-6.9 (2024-06-07) ---------------------------- * mkfs: * if --force used, don't continue if the mount status cannot be determined (e.g. due to permissions) * fix minimum size calculation on zoned devices, make it work with option -b * check: * option --clear-ino-cache removed (functionality still provided in 'rescue' command group) * detect and repair wrong file extent item ram_bytes value * qgroup clear-stale: * sync the filesystem before search to read the up to date state * handle cases where qgroup cannot be deleted due to uncleaned subvolume or when squota is enabled * qgroup show: display status of qgroup regarding the cleaning of the subvolume or if it's squota * receive: fix stream parsing on strict alignment hosts (e.g. ARM v5 or v6) * tune change-csum: fix check of dev-replace status item, continue if no dev-replace in progress * dump-tree: print contents of dev-replace status item * convert: fix extent iteration to handle prealloc/unwritten extents * libbtrfsutil: * patchlevel version update 1.3.1 * fix potentially unaligned access to send stream * create library links to all version levels * libbtrfs: * patchlevel version update 0.1.3 * fix potentially unaligned access to send stream * create library links to all version levels * build: * fix compatibility with e2fsprogs 1.47.1 * fix header file dependency tracking * -O2 by default * other: * new and updated tests * ASAN and UBSAN test coverage in CI * documentation updates btrfs-progs-6.9.1 (2024-06-24) """""""""""""""""""""""""""""" * fix detection of intermediate super block flags (e.g. csum change and other conversions) * raid-stripe-tree support (still experimental): * moved under experimental build flags (mkfs, convert) * format change, removed encoding type; backward incompatible * receive dump: escape special chars in xattr names and values, and clone source path * tune change csum: fix reservation size when starting a transaction * other: * new and updated tests * updated CI images, new reference build targets * cleanups and refactoring btrfs-progs-6.9.2 (2024-06-27) """""""""""""""""""""""""""""" * subvol list: fix accidental trimming of subvolume name * check: revert checking file extent item 'ram_bytes' * libbtrfsutil: * patchlevel version update 1.3.2 * fix accidentally closing fd passed to subvolume iterator btrfs-progs-6.8 (2024-03-26) ---------------------------- * fix --enqueue option timeout handling * subvolume: remove support for undocumented options -c and -x, functionality disabled in kernel * libbtrfsutil: * version 0.1.3, backward compatible * add aliases for all existing functions with unified naming scheme * updated header definitions for recently added kernel features * send: v3 supported in experimental mode * other: * docs: manual page references, graphs, enhancements, clarifications * error handling fixes * cleanups and refactoring btrfs-progs-6.8.1 (2024-05-02) """""""""""""""""""""""""""""" * mkfs: fix writing on zoned device when block-group-tree is selected * tune: fix writing on zoned device with option --convert-to-block-group-tree * check: * more progress and error messages * unify handling of unknown command line options with other commands * subvolume delete: remove options --delete-qgroup and --no-delete-qgroup (added in 6.6.3), qgroup deletion does not always work due to delayed background processing of subvolume or set value in sysfs:ggroup/drop_subtree_threshold * other: * misc refactoring * error handling fixes reported by gcc -fanalyzer * documentation updates * new and updated tests btrfs-progs-6.7 (2024-01-22) ---------------------------- * mkfs: make 4k sectorsize default, recommended minimum kernel for that is 6.1 and requires subpage support on architectures with page size > 4k * subvolume create: return correct error code when a target already exists * tree-checker: dump tree block on error (btrfs-convert, ...) * scrub limit: fix reporting of a limit set while there's none * fi usage: fix reporting of unallocated data or raid56 profile without root privs due to lack of that information * convert: * align data block group lengths to 64K * fix conversion of a large filesystem when there are partial inode items present due to caching * other: * build fixes * updated documentation * new and updated tests btrfs-progs-6.7.1 (2024-02-14) """""""""""""""""""""""""""""" * convert: raid-stripe-tree can be now enabled for the target filesystem * mkfs: * handle lifetime of open file descriptors so it does not trigger udev that could miss to create the UUID symlinks in /dev * update warning when CPU page size does not match sector size * merge features in summary, no more distinction of incompat and runtime to match the semantics of option -O * fi show: fix recognizing raw device mapper paths * other: * CI updates, build images updates * minor cleanups * minor sync with kernel * documentation updates, fix links to labels in included directories btrfs-progs-6.6 (2023-11-03) ---------------------------- * new global option --dry-run, now implemented for 'subvolume delete' * fi defrag: new option --step to defragment files in steps, report progress * balance: removed support for obsolete short syntax 'btrfs balance /path' * mkfs: print zone count for each device in the overview * check: * verify inline ref ordering * deprecate --clear-space-cache, moved to the 'rescue' group * rescue clear-space-cache: new command moved from 'btrfs check' implementing the same as option --clear-space-cache (to be deprecated and removed in the future) * dump-tree: output sequence number for inline refs * fixes: * fi resize: fallback to lowest devid when 1 does not exist, previously the command would fail with "No such device" * fi usage: fix "devices 0 != 1" message and broken output on multi-device filesystem * open files in non-blocking mode when reading fsid, this could hang when trying to open fifo files or some special character devices, was observed with 'prop set/get' * experimental: * mkfs: parametric zone size for emulated zoned mode * other: * cleanups refactoring * new and updated tests * CI updates * documentation updates btrfs-progs-6.6.1 (2023-11-05) """""""""""""""""""""""""""""" * fix device scanning ioctl definition, accidental change to the 'forget' ioctl that breaks mounting multi-device filesystems btrfs-progs-6.6.2 (2023-11-15) """""""""""""""""""""""""""""" * squota: change key number of EXTENT_OWNER_REF_KEY, sync with kernel 6.7-rc1 * property set/get: completely skip char devices, trying to set properties and open /dev/watchdog* causes a reboot * other: build warnings, test updates, documentation updates btrfs-progs-6.6.3 (2023-12-14) """""""""""""""""""""""""""""" * subvol create: accept multiple arguments * subvol delete: print the subvolume id in the output * subvol sync: check if the filesystems is still writeable so it does not wait indefinitely * device delete: add a timeout and warning when deleting multiple devices * scrub status: report limit if set in sysfs/../scrub_speed_max * scrub limit: new command to show or set the per-device scrub limits * scrub start: report the limit if set * build: * fix CPU feature detection on aarch64 * support Botan and OpenSSL (3.2+) as crypto backends * other: * documentation updates, RTD config update * new and updated tests * CI updates btrfs-progs-6.5 (2023-09-01) ---------------------------- * crc32c implementation speedup (3x) * btrfstune: * be more strict about option combinations and refuse changing features from incompatible groups * metadata_uuid changes fixes * libbtrfs: fix ABI breakage introduced in 6.3.1, revert struct subvol_info and subvol_uuid_search changes * CI updates * pull request build tests enabled * published static binaries built with backward compatibility (-march=x86-64) * other * documentation updates * new and updated tests * experimental feature updates (json, list-chunks, checksum switch) * code refactoring * remove btrfs-fragments btrfs-progs-6.5.1 (2023-09-13) """""""""""""""""""""""""""""" * build fixes: * crc32c if PIE or relro is enabled * detect if PCLMUL feature is recognized by compiler and also detect that at runtime * check: verify metadata item level when skinny-metadata is enabled * other: minor build and docs updates btrfs-progs-6.5.2 (2023-10-03) """""""""""""""""""""""""""""" * new feature support: * raid-stripe-tree, new tree to track extent mapping for raid profiles, allows raid1*, raid0 and raid10 on zoned devices (kernel 6.7) * simple quotas, simplified accounting that does not track exclusive and shared extents (kernel 6.7) * mkfs with duplicate UUID on a single device, temp-fsid (kernel 6.7) * metadata_uuid: enhanced capabilities to repair partially updated fsid on multiple devices * other: * updated tests and CI * sync sources with kernel btrfs-progs-6.5.3 (2023-10-21) """""""""""""""""""""""""""""" * mkfs: * add short aliases for -O specification, block-group-tree (bgt), free-space-tree (fst), raid-stripe-tree (rst) * don't try to resize the image (namely when backed by file) when --rootdir contains sparse file larger than the image * also copy xattr/permissions/ugid/timestamps of the top --rootdir directory * add new option --device-uuid to let user specify exact uuid of the device item (only for single device filesystems) * check: * on zoned devices, use correct super block offsets when repairing * check inline extent refs order * subvolume create: add new option --parent to create missing path components of the given path (like mkdir -p) * rescue clear-ino-cache: new command moved from 'btrfs check' implementing the same as option --clear-ino-cache (to be deprecated and removed in the future) * dump-tree: allow '-' in tree identifier names for option -t * btrfstune: * drop short option and add long option to enable squota * tune space reservation and batch size for block-group-tree conversion * scrub status: print correct value of "Bytes scrubbed" for unfinished runs * qgroup show: fix crash when attempting to print path of stale qgroups * experimental features: * move build of raid-stripe-tree out for testing but it's still considered experimental * other: * shell completion updates * sync raid-stripe-tree code with kernel * build fixes * new and updated tests btrfs-progs-6.4 (skipped) ------------------------- btrfs-progs-6.3 (2023-04-27) ---------------------------- * mkfs: option -R deprecated, options unified in -O (-R still works) * mkfs: fix potential race with udev leading to EBUSY due to repeatedly opened file descriptors * block-group-tree is out of experimental mode * available as 'mkfs.btrfs -O block-group-tree' * btrfstune can do in-place conversion to/from (use with care) * balance: fix recognizing old and new syntax * subvol snapshot: specific error if a failure is caused by an active swapfile * tree-stats: rephrase warning when run on a mounted filesystem * completion: 'filesystem du' also completes files * check: fix docs, help text and warning that --force + --repair works on a mounted filesystem * build: fix static build when static libudev is available * documentation: * more updates from wiki, developer docs, changelogs * reformatting * updates and fixes * other: * test updates and fixes * CI cleanups and old files removed * integration with Github actions btrfs-progs-6.3.1 (2023-05-29) """""""""""""""""""""""""""""" * convert: fix checksum of a block relocated from 0-1M range * qgroup show: fix formatting of limit values in json output * receive: report parent subvol UUID on errors * btrfstune: new option --convert-to-free-space-tree to convert from block-group-tree back to extent tree for block group tracking * mkfs: make option --rootdir more verbose and report start when filling from the given directory starts * experimental: * btrfstune: checksum switch logic reimplemented, conversion of all metadata and data now works, resume from various states also supported * other: * more CI github actions test coverage * more kernel/userspace source code sync * warning fixes * code cleanups * documentation updates btrfs-progs-6.3.2 (2023-06-15) """""""""""""""""""""""""""""" * fix mkfs and others on big endian hosts * mkfs: don't print changed defaults notice with --quiet * scrub: fix wrong stats of processed bytes in background and foreground mode * convert: actually create free-space-tree instead of v1 space cache * print-tree: recognize and print CHANGING_FSID_V2 flag (for the metadata_uuid change in progress) * other: documentation updates btrfs-progs-6.3.3 (2023-07-27) """""""""""""""""""""""""""""" * add btrfs-find-root to btrfs.box * replace: properly enqueue if there's another replace running * other: * CI updates, more tests enabled, code coverage, badges * documentation updates * build warning fixes btrfs-progs-6.2 (2023-02-28) ---------------------------- * receive: fix a corruption when decompressing zstd extents * subvol sync: print total number and deletion progress * accelerated hash algorithm implementations in fallback mode on x86_64 * fi mkswapfile: new option --uuid * new global option --log=level to set the verbosity level directly * other: * experimental: update checksum conversion (not usable yet) * build actually requires -std=gnu11 * refactor help option formatting, auto wrap long lines btrfs-progs-6.2.1 (2023-02-03) """""""""""""""""""""""""""""" * fix build with crypto libraries * CI images updated, build tests extended btrfs-progs-6.2.2 (2023-03-25) """""""""""""""""""""""""""""" * fix build on old x86 architectures with builtin crypto * device stats: fix printing wrong values in tabular output * qgroup show: fix qgroup id formatting in json output * restore: fix restoring xattrs on directories * restore: don't modify metadata in dry-run mode * balance: fix some cases wrongly parsed as old syntax * balance: warn when deprecated syntax is used * seeding: fall back to old way if sysfs device fsid is not available * convert: handle orphan file ext4 feature * other: * sync ioctl definitions * enable github CI * update documentation btrfs-progs-6.1 (2022-12-22) ---------------------------- * NOTE: this version breaks build of applications using ctree.h and qgroup items * filesystem df: add json output * qgroup show: add json output * new command: 'inspect-internal map-swapfile' to check swapfile and its swapfile_offset value used for hibernation * corrupt-block: fix parsing of option --root argument * experimental (interfaces not finalized): * new command 'inspect-internal list-chunks' * new group reflink, command clone * other: * synchronize some files with kernel versions * docs updates * build: use gnu11 btrfs-progs-6.1.1 (2023-01-03) """""""""""""""""""""""""""""" * subvol list: fix printing of UUID * revert changes to ctree.h regarding qgroup items, breaks build of several applications * hide __init definition in kerncompat.h, may break build btrfs-progs-6.1.2 (2023-01-05) """""""""""""""""""""""""""""" * revert libbtrfs changes to v6.0.2, fix remaining build problems btrfs-progs-6.1.3 (2023-01-25) """""""""""""""""""""""""""""" * fi mkswapfile: fix setting size * mkfs: check zoned support of libblkid * check: improve error messages for mismatched references * other: * pass CFLAGS to static build * documentation updates btrfs-progs-6.0 (2022-10-11) ---------------------------- * fi usage: in tabular output, print total size and slack size * mkfs: * option -O now accepts values from -R to unify the interface (-R will continue to work) * zone reset and discard is done in parallel on all devices * removed option --leafsize, deprecated long time ago * corrupt-block: recalculate checksum when changing generation * fixes: * convert: fix reserved range detection and overlaps * mkfs: fix creating files with reserved inode numbers with --rootdir * receive: escape filenames in command attributes * fix extent buffer leaks after transaction abort * experimental: * mkfs: support for block-group-tree (kernel 6.1) * fsverity in send (protocol v3, WIP) * btrfstune -b converts to block-group-tree * other: * cleanups, refactoring * new and updated tests * update documentation btrfs-progs-6.0.1 (2022-11-04) """""""""""""""""""""""""""""" * send: minor speed up for v2 due to increased buffer size * resize: invalid command line options fail with error code * quota rescan: * add long options --status and --wait * new option to wait but don't start rescan * qgroup show: print path by default, updated format * qgroup: new subcommand clear-stale, remove qgroups without their subvolumes * experimental: * add warnings to commands that have it enabled (mkfs, image, btrfstune) * other: * documentation, help text, error message updates btrfs-progs-6.0.2 (2022-11-24) """""""""""""""""""""""""""""" * fixes: * resize cancel did not work in some cases * fix fileattr stream command format and add workaround when it cannot be applied * properly handle degraded raid56 reads * fi defrag: fix verbosity, don't print file names by default * receive: fix silent data loss after fall back from encoded write * fi mkswapfile: new command to create a formatted swapfile in one go btrfs-progs-5.19 (2022-08-16) ----------------------------- * send: support protocol version 2 * fi show: print all missing devices * device stats: add tabular output * replace: add alias to device group (device replace) * check: validate free space tree items * fixes: * convert: support large filesystems (block count > 32bit) * recognize filesystems with verity enabled * mkfs and DUP could write out of order, fix it for zoned mode * build: * optional support for LZO and ZSTD in receive * compatibility with glibc 2.36 (mount.h) * add fallbacks for new GCC builtins * other: * corrupt-block: target specific items, offsets * documentation updates, new pages from wiki * new tests btrfs-progs-5.19.1 (2022-09-12) """"""""""""""""""""""""""""""" * fix memory leaks (extent buffer, path) * check: verify block device size vs item * rescue fix-device-size: allow to shrink device item * receive: fix crash on wrong pointer free() * other: * experimental: support for block-group-tree * documentation updates * new tests btrfs-progs-5.18 (2022-05-25) ----------------------------- * fixes: * dump-tree: don't print trailing zeros in checksums * recognize paused balance as exclusive operation state, allow to start device add * convert: properly initialize target filesystem label * mkfs: don't create free space bitmaps for empty filesystem * restore: make lzo support build-time configurable, print supported compression in help text * update kernel-lib sources * other: * documentation updates, finish conversion to RST, CHANGES and INSTALL could be included into RST * fix build detection of experimental mode * new tests btrfs-progs-5.18.1 (2022-06-06) """"""""""""""""""""""""""""""" * fixes: * convert: fix self reference of toplevel directory * build: make kernel lib headers compatible with C++ * zoned mode: verify minimum zone size 4MiB * libbtrfs: cleanups, merge headers and remove declarations of unexported symbols * other: documentation updates btrfs-progs-5.17 (2022-04-26) ----------------------------- * check: * repair wrong num_devices in superblock * recognize overly long xattr names * fix wrong total bytes check for seed device * auto-repair on read on RAID56 * property set: unify handling of empty value to mean default, changed meaning for property 'compression' to allow reset to default and to set NOCOMPRESS, since kernel 5.14 * fixes: * dump-tree: print fs-verity items * fix location of system chunk on zoned filesystem * do not allow setting seeding flag on a filesystem with dirty log * mkfs and subpage support: use sectorsize as nodesize fallback for mixed profiles * preparatory work for extent tree v2, global roots * experimental feature (unstable interface, not built by default, do not use for production) * btrfstune: option --csum to switch checksum algorithm * other: * cleanups, refactoring * update documentation build, remove asciidoc leftovers * update fssum to consider xattrs * add fsstress btrfs-progs-5.16 (2022-01-12) ----------------------------- * rescue: new subcommand clear-uuid-tree to fix failed mount due to bad uuid subvolume keys, caught by tree-checker * fi du: skip inaccessible files * prop: properly resolve to symlink targets * send, receive: fix crash after parent subvolume lookup errors * build: * fix build on 5.12+ kernels due to changes in linux/kernel.h * fix build on musl with old kernel headers * other: * error handling fixes, cleanups, refactoring * extent tree v2 preparatory work * lots of RST documentation updates (last release with asciidoc sources), https://btrfs.readthedocs.io btrfs-progs-5.16.1 (2022-02-04) """"""""""""""""""""""""""""""" * mkfs: support DUP on metadata on zoned devices * subvol delete: drop warning for root when search ioctl fails * check: * fix --init-csum-tree to not create checksums for extents that are not supposed to have them * add check for metadata item levels * add udev rule for zoned devices as they require mq-deadline * build: fix redefinition of ALIGN on mixed old/new kernel/userspace (5.11) * other: * typo fixes * new tests * CI targets updated btrfs-progs-5.16.2 (2022-02-16) """"""""""""""""""""""""""""""" * mkfs: fix detection of profile type for zoned mode when creating DUP * build: * add missing stub for zoned mode helper when zoned mode not enabled * fix 64bit types on MIPS and PowerPC * improved zoned mode support autodetection, for systems with existing blkzone.h header but missing support for zone capacity * other: * doc updates * test updates btrfs-progs-5.15 (2021-11-05) ----------------------------- * mkfs: new defaults! * no-holes * free-space-tree * DUP for metadata unconditionally * libbtrfsutil * add missing profile defines * libbtrfs * minimize its impact on the other code, refactor and separate implementation where needed, cleanup afterwards, reduced header exports * documentation * introduce sphinx build and RST versions of manual pages, will become the new format and replace asciidoc * fixes: * fix warning regarding v1 space cache when only v2 (free space tree) is enabled * other * lots of cleanups and refactoring * zoned mode uses direct io for file backed images * new and updated tests btrfs-progs-5.15.1 (2021-11-22) """"""""""""""""""""""""""""""" * fixes: * fi usage: fix wrongly reported space of used or unallocated space * fix detection of block device discard capability * check: add more sanity checks for checksum items * build: make sphinx optional backend for documentation btrfs-progs-5.14 (2021-09-10) ----------------------------- * convert: * new option --uuid to copy, generate or set a given uuid * improve output * mkfs: * allow to create degenerate raid0 (on 1 device) and raid10 (on 2 devices) * image: * improved error messages * fix some alignment of restored image * subvol delete: allow to delete by id when path is not resolvable * check: * require alignment of nodesize for 64k page systems * detect and fix invalid block groups * libbtrfs (deprecated): * remove most exported symbols, leave only a few that are used by snapper * no version change (still 0.1) * remove btrfs-list.h, btrfsck.h * fixes: * reset generation of space v1 if v2 is used * fi us: don't wrongly report missing device size when partition is not readable * other: * build: experimental features * build: better detection of 64bit timestamp support for ext4 * corrupt-block: block group items * new and updated tests * refactoring * experimental features: * new image dump format, with data btrfs-progs-5.14.1 (2021-09-20) """"""""""""""""""""""""""""""" * fixes: * defrag: fix parsing of compression (option -c) * add workaround for old kernels when reading zone sizes * let only check and restore open the fs with transid failures, namely preventing btrfstune to do so * convert: --uuid copy does not fail on duplicate uuids btrfs-progs-5.14.2 (2021-10-08) """"""""""""""""""""""""""""""" * fixes * zoned mode * properly detect non-zoned devices in emulation mode * properly create quota tree * raid1c3/4 also excluded from unsupported profiles * use sysfs-based detection of device discard capability, fix mkfs-time trim for non-standard devices * mkfs: fix creation of populated filesystem with free space tree * detect multipath devices (needs libudev) * replace start: add option -K/--nodiscard, similar to what mkfs or device add has * dump-tree: print complete root_item * mkfs: add option --verbose * sb-mod: better help, no checksum calculation on read-only actions * subvol show: * print more information (regarding send and receive) * print warning if read-write subvolume has received_uuid set * property set: * add parameter -f to force changes * changing ro->rw switch now needs -f if subvolume has received_uuid set, (see documentation) * build * optional libudev (on by default) * other * remove deprecated support for CREATE_ASYNC bit for subvolume ioctl * CI updates * new and updated tests btrfs-progs-5.13 (2021-07-13) ----------------------------- * restore: remove loop checks for extent count and directory scan * inspect dump-tree: new options to print node (--csum-headers) and data checksums (--csum-items) * fi usage: * print stripe count for striped profiles * print zoned information: size, total unusable * mkfs: print note about sha256 accelerated module loading issue * check: ability to reset dev_item::bytes_used * fixes * detect zoned kernel support at run time too * exclusive op running check return value * fi resize: support cancel (kernel 5.14) * device remove: support cancel (kernel 5.14) * documentation about general topics * compression * zoned mode * storage model * hardware considerations * other * libbtrfsutil API overview * help text fixes and updates * hash speedtest measure time, cycles using perf and print throughput btrfs-progs-5.13.1 (2021-07-30) """"""""""""""""""""""""""""""" * build: fix build on musl libc due to missing definition of NAME_MAX * check: * batch more work into one transaction when clearing v1 free space inodes * detect directories with wrong number of links * libbtrfsutil: fix race between subvolume iterator and deletion * mkfs: be more specific about supported profiles for zoned device * other: * documentation updates btrfs-progs-5.12 (2021-05-10) ----------------------------- * libbtrfsutil: relicensed to LGPL v2.1+ * mkfs: zoned mode support (kernel 5.12+) * fi df: show zone_unusable per profile type in zoned mode * fi usage: show total amount of zone_unusable * fi resize: fix message for exact size * image: fix warning and enlarge output file if necessary * core * refactor chunk allocator for more modes * implement zoned mode support: allocation and writes, sb log * crypto/hash refactoring and cleanups * refactoring and cleanups * other * test updates * CI updates * travis-ci integration disabled * docker images updated, more coverage * incomplete build support for Android removed * doc updates * chattr mode m for 'NOCOMPRESS" * swapfile used from fstab * how to add a new export to libbtrfsutil * update status of mount options since 5.9 btrfs-progs-5.12.1 (2021-05-13) """"""""""""""""""""""""""""""" * build: fix missing symbols in libbtrfs * mkfs: check for minimal number of zones * check: fix warning about cache generation when free space tree is enabled * fix superblock write in zoned mode on 16K pages btrfs-progs-5.11 (2021-03-05) ----------------------------- * fix device path canonicalization for device mapper devices * receive: remove workaround for setting capabilities, all stable kernels have been patched * receive: fix duplicate mount path detection * rescue: new subcommand create-control-device * device stats: minor fix for plain text format output * build: detect if e2fsprogs support 64bit timestamps * build: drop libmount, required functionality has been reimplemented * mkfs: warn when raid56 is used * balance convert: warn when raid56 is used * other * new and updated tests * documentation updates * seeding device * raid56 status * CI updates * docker images for various distros btrfs-progs-5.11.1 (2021-03-24) """"""""""""""""""""""""""""""" * properly format checksums when a mismatch is reported * check: fix false alert on tree block crossing 64K page boundary * convert: * refuse to convert filesystem with 'needs_recovery' * update documentation to require fsck before conversion * balance convert: fix raid56 warning when converting other profiles * fi resize: improved summary * other * build: fix checks and autoconf defines * fix symlink paths for CI support scripts * updated tests btrfs-progs-5.10 (2021-01-18) ----------------------------- * scrub status: * print percentage of progress * add size unit options * fi usage: also print free space from statfs * convert: copy full 64 bit timestamp from ext4 if available * check: * add ability to repair extent item generation * new option to remove leftovers from inode number cache (-o inode_cache) * check for already running exclusive operation (balance, device add/...) when starting one * preliminary json output support for 'device stats' * fixes: * subvolume set-default: id 0 correctly falls back to toplevel * receive: align internal buffer to allow fast CRC calculation * logical-resolve: distinguish -o subvol and bind mounts * build: new dependency libmount * other * doc fixes and updates * new tests * ci on gitlab temporarily disabled * debugging output enhancements btrfs-progs-5.10.1 (2021-02-05) """"""""""""""""""""""""""""""" * static build works again * other: * add a way to test static binaries with the testsuite * clarify scrub docs * update dependencies, minimum version for libmount is 2.24, this may change in the future btrfs-progs-5.9 (2020-10-23) ---------------------------- * mkfs: * switch default to single profile for multi-device filesystem, up to now it was raid0 that may not be simple to convert to some other profile as raid0 needs a workspace on all device for that * new option -R for run-time options (eg. mount time enabled), now understands free-space-tree * subvolume delete: * refuse to delete the default subvolume (kernel will not allow that but the error reason is not obvious) * warn on EPERM, eg. if send is on progress on the subvolume * convert: * fix 32bit overflows on large filesystems * improved error handling and error messages * check free space taking fragmentation into account * check: * detect and repair wrong inode generation * minor improvement in error reporting on roots * libbtrfsutils: follow main package versioning (5.9) * add pkg-config file definitions * python-btrfsutil: follow main package versioning (5.9) * inspect tree-stats: print node counts for each level, fanout * other: * docs: * remove obsolete mount options (alloc_start, subvolrootid) * deleting default subvolume is not permitted * updated or fixed tests * .editorconfig updates * move files to kernel-shared/ * CI: * updated to use zstd 1.4.5 * fix reiserfs build * more builds with asan, ubsan * sb-mod updates * build: * print .so versions of libraries in configure summary btrfs-progs-5.8 (skipped) ------------------------- btrfs-progs-5.7 (2020-07-02) ---------------------------- * mkfs: * new option to enable features otherwise enabled at runtime, now implemented for quotas, 'mkfs.btrfs -R quota' * fix space accounting for small image, DUP and --rootdir * option -A removed * check: detect ranges with overlapping csum items * fi usage: report correct numbers when plain RAID56 profiles are used * convert: ensure the data chunks size never exceed device size * libbtrfsutil: update documentation regarding subvolume deletion * build: support libkcapi as implementation backend for cryptographic primitives * core: global options for verbosity (-v, -q), subcommands -v or -q are aliases and will continue to work but are considered deprecated, current command output is preserved to keep scripts working * other: * block group code cleanups * build warning fixes * more files moved to kernel-shared * btrfs-debugfs ported to python 3 * documentation updates * new tests btrfs-progs-5.6 (2020-04-05) ---------------------------- * inspect logical-resolve: support LOGICAL_INO_V2 as new option '-o', helps advanced dedupe tools * inspect: user larger buffer (64K) for results * subvol delete: support deletion by id (requires kernel 5.7+) * libbtrfsutil: * support subvolume deletion by id * bump version to 1.2 * library symbols are now versioned * dump-tree: new option --hide-names, replace any names (file, directory, subvolume, xattr) in the output with stubs * convert: warn if the filesystem is not mountable on the machine * fixes: * restore: proper mirror iteration on decompression error * restore: make symlink messages less noisy * check: handle holes at the beginning or end of file * fix xxhash output on big endian machines * receive: fix lookup of subvolume by uuid in case it was already received before * other: * new and updated tests * add missing binaries in exported testsuite * docs updates * remove obsolete files * move files to more appropriate directories * fixes reported by valgrind * many typos fixed btrfs-progs-5.6.1 (2020-05-07) """""""""""""""""""""""""""""" * print warning when multiple block group profiles exist, update 'fi usage' summary, add docs to manual page explaining the situation * build: optional support for libgcrypt or libsodium, providing hash implementations * other: * fixed, updated and new tests * cleanups * updated docs btrfs-progs-5.5 (skipped) ------------------------- btrfs-progs-5.4 (2019-12-03) ---------------------------- * support new hash algorithms (kernel 5.5): * mkfs.btrfs and btrfs-convert with --csum, crc32c, xxhash, sha256, blake2 * mkfs: support new raid1c3 and raid1c4 block group profiles (kernel 5.5) * check: * --repair delays start with a warning, can be skipped using --force * enhanced detection of inode types from partial data, more options for repair * receive: fix quiet option * image: speed up chunk loading * fi usage: * sort devices by id * print ratio of used/total per block group type * rescue zero-log: reset the log pointers directly, avoid reading some other potentially damaged structures * new make target install-static to install only static binaries/libraries * other * docs updates * new tests * cleanups and refactoring btrfs-progs-5.4.1 (2020-01-09) """""""""""""""""""""""""""""" * build: fix docbook5 build * check: do extra verification of extent items, inode items and chunks * qgroup: return ENOTCONN if quotas not running (needs updated kernel) * other: various test fixups btrfs-progs-5.3 (2019-10-21) ---------------------------- * mkfs: * new option to specify checksum algorithm (only crc32c) * fix xattr enumeration * dump-tree: BFS (breadth-first) traversal now default * libbtrfsutil: remove stale BTRFS_DEV_REPLACE_ITEM_STATE_x defines * ci: add support for gitlab * other: * preparatory work for more checksum algorithms * docs update * switch to docbook5 backend for asciidoc * fix build on uClibc due to missing backtrace() * lots of printf format fixups btrfs-progs-5.3.1 (2019-10-25) """""""""""""""""""""""""""""" * libbtrfs: fix link breakage due to missing symbols btrfs-progs-5.2 (2019-07-05) ---------------------------- * subvol show: print qgroup information when available * scrub: * status: show ETA, revamp the whole output * fix reading/writing of last position on resume/cancel, potentially skipping part of the filesystem on next resume * dump-tree: add new option --noscan to use only devices given on the command line * all-in-one binary (busybox style) with mkfs.btrfs, btrfs-image, btrfs-convert, btrfstune * image: fix hang when there are more than 32 cpus online and compression is requested * convert: fix some false ENOSPC errors when --rootdir is used * build: fix gcc9 warnings * core changes * command handling cleanups * dead code removal * cmds-* files moved to cmds/ * other shared userspace files moved to common/ * utils.c split into more files * preparatory work for more output formats * libbtrfsutil: fix unaligned access * other * new and updated tests * fix tests so CI passes again * sb-mod can modify more superblock items btrfs-progs-5.2.1 (2019-07-26) """""""""""""""""""""""""""""" * scrub status: fix ETA calculation after resume * check: fix crash when using -Q * restore: fix symlink owner restoration * mkfs: fix regression with mixed block groups * core: fix commit to process all delayed refs * other: * minor cleanups * test updates btrfs-progs-5.2.2 (2019-09-05) """""""""""""""""""""""""""""" * check: * fix false report of wrong byte count for orphan inodes * option -E was not handled correctly * new check and repair for root item generation * balance: check for full-balance before background fork * mkfs: check that total device size does not overflow 16EiB * dump-tree: print DEV_STATS key type * other: * new and updated tests * doc fixups and updates btrfs-progs-5.1 (2019-05-17) ---------------------------- * (version 5.0 skipped) * check: * repair: flush/FUA support to avoid breaking metadata COW * file extents repair no longer relies on data in extent tree * lowmem: fix false error reports about gaps between extents * add inode mode check and repair for various objects * add check for invalid combination of nocow/compressed extents * device scan: new option to forget scanned devices * mkfs: use same chunk size as kernel for initial creation * dev-replace: better report when other exclusive operation is running * help: for syntax errors on command line, print only the relevant messages, not the whole help text * receive: * new option for quiet mode * on -vv print information about written ranges * fix endless loop with --dump on an invalid stream * defrag: able open files in RO mode (needs kernel support to work) * dump-tree: --block can be specified multiple times * libbtrfsutil: fix: don't close fd on error in btrfs_util_subvolume_id_fd * core: * add sync before superblock write * better error handling on the transaction commit path * try to find best copy when reading tree blocks * update backup roots on commit transaction * other: * fuzz tests pass and are enabled in CI * cleanups * new tests btrfs-progs-5.1.1 (2019-06-11) """""""""""""""""""""""""""""" * convert and mkfs will try to use optimized crc32c * fi show: accept a file-backed image * fi show: fix possible crash when device is deleted in parallel * build: * support extra flags for python bindings * separate LDFLAGS for libbtrfsutil * other: * space reservation fixes or debugging improvements * V0 extent code removed * more tests and cleanups btrfs-progs-4.x (2019-02-25) ---------------------------- btrfs-progs-4.20 (2019-01-19) """"""""""""""""""""""""""""" * new feature: metadata uuid * lightweight change of UUID without rewriting all metadata (incompatible change) * done by btrfstune -m/-M * needs kernel support, 5.0+ * image: * fix block groups when restoring from multi-device image * only enlarge result image if it's a regular file * check * more device extent checks and fixes * can repair dir item with mismatched hash * mkfs: uuid tree created with proper contents * fix mount point detection due to partial prefix match * other: * new tests * libbtrfsutil: fix tests if kernel lacks support for new subvolume ioctls * build fixes * doc fixes btrfs-progs-4.20.1 (2019-01-23) * libbtrfs: fix build of external tools due to missing symbols * ci: enable library test btrfs-progs-4.20.2 (2019-02-25) * ci: use newer distro for builds * dump-super: minor output fixup * revert fix for prefix detection of receive path, this is temporary and unbreaks existing user setups btrfs-progs-4.19 (2018-11-03) """"""""""""""""""""""""""""" * check: support repair of fs with free-space-tree feature * core: * port delayed ref infrastructure from kernel * support write to free space tree * dump-tree: new options for BFS and DFS enumeration of b-trees * quota: rescan is now done automatically after 'assign' * btrfstune: incomplete fix to uuid change * subvol: fix 255 char limit checks * completion: complete block devices and now regular files too * docs: * ship uncompressed manual pages * btrfsck uses a manual page link instead of symlink * other * improved error handling * docs * new tests btrfs-progs-4.19.1 (2018-12-05) * build fixes * big-endian builds fail due to bswap helper clashes * 'swap' macro is too generic, renamed to prevent build failures * libbtrfs * minor version update to 1.1.0 * fix default search to top=0 as documented * rename 'async' to avoid future python binding problems * add support for unprivileged subvolume listing ioctls * added tests, API docs * other * lot of typos fixed * warning cleanups * doc formatting updates * CI tests against zstd 1.3.7 btrfs-progs-4.18 (skipped) """""""""""""""""""""""""" btrfs-progs-4.17 (2018-06-14) """"""""""""""""""""""""""""" * check * many lowmem mode improvements * properly report qgroup mismatch errors * check symlinks with append/immutable flags * fi usage * correctly calculate allocated/unallocated for raid10 * minor output updates * mkfs * detect ENOSPC on thinly provisioned devices * fix spurious EEXIST during directory traversal * restore: fix relative path for restore target * dump-tree: print symbolic tree names for backrefs * send: fix regression preventing send -p with subvolumes mounted on "/" * corrupt-tree: refactoring and command line updates * build * make it work with e2fsprogs < 1.42 again * restore support for autoconf 2.63 * detect if -std=gnu90 is supported * other * new tests * cleanups btrfs-progs-4.17.1 (2018-08-06) * check: * add ability to fix wrong ram_bytes for compressed inline files * beautify progress output * btrfstune: allow to continue uuid change after unclean interruption * several fuzz fixes: * detect overlapping chunks * chunk loading error handling * don't crash with unexpected root refs to extents * relax option parsing again to allow mixing options and non-options arguments * fix qgroup rescan status reporting * build: * drop obsolete dir-test * new configure option to disable building of tools * add compatibility options --disable-static and --disable-shared * other: * cleanups and preparatory work * new test images btrfs-progs-4.16 (2018-04-06) """"""""""""""""""""""""""""" * libbtrfsutil - new LGPL library to wrap userspace functionality * several 'btrfs' commands converted to use it: * properties * filesystem sync * subvolume set-default/get-default/delete/show/sync * python bindings, tests * build * use configured pkg-config path * CI: add python, musl/clang, built dependencies caching * convert: build fix for e2fsprogs 1.44+ * don't install library links with wrong permissions * fixes * prevent incorrect use of subvol_strip_mountpoint * dump-super: don't verify csum for unknown type * convert: fix inline extent creation condition * check: * lowmem: fix false alert for 'data extent backref lost for snapshot' * lowmem: fix false alert for orphan inode * lowmem: fix false alert for shared prealloc extents * mkfs: * add UUID and otime to root of FS_TREE - with the uuid, snapshots will be now linked to the toplevel subvol by the parent UUID * don't follow symlinks when calculating size * pre-create the UUID tree * fix --rootdir with selinux enabled * dump-tree: add option to print only children nodes of a given block * image: handle missing device for RAID1 * other * new tests * test script cleanups (quoting, helpers) * tool to edit superblocks * updated docs btrfs-progs-4.16.1 (2018-04-24) * remove obsolete tools: btrfs-debug-tree, btrfs-zero-log, btrfs-show-super, btrfs-calc-size * sb-mod: new debugging tool to edit superblock items * mkfs: detect if thin-provisioned device does not have enough space * check: don't try to verify checksums on metadata dump images * build: fail documentation build if xmlto is not found * build: fix build of btrfs.static btrfs-progs-4.15 (2018-02-01) """"""""""""""""""""""""""""" * mkfs --rootdir reworked, does not minimize the final image but can be still done using a new option --shrink * fix allocation of system chunk, don't allocate from the reserved area * other * new and updated tests * cleanups, refactoring * doc updates btrfs-progs-4.15.1 (2018-02-16) * build * fix build on musl * support asciidoctor for doc generation * cleanups * sync some code with kernel * check: move code to own directory, split to more files * tests * more build tests in travis * tests now pass with asan and ubsan * testsuite can be exported and used separately btrfs-progs-4.14 (2017-11-16) """"""""""""""""""""""""""""" * build: libzstd now required by default * check: more lowmem mode repair enhancements * subvol set-default: also accept path * prop set: compression accepts no/none, same as "" * filesystem usage: enable for filesystem on top of a seed device * rescue: new command fix-device-size * other * new tests * cleanups and refactoring * doc updates btrfs-progs-4.14.1 (2018-01-05) * dump-tree: print times of root items * check: fix several lowmem mode bugs * convert: fix rollback after balance * other * new and updated tests, enabled lowmem mode in CI * docs updates * fix travis CI build * build fixes * cleanups btrfs-progs-4.13 (2017-09-08) """"""""""""""""""""""""""""" * convert: reiserfs support * check: new option --force to allow check of a mounted filesystem (no repair) * mkfs: --rootdir will now copy special files * dump-tree: minor output changes * inspect rootid: accept file as argument * dev usage: don't calculate slack space for missing devices * fi du: don't print error on EMPTY_SUBVOL (inode number 2) * build: * fixed support for sanitization features on gcc (tsan, asan, ubsan) * fix PIE build * other: * misc cleanups and stability fixes * travis CI enhancements * new tests, fuzzed images * testsuite cleanups btrfs-progs-4.13.1 (2017-09-25) * image: speed up generating the sanitized names, do not generate unprintable chars * completion: add missing commands, better mount point detection * restore: add zstd support; libzstd detected automatically, will be requested by default in the future, or can be configured out * other: * misc fixes found by sparse * doc enhancements, ioctl manual page started * updated and new tests * build fixes btrfs-progs-4.13.2 (2017-10-06) * subvol list: * don't list toplevel subvolume among deleted (broken since 4.8.3) * minor adjustments of uuid print format * subvol delete: * fix swapped behaviour of --commit-each and --commit-after * fix potentially lost sync if subvolumes are from different filesystems * check: add cache for metadata blocks, should improve performance * other: * new tests, testsuite updates * doc updates * cleanups btrfs-progs-4.13.3 (2017-10-16) * check: fix --force, wrong check for a mounted block device * build: fix --with-convert parsing * subvol list: don't list TOPLEVEL * other: update tests btrfs-progs-4.12 (2017-07-26) """"""""""""""""""""""""""""" * subvol show: new options --rootid, --uuid to show subvol by the given spec * convert: progress report fixes, found by tsan * image: progress report fixes, found by tsan * fix infinite looping in find-root, or when looking for free extents * other: * code refactoring * docs updates * build: ThreadSanitizer support * tests: stricter checks for mounted filesystem btrfs-progs-4.12.1 (2017-08-25) * build: * fix cross-compilation * use gnu90 explicitly * dump-tree: more relaxed checks so -b can print block on a damaged fs * convert: fix the 1MB range exclusion * check: more dir_item hash checks * other * added missing getopt spec for some options * doc fixes * cleanups * test updates btrfs-progs-4.11 (2017-05-18) """"""""""""""""""""""""""""" * receive: fix handling empty stream with -e (multi-stream) * send dump: fix printing long file names * stability fixes for: dump-super, print-tree, check * option parser updates: global options are parsed before the subcommand name (old xfstests will fail) * new and updated tests * documentation updates btrfs-progs-4.11.1 (2017-06-30) * image: restoring from multiple devices * dev stats: make --check option work * check: fix false alert with extent hole on a NO_HOLE filesystem * check: lowmem mode, fix false alert in case of mixed inline and compressed extent * convert: work with large filesystems (many TB) * convert: fix overwriting of eb header flags * convert: do not clear NODATASUM flag in inodes when run with --no-datasum * docs updates * build: sync Android.mk with Makefile * tests: * new tests * fix 008 and 009, shell quotation mistake btrfs-progs-4.10 (2017-03-08) """"""""""""""""""""""""""""" * send: dump output fixes: missing newlines * check: several fixes for the lowmem mode, improved error reporting * build * removed some library deps for binaries that not use them * ctags, cscope * split Makefile to the autotool generated part and the rest, not needed to autogen.sh after adding a file * shared code: sync easy parts with kernel sources * other * lots of cleanups * source file reorganization: convert, mkfs, utils * lots of spelling fixes in docs, other updates * more tests btrfs-progs-4.10.1 (2017-03-17) * receive: handle subvolume in path clone * convert: rollback fixed (rewrite was needed to address previous design issues) * build: fix build of 3rd party tools, missing * dump-tree: print log trees * other * new and updated tests btrfs-progs-4.10.2 (2017-03-31) * check: lowmem mode fix for false alert about lost backrefs * convert: minor bugfix * library: fix build, missing symbols, added tests btrfs-progs-4.9 (2016-12-23) """""""""""""""""""""""""""" * check: many lowmem mode updates * send: use splice syscall to copy buffer from kernel * receive: new option to dump the stream in textual form * convert: * move sources to own directory * prevent accounting of blocks beyond end of the device * make it work with 64k sectorsize * mkfs: move sources to own directory * defrag: warns if directory used without -r * dev stats: * new option to check stats for non-zero values * add long option for -z * library: version bump to 0.1.2, added subvol_uuid_search2 * other: * cleanups * docs updates btrfs-progs-4.9.1 (2017-01-27) * check: * use correct inode number for lost+found files * lowmem mode: fix false alert on dropped leaf * size reports: negative numbers might appear in size reports during device deletes (previously in EiB units) * mkfs: print device being trimmed * defrag: v1 ioctl support dropped * quota: print message before starting to wait for rescan * qgroup show: new option to sync before printing the stats * other: * corrupt-block enhancements * backtrace and co. cleanups * doc fixes btrfs-progs-4.8 (2016-10-05) """""""""""""""""""""""""""" * error handling improvements all over the place * new fuzzed images, test updates * doc fixups * minor cleanups and improvements * kernel library helpers moved to own directory * qgroup: fix regression leading to incorrect status after check, introduced in 4.7 btrfs-progs-4.8.1 (2016-10-12) * 32bit builds fixed * build without backtrace support fixed btrfs-progs-4.8.2 (2016-10-26) * convert: also convert file attributes * convert: fix wrong tree block alignment for unaligned block group * check: quota verify fixes, handle reloc tree * build: add stub for FIEMAP_EXTENT_SHARED, compiles on ancient kernels * build: add stub for BUILD_ASSERT when ioctl.h is included * dump-tree: don't crash on unrecognized tree id for -t * tests: * add more ioctl tests * convert: more symlink tests, attribute tests * quota verify for reloc tree * other cleanups btrfs-progs-4.8.3 (2016-11-11) * check: * support for clearing space cache (v1) * size reduction of inode backref structure * send: * fix handling of multiple snapshots (-p and -c options) * transfer buffer increased (should reduce number of context switches) * reuse existing file for output (-f), eg. when root cannot create files (NFS) * dump-tree: * print missing items for various structures * new: dev stats, balance status item * sync key names with kernel (the persistent items) * subvol show: now able to print the toplevel subvolume -- the creation time might be wrong though * mkfs: * store the creation time of toplevel root inode * print UUID in the summary * build: travis CI for devel * other: * lots of cleanups and refactoring * switched to on-stack path structure * fixes from coverity, asan, ubsan * new tests * updates in testing infrastructure * fixed convert test 005 btrfs-progs-4.8.4 (2016-11-25) * check: support for clearing space cache v2 (free-space-tree) * send: * more sanity checks (with tests), cleanups * fix for fstests/btrfs/038 and btrfs/117 failures * build: * fix compilation of standalone ioctl.h, pull NULL definition * fix library link errors introduced in 4.8.3 * tests: * add more fuzzed images from bugzilla * add bogus send stream checks * fixups and enhancements for CI environment builds * misc refinements and updates of testing framework * other: * move sources for btrfs-image to own directory * deprecated and not build by default: btrfs-calc-size, btrfs-show-super * docs updates btrfs-progs-4.8.5 (2016-11-30) * receive: fix detection of end of stream (error reported even for valid streams) * other: * added test for the receive bug * fix linking of library-test btrfs-progs-4.7 (2016-07-29) """""""""""""""""""""""""""" * convert: fix creating discontig extents * check: speed up traversing heavily reflinked extents within a file * check: verify qgroups of higher levels * check: repair can now fix wrong qgroup numbers * balance: new option to run in the background * defrag: default extent target size changed to 32MiB * du: silently skip non-btrfs dirs/files * documentation updates: btrfs(5), btrfs(8), balance, subvolume, scrub, filesystem, convert * bugfixes: * unaligned access (reported for sparc64) in raid56 parity calculations * use /bin/bash * other stability fixes and cleanups * more tests btrfs-progs-4.7.1 (2016-08-25) * check: * new optional mode: optimized for low memory usage (memory/io tradeoff) * --mode=lowmem, not default, still considered experimental * does not work with --repair yet * convert: regression fix, ext2_subvol/image rw permissions * mkfs/convert: * two-staged creation, partially created filesystem will not be recognized * improved error handling (fewer BUG_ONs) * convert: preparation for more filesystems to convert from * documentation updates: quota, qgroup * other * message updates * more tests * more build options, enhanced debugging btrfs-progs-4.7.2 (2016-09-05) * check: * urgent fix: false report of backref mismatches; do not --repair last unaffected version 4.6.1 (code reverted to that state) * fuzzing and fixes * added more sanity checks for various structures * testing images added * build: udev compatibility: do not install .rules on version < 190 * other: * dump-super: do not crash on garbage value in csum_type * minor improvements in messages and help strings * documentation: * filesystem features btrfs-progs-4.7.3 (2016-09-21) * fixed free space tree compat status * check: low-mem mode: handle partially dropped snapshots * dump-super: consolidate options for superblock copy * tree-stats: check mount status * subvol delete: handle verbosity option * defrag: print correct error string * mkfs: fix reading rotational status * other: * UBSAN build option * documentation updates * enhanced tests: convert, fuzzed images, more tools to run on fuzzed images btrfs-progs-4.6 (2016-06-10) """""""""""""""""""""""""""" * convert - major rewrite: * fix a long-standing bug that led to mixing data blocks into metadata block groups * the workaround was to do full balance after conversion, which was recommended practice anyway * explicitly set the lowest supported version of e2fstools to 1.41 * provide and install udev rules file that addresses problems with device mapper devices, renames after removal * send: new option: quiet * dev usage: report slack space (device size minus filesystem area on the dev) * image: support DUP * build: short options to enable debugging builds * other: * code cleanups * build fixes * more tests and other enhancements btrfs-progs-4.6.1 (2016-06-24) * filesystem resize: negative resize argument accepted again * qgroup rescan: fix skipping when rescan is in progress * mkfs: initialize stripesize to correct value * testsuite updates, mostly convert tests * documentation updates * btrfs-device, btrfs-restore manual pages enhanced * misc fixups btrfs-progs-4.5 (2016-03-20) """""""""""""""""""""""""""" New/moved commands: * btrfs-show-super -> btrfs inspect-internal dump-super * btrfs-debug-tree -> btrfs inspect-internal dump-tree New commands: * btrfs filesystem du - calculate disk usage, including shared extents Enhancements: * device delete - delete by id (needs kernel support, not merged to 4.6) * check - new option to specify chunk root * debug-tree/dump-tree - option -t understands human readable name of the tree (along numerical ids) * btrfs-debugfs - can dump block group information Bugfixes: * all commands should accept the option separator "--" * several fixes in device scan * restore works on filesystems with sectorsize > 4k * debug-tree/dump-tree - print compression type as string * subvol sync: fix crash, memory corruption * argument parsing fixes: subvol get-default, qgroup create/destroy/ assign, inspect subvolid-resolve * check for block device or regular file in several commands Other: * documentation updates * manual pages for the moved tools now point to btrfs-filesystem * testsuite updates btrfs-progs-4.5.1 (2016-03-31) * mkfs: allow DUP on multi-device filesystems * bugfixes: build fixes, assorted other fixes btrfs-progs-4.5.2 (2016-05-02) * new/moved command: btrfs-calc-stats -> btrfs inspect tree-stats * check: fix false alert for metadata blocks crossing stripe boundary * check: catch when qgroup numbers mismatch * check: detect running quota rescan and report mismatches * balance start: add safety delay before doing a full balance * filesystem sync: is now silent * filesystem show: don't miss filesystems with partially matching uuids * dev ready: accept only one argument for device * dev stats: print "devid:N" for a missing device instead of "(null)" * other: * lowest supported version of e2fsprogs is 1.41 * minor cleanups, test updates btrfs-progs-4.5.3 (2016-05-11) * ioctl: fix unaligned access in buffer from TREE_SEARCH; might cause SIGBUS on architectures that do not support unaligned access and do not perform any fixups * improved validation checks of superblock and chunk-related structures * subvolume sync: fix handling of -s option * balance: adjust timing of safety delay countdown with --full-balance * rescue super-recover: fix reversed condition check * check: fix bytes_used accounting * documentation updates: mount options, scrub, send, receive, select-super, check, mkfs * testing: new fuzzed images, for superblock and chunks btrfs-progs-4.4 (2016-01-18) """""""""""""""""""""""""""" User visible changes: * mkfs.btrfs --data dup People asked about duplicating data on a single device for a long time. There are no technical obstacles preventing that, so it got enabled with a warning about potential dangers when the device will not do the duplicated copies. See mkfs.btrfs section DUP PROFILES ON A SINGLE DEVICE. * support balance filters added/enhanced in linux 4.4 * usage=min..max -- enhanced to take range * stripes=min..max -- new, filter by stripes for raid0/10/5/6 * limit=min..max -- enhanced to take range Note: due to backward compatibility, the range maximum for 'usage' is not inclusive as for the others, to keep the same behaviour as usage=N . * manual pages enhanced (btrfs, mkfs, mount, filesystem, balance) * error messages updates, rewordings -- some fstests may break due to that * added support for free-space-tree implementation of space cache -- this requires kernel 4.5 and is not recommended for non-developers yet * btrfs filesystem usage works with mixed blockgroups Other: * installation to /usr/local -- this has unintentionally changed during conversion to autotools in 3.19 * check: fix a false alert where extent record has wrong metadata flag * improved stability on fuzzed/crafted images when reading sys array in superblock * build: the 'ar' tool is properly detected during cross-compilation * debug-tree: option -t understands ids for tree root and chunk tree * preparatory work for btrfs-convert rewrite * sparse, gcc warning fixes * more memory allocation failure handling * cleanups * more tests Bugfixes: * chunk recovery: fix floating point exception * chunk recovery: endianness bugfix during rebuild * mkfs with 64K pages and nodesize reported superblock checksum mismatch * check: properly reset nlink of multi-linked file btrfs-progs-4.4.1 (2016-02-26) * find-root: don't skip the first chunk * free-space-tree compat bits fix * build: target symlinks * documentation updates * test updates btrfs-progs-4.3 (2015-11-06) """""""""""""""""""""""""""" * mkfs * mixed mode is not forced for filesystems smaller than 1GiB * mixed mode broken with mismatching sectorsize and nodesize, fixed * print version info earlier * print devices sorted by id * do not truncate target image with --rootsize * filesystem usage: * don't print global block reserve * print device id * minor output tuning * other cleanups * calc-size: * div-by-zero fix on an empty filesystem * fix crash * bugfixes: * more superblock sanity checks * consistently round size of all devices down to sectorsize * misc leak fixes * convert: don't try to rollback with a half-deleted ext2_saved subvolume * other: * check: add progress indicator * scrub: enhanced error message * show-super: read superblock from a given offset * add README * docs: update manual page for mkfs.btrfs, btrfstune, balance, convert and inspect-internal * build: optional build with more warnings (W=...) * build: better support for static checkers * build: html output of documentation * pretty-print: last_snapshot for root_item * pretty-print: stripe dev uuid * error reporting wrappers, introduced and example use * refactor open_file_or_dir * other docs and help updates * testing: * test for nodes crossing stripes * test for broken 'subvolume sync' * basic tests for mkfs, raid option combinations * basic tests for fuzzed images (check) * command instrumentation (eg valgrind) * print commands if requested * add README for tests btrfs-progs-4.3.1 (2015-11-16) * fixes * device delete: recognize 'missing' again * mkfs: long names are not trimmed when doing ssd check * support partitioned loop devices * other * replace several mallocs with on-stack variables * more memory allocation failure handling * add tests for bugs fixed * cmd-device: switch to new message printing helpers * minor code cleanups btrfs-progs-4.2 (2015-09-03) """""""""""""""""""""""""""" * enhancements: * mkfs: do not create extra single chunks on multiple devices * resize: try to guess the minimal size, 'inspect min-dev-size' * qgroup assign: add option to schedule rescan * chunk-recover: be more verbose about the scanning process * fixes: * check: * find stripes crossing stripe boundary -- created by convert * print correct range for file hole when there are no extents and learn how to fix it * replace: more sanity checks * convert: concurrency fixes related to reporting progress * find-root: option -a will not skip the current root anymore * subvol list: fix occasional crash * do not create stripes crossing stripe boundary * build: * fixes for musl libc * preliminary support for android (not working yet, more code changes needed) * new EXTRA_CFLAGS and EXTRA_LDFLAGS * other: * lots of cleanups * tests: lots of updates, new tests, framework improvements * documentation updates * debugging: print-tree shows stripe length btrfs-progs-4.2.1 (2015-09-20) * fix an off-by-one error in cross-stripe boundary check * if nodesize was 64k, any metadata block was reported as crossing, this leads to mkfs failure for example due to "no free blocks found" * for other nodesizes, if the end of the metadata block was 64k aligned, it was incorrectly reported by fsck * convert: don't write uninitialized data to image * image: * don't loop with option -t0 * don't create threads if compression is not requested * other: minor cleanups btrfs-progs-4.2.2 (2015-10-05) * filesystem label: use fallback if the label ioctl is not available * convert: check nodesize constraints against command line features (-O) * scrub: report status 'running' until all devices are finished * device scanning might crash in some scenarios * filesystem usage: print summary for non-root users btrfs-progs-4.2.3 (2015-10-19) * subvol sync: make it actually work again: it's been broken since 4.1.2, due to a reversed condition it returned immediately instead of waiting * scanning: do not scan already discovered filesystems (minor optimization) * convert: better error message in case the filesystem is not finalized * restore: off-by-one symlink path check fix btrfs-progs-4.1 (2015-06-22) """""""""""""""""""""""""""" Bugfixes: * fsck.btrfs: no bash-isms * bugzilla 97171: invalid memory access (with tests) * receive: * cloning works with --chroot * capabilities not lost * mkfs: do not try to register bare file images * option --help accepted by the standalone utilities Enhancements: * corrupt block: ability to remove csums * mkfs: * warn if metadata redundancy is lower than for data * options to make the output quiet (only errors) * mixed case names of raid profiles accepted * rework the output: * more comprehensive, 'key: value' format * subvol: * show: * print received uuid * update the output * new options to specify size units * sync: grab all deleted ids and print them as they're removed, previous implementation only checked if there are any to be deleted - change in command semantics * scrub: print timestamps in days HMS format * receive: * can specify mount point, do not rely on /proc * can work inside subvolumes * send: new option to send stream without data (NO_FILE_DATA) * convert: specify incompat features on the new fs * qgroup: * show: distinguish no limits and 0 limit value * limit: ability to clear the limit * help for 'btrfs' is shorter, 1st level command overview * debug tree: print key names according to their C name New: * rescue zero-log * btrfstune: * rewrite uuid on a filesystem image * new option to turn on NO_HOLES incompat feature Deprecated: * standalone btrfs-zero-log Other: * testing framework updates * uuid rewrite test * btrfstune feature setting test * zero-log tests * more testing image formats * manual page updates * ioctl.h synced with current kernel uapi version * convert: preparatory works for more filesystems (reiserfs pending) * use static buffers for path handling where possible * add new helpers for send utils that check memory allocations, switch all users, deprecate old helpers * Makefile: fix build dependency generation * map-logical: make it work again btrfs-progs-4.1.1 (2015-07-10) -- Do not use this version! Bugfixes: * defrag: threshold overflow fix * fsck: * check if items fit into the leaf space * fix wrong nbytes * mkfs: * create only desired block groups for single device * preparatory work for fix on multiple devices Enhancements: * new alias for 'device delete': 'device remove' Other: * fix compilation on old gcc (4.3) * documentation updates * debug-tree: print nbytes * test: image for corrupted nbytes * corrupt-block: let it kill nbytes btrfs-progs-4.1.2 (2015-07-14) * urgent bugfix: mkfs creates invalid filesystem, must be recreated btrfs-progs-4.0 (2015-04-29) """""""""""""""""""""""""""" * resize: * don't accept file as an argument (it's confusing) * print better error message in case of an error * restore: optionally restore metadata (time, mode, uid/gid) * receive: optionally enforce chroot * new rescue subcommand 'zero-log', same as btrfs-zero-log, but now also part of the main utility * check: * free space checks match kernel, fixes incorrect reports * convert: fix setting of checksum bit if --no-datasum is used * fsck.btrfs: don't print messages * fix quota rescan on PPC64 (mangled ioctl number) * test updates * documentation: files renamed to .asciidoc, misc fixups btrfs-progs-4.0.1 (2015-05-20) * restore: * can restore symlinks, new option --symlinks * long option variants added * convert: dropped dependency on acl.h header and libacl is not required for build * fix for 'check' crash * device remove error message fix * preparatory works for fsid change btrfs-progs-3.x (2015-03-25) ---------------------------- btrfs-progs-3.19 (2015-03-11) """"""""""""""""""""""""""""" * build converted to autotools * btrfs-image * restore can now run in parallel threads * fixed restore of multiple image from multiple devices onto a single dev * introduced metadump v2 * check: make --init-csum-tree and --init-extent-tree work together * find-new: option to search through all metadata even if a root was already found * convert: show progress by default, can be turned off * corrupt-block: option to work on a specific root * bash completion script for all subcommands btrfs-progs-3.19.1 (2015-03-25) * convert: * new option to specify metadata block size * --no-progress actually works * restore: properly handle the page boundary corner case * build fixes: * missing macro from public header, BTRFS_BUILD_VERSION * wrong handling of --enable-convert * filesystem usage: reports correct space for degraded mounts * other: * mkfs: help string updates * completion: added 'usage' subcommands * cleanups in qgroup code, preparatory work btrfs-progs-3.18 (2014-12-30) """"""""""""""""""""""""""""" * mkfs - skinny-metadata feature is now on by default, first introduced in kernel 3.10 * filesystem usage - give an overview of fs usage in a way that's more comprehensible than existing 'filesystem df' * device usage - more detailed information about per-device allocations * check * option to set a different tree root byte number * ability to link lost files to lost+found, caused by a recent kernel bug * repair of severely corrupted fs (use with care) * convert - option to show progress * subvol create - print the commit mode inline, print the global mode only if --verbose * other updates: musl-libc support, coverity bugfixes, new test images, documentation btrfs-progs-3.18.1 (2015-01-09) * minor fixes * documentation updates btrfs-progs-3.18.2 (2015-01-27) * qgroup show: print human readable sizes, options to say otherwise * check: new option to explicitly say no to writes * mkfs: message about trimming is not printed to stderr * filesystem show: fixed return value * tests: new infrastructure * btrfstune: force flag can be used together with seeding option * backtrace support is back * getopt cleanups * doc and help updates btrfs-progs-3.17 (2014-10-17) """"""""""""""""""""""""""""" * check: --init-csum-tree actually does something useful, rebuilds the whole csum tree * /dev scanning for btrfs devices is gone * /proc/partitions scanning is gone, blkid is used exclusively * new subcommand subvolume sync * filesystem df: new options to set unit format * convert: allow to copy label from the origin, or specify a new one btrfs-progs-3.17.1 (2014-11-04) * filesystem df: argument handling * fix linking with libbtrfs * replace: better error reporting * filesystem show: fixed stall if run concurrently with balance * check: fixed argument parsing for --subvol-extents * filesystem df: SI prefixes corrected btrfs-progs-3.17.2 (2014-11-19) * check improvements * add ability to replace missing dir item/dir indexes * fix missing inode items * create missing root dirid * corrupt block: enhancements for testing fsck * zero-log: able to reset a fs with bogus log tree pointer (bug_72151) btrfs-progs-3.17.3 (2014-12-04) * convert: fix conversion of sparse ext* filesystems * show: resolve to the correct path * fsck: more verbose error for root dir problems btrfs-progs-3.16 (2014-08-26) """"""""""""""""""""""""""""" * mkfs: new option to specify UUID, drop experimental notice * check: new option to verify quotas, reduced memory requirements, new option to print extent sharing * restore: check length before decompression, more error handling, option to loop during restoring * balance: new filter 'limit' * recover: allow to read all sb copies * btrfstune: new option to force dangerous changes * receive: new option to limit number of errors * show-super: skip unrecognized sb, add option to force * debug-tree: print tree by id * documentation updates btrfs-progs-3.16.1 (2014-09-15) * print GlobalReserve in filesystem df output * new option -R in subvol list * library version defines * static build is fixed * build without documentation is possible btrfs-progs-3.16.2 (2014-10-01) * a few fixes in fsck and image tools btrfs-progs-3.15 (skipped) """""""""""""""""""""""""" btrfs-progs-3.14 (2014-04-06) """"""""""""""""""""""""""""" * fsck: fixes and enhancements to --init-extent-tree mode * fsck: chunk-recover updates * scrub: add force option -f * send: check if subvolumes are read-only * subvol delete: add options to affect commit behaviour * btrfs: add property command group * restore: add dry-run option * restore: fix restoring of compressed files * mkfs: support for no-holes feature * mkfs: option -r deals with hardlinks and relative paths * mkfs: discard phase is interruptible * documentation updates btrfs-progs-3.14.1 (2014-04-18) * properties: fix handling of option -t * restore: fix reading of compressed extents * minor code and doc updates btrfs-progs-3.14.2 (2014-05-29) * documentation is now written in asciidoc and there are manpages for each subcommand * misc bugfixes btrfs-progs-3.13 (skipped) """""""""""""""""""""""""" btrfs-progs-3.12 (2013-11-25) """"""""""""""""""""""""""""" * announcement, tarballs * first release after 0.19 (2009/06) with a lot of changes btrfs-progs-6.14/COPYING000066400000000000000000000431341477105376400147720ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. btrfs-progs-6.14/Documentation/000077500000000000000000000000001477105376400165435ustar00rootroot00000000000000btrfs-progs-6.14/Documentation/Administration.rst000066400000000000000000000011371477105376400222640ustar00rootroot00000000000000Administration ============== The main administration tool for BTRFS filesystems is :doc:`btrfs`. Please refer to the manual pages of the subcommands for further documentation. Other topics explaining features or concepts can be found in :doc:`btrfs-man5`. Mount options ------------- .. include:: ch-mount-options.rst Bootloaders ----------- .. include:: ch-bootloaders.rst .. _administration-limits: Filesystem limits ----------------- .. include:: ch-fs-limits.rst .. _administration-flexibility: Flexibility ----------- .. include:: ch-flexibility.rst Sysfs ----- .. include:: ch-sysfs.rst btrfs-progs-6.14/Documentation/Auto-repair.rst000066400000000000000000000014001477105376400214600ustar00rootroot00000000000000Auto-repair on read =================== If data or metadata are found to be damaged at the time they’re read from a device, for example because the checksum does not match, they can be salvaged if the filesystem has another valid copy. This can be achieved by using a block group profile with redundancy like DUP, RAID1-like, or RAID5/6. The correct data is returned to the user application and the damaged copy is replaced by it. When this happens, a message is emitted to the system log. If there are multiple copies of data and one of them is damaged but not read by the user application, then this is not detected. To ensure the verification and automatic repair of all data and metadata copies, the :doc:`scrub` operation must be initiated manually. btrfs-progs-6.14/Documentation/Balance.rst000066400000000000000000000002421477105376400206200ustar00rootroot00000000000000Balance ======= .. include:: ch-balance-intro.rst Filters ------- .. include:: ch-balance-filters.rst Examples -------- .. include:: ch-balance-examples.rst btrfs-progs-6.14/Documentation/CHANGES.rst000066400000000000000000000002601477105376400203430ustar00rootroot00000000000000Changes (btrfs-progs) ===================== Signed release tarballs can be found at https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/ .. include:: ../CHANGES btrfs-progs-6.14/Documentation/Checksumming.rst000066400000000000000000000000741477105376400217130ustar00rootroot00000000000000Checksumming ============ .. include:: ch-checksumming.rst btrfs-progs-6.14/Documentation/CodingConventions000066400000000000000000000006341477105376400221220ustar00rootroot00000000000000C style ------- The kernel CodingStyle where applicable https://www.kernel.org/doc/html/latest/process/coding-style.html Error messages -------------- * formatting: * use `error("string ...")` * no trailing newline * small letter starts the first word * no string splitting * move string to new line if it's too long, un-indent to the left if it exceeds 80 chars * contents: * be descriptive btrfs-progs-6.14/Documentation/Common-features.rst000066400000000000000000000036631477105376400223510ustar00rootroot00000000000000Common Linux features ===================== The Linux operating system implements a POSIX standard interfaces and API with additional interfaces. Many of them have become common in other filesystems. The ones listed below have been added relatively recently and are considered interesting for users: birth/origin inode time a timestamp associated with an inode of when it was created, cannot be changed and requires the *statx* syscall to be read statx an extended version of the *stat* syscall that provides extensible interface to read more information that are not available in original *stat* fallocate modes the *fallocate* syscall allows to manipulate file extents Supported modes: - keep size (FALLOC_FL_KEEP_SIZE) - hole punching (FALLOC_FL_PUNCH_HOLE) - zero range (FALLOC_FL_ZERO_RANGE) FIEMAP an ioctl that enumerates file extents, related tool is :command:`filefrag` filesystem label another filesystem identification, could be used for mount or for better recognition, can be set or read by an ioctl or by command :ref:`btrfs filesystem label` O_TMPFILE mode of open() syscall that creates a file with no associated directory entry, which makes it impossible to be seen by other processes and is thus safe to be used as a temporary file (https://lwn.net/Articles/619146/) xattr, acl extended attributes (xattr) is a list of *key=value* pairs associated with a file, usually storing additional metadata related to security, access control list in particular (ACL) or properties (:doc:`btrfs-property`) cross-rename mode of *renameat2* syscall that can atomically swap 2 directory entries (files/directories/subvolumes/symlinks) within the same filesystem File attributes, XFLAGS ----------------------- .. include:: ch-file-attributes.rst btrfs-progs-6.14/Documentation/Compression.rst000066400000000000000000000000711477105376400215740ustar00rootroot00000000000000Compression =========== .. include:: ch-compression.rst btrfs-progs-6.14/Documentation/Contributors.rst000066400000000000000000000167161477105376400220050ustar00rootroot00000000000000Contributors ============ The following companies contribute to Btrfs code, not counting the treewide and other subsystem changes. Infrequent contributions are not reflected in this list, please have a look to the git history for complete list. Sorted by amount of contributions: * SUSE * Facebook * Western Digital * Oracle The following contributed in the past (sorted alphabetically): Fujitsu, Fusion-IO, Intel, Linux Foundation, Red Hat, STRATO AG. .. list-table:: :header-rows: 0 * - .. figure:: plot-contribs.svg :scale: 33% :alt: Contributors :target: `contributors-contribs`_ Contributors - .. figure:: plot-sloc-lines.svg :scale: 33% :alt: Lines :target: `contributors-lines`_ Lines - .. figure:: plot-patches.svg :scale: 33% :alt: Patches :target: `contributors-patches`_ Patches Statistics for 6.x series ------------------------- .. csv-table:: :header: "Version", "Contributors", "SLOC", "Raw lines", "Patches", "Diffstat" :align: left "6.0", "24", "109726", "156988", "192", "+4248 -3108" "6.1", "28", "110850", "159284", "224", "+7738 -5442" "6.2", "23", "111898", "161197", "289", "+11693 -9780" "6.3", "19", "111615", "160912", "150", "+2824 -3108" "6.4", "18", "110224", "159150", "180", "+3118 -4879" "6.5", "19", "110377", "159415", "230", "+3193 -2928" "6.6", "21", "110785", "160152", "153", "+2648 -1909" "6.7", "18", "109562", "159074", "185", "+4376 -5476" "6.8", "17", "109963", "160078", "134", "+4494 -3490" "6.9", "19", "110727", "161231", "147", "+2476 -1323" "6.10", "21", "110878", "161751", "154", "+2993 -2473" "6.11", "18", "111848", "163484", "188", "+5776 -4043" "6.12", "20", "111881", "163548", "148", "+1868 -1804" "6.13", "25", "112756", "164722", "156", "+2780 -1579" "6.14", "20", "114592", "167178", "147", "+3847 -1391" Legend: - *Files:* fs/btrfs/\*.[ch], fs/btrfs/tests/\*.[ch], include/uapi/linux/btrfs.h, include/uapi/linux/btrfs_tree.h, include/linux/btrfs.h, include/trace/events/btrfs.h - *Version:* mainline version - *Contributors:* number of people that sent patches that modified ''Files'', direct btrfs development or originating from other tree-wide changes - *SLOC:* lines of code, http://dwheeler.com/sloccount/ (generated by version 2.26) - *Raw lines:* counted by ''wc -l'' over ''Files'' - *Patches:* number of patches from ''Contributors'', merge commits excluded - *Diffstat:* lines added and deleted in ''Files'' Statistics for 5.x series ------------------------- .. csv-table:: :header: "Version", "Contributors", "SLOC", "Raw lines", "Patches", "Diffstat" :align: left "5.0", "15", "98298", "134159", "144", "+3173 -2297" "5.1", "18", "98992", "135308", "116", "+2208 -1059" "5.2", "22", "99888", "136521", "255", "+3524 -2311" "5.3", "20", "100254", "137224", "124", "+4106 -3400" "5.4", "18", "100660", "137889", "166", "+10752 -10087" "5.5", "17", "100638", "138212", "168", "+3055 -2729" "5.6", "18", "101482", "139742", "114", "+3370 -1840" "5.7", "22", "101661", "140694", "221", "+4484 -3532" "5.8", "21", "101562", "140930", "158", "+3176 -2940" "5.9", "18", "101973", "141748", "188", "+2218 -1400" "5.10", "22", "102378", "142760", "187", "+3148 -2135" "5.11", "15", "102418", "143124", "229", "+4872 -4507" "5.12", "20", "105026", "147099", "195", "+5310 -1316" "5.13", "19", "105820", "148503", "145", "+3334 -1930" "5.14", "19", "106324", "149550", "121", "+2823 -1774" "5.15", "17", "106895", "151006", "133", "+2879 -1422" "5.16", "24", "107854", "152760", "173", "+4770 -3016" "5.17", "17", "107910", "153407", "154", "+4024 -3378" "5.18", "30", "109159", "155372", "143", "+3489 -1523" "5.19", "21", "109140", "155848", "202", "+4448 -3972" Statistics for 4.x series ------------------------- .. csv-table:: :header: "Version", "Contributors", "SLOC", "Raw lines", "Patches", "Diffstat" :align: left "4.0", "22", "85849", "115716", "97", "+1622 -937" "4.1", "25", "87596", "118253", "120", "+2415 -1062" "4.2", "19", "87935", "118790", "119", "+2392 -1855" "4.3", "23", "88384", "119576", "74", "+1516 -730" "4.4", "26", "89543", "121456", "138", "+3184 -1304" "4.5", "26", "91708", "124363", "127", "+4370 -1462" "4.6", "29", "92134", "125045", "100", "+1890 -1208" "4.7", "33", "92922", "126264", "161", "+3721 -2502" "4.8", "22", "93769", "127392", "114", "+2732 -1604" "4.9", "25", "94237", "128040", "64", "+1959 -1311" "4.10", "24", "94303", "128156", "105", "+4874 -4758" "4.11", "24", "94365", "128340", "210", "+2084 -1900" "4.12", "21", "94931", "129230", "85", "+1803 -913" "4.13", "29", "93892", "127970", "135", "+2017 -1607" "4.14", "28", "94296", "124346", "132", "+2114 -1520" "4.15", "30", "97091", "132221", "128", "+3761 -1795" "4.16", "25", "97637", "133305", "188", "+2562 -1481" "4.17", "21", "98027", "133003", "194", "+2723 -3024" "4.18", "26", "98387", "133667", "200", "+3643 -2979" "4.19", "25", "97547", "132655", "193", "+2058 -3070" "4.20", "22", "97830", "133283", "128", "+1560 -932" Statistics for 3.x series ------------------------- .. csv-table:: :header: "Version", "Contributors", "SLOC", "Raw lines", "Patches", "Diffstat" :align: left "3.0", "25", "48665", "65192", "126", "+7508 -5175" "3.1", "24", "48647", "65248", "106", "+1762 -1586" "3.2", "30", "51574", "69552", "184", "+6344 -2040" "3.3", "27", "56216", "75485", "129", "+7151 -1218" "3.4", "25", "57865", "77671", "118", "+4597 -2411" "3.5", "21", "59683", "79983", "108", "+3570 -1258" "3.6", "25", "65894", "88123", "104", "+9145 -1005" "3.7", "30", "67348", "90171", "151", "+3802 -1754" "3.8", "25", "70289", "93916", "161", "+5599 -1854" "3.9", "29", "73414", "98602", "160", "+6430 -1242" "3.10", "24", "74449", "99980", "133", "+3529 -2151" "3.11", "21", "74875", "100657", "100", "+2538 -1857" "3.12", "32", "76265", "102497", "158", "+4373 -2533" "3.13", "24", "77532", "104108", "123", "+2741 -1123" "3.14", "28", "79879", "107069", "171", "+5290 -2329" "3.15", "27", "80308", "107544", "152", "+2389 -1914" "3.16", "29", "82292", "110331", "137", "+4361 -1574" "3.17", "19", "82625", "110841", "44", "+1060 -550" "3.18", "25", "83910", "112906", "149", "+3696 -1631" "3.19", "18", "85420", "115031", "82", "+2802 -677" Statistics for 2.6.x series --------------------------- .. csv-table:: :header: "Version", "Contributors", "SLOC", "Raw lines", "Patches", "Diffstat" :align: left "2.6.30", "22", "33838", "45377", "70", "+4403 -2632" "2.6.31", "19", "38825", "51693", "68", "+9207 -2862" "2.6.32", "15", "40211", "53515", "95", "+4291 -2469" "2.6.33", "17", "40408", "53806", "43", "+1332 -1041" "2.6.34", "18", "41100", "54715", "54", "+1374 -465" "2.6.35", "14", "43014", "57082", "50", "+5230 -2863" "2.6.36", "4", "43016", "57088", "6", "+39 -33" "2.6.37", "17", "44781", "59491", "83", "+3104 -701" "2.6.38", "23", "46573", "61980", "90", "+3472 -983" "2.6.39", "28", "47206", "62859", "102", "+2115 -1236" Graphs ------ .. _contributors-contribs: Contributors ^^^^^^^^^^^^ .. image:: plot-contribs.svg .. _contributors-lines: Lines of code, raw lines ^^^^^^^^^^^^^^^^^^^^^^^^ .. image:: plot-sloc-lines.svg .. _contributors-patches: Patches ^^^^^^^ .. image:: plot-patches.svg btrfs-progs-6.14/Documentation/Convert.rst000066400000000000000000000000631477105376400207140ustar00rootroot00000000000000Convert ======= .. include:: ch-convert-intro.rst btrfs-progs-6.14/Documentation/Custom-ioctls.rst000066400000000000000000000020051477105376400220370ustar00rootroot00000000000000Custom ioctls ============= Filesystems are usually extended by custom ioctls beyond the standard system call interface to let user applications access the advanced features. They're low level and the following list gives only an overview of the capabilities or a command if available: - reverse lookup, from file offset to inode, as command :command:`btrfs inspect-internal logical-resolve` - resolve inode number to list of names, as command :command:`btrfs inspect-internal inode-resolve` - tree search, given a key range and tree id, lookup and return all b-tree items found in that range, basically all metadata at your hand but you need to know what to do with them, the ioctl is privileged as it has full access to all filesystem metadata - informative, about devices, space allocation or the whole filesystem, many of which is also exported in :file:`/sys/fs/btrfs/` - query/set a subset of features on a mounted filesystem Programming documentation of the ioctls is in the manual page :doc:`btrfs-ioctl`. btrfs-progs-6.14/Documentation/Deduplication.rst000066400000000000000000000061151477105376400220640ustar00rootroot00000000000000Deduplication ============= Going by the definition in the context of filesystems, it's a process of looking up identical data blocks tracked separately and creating a shared logical link while removing one of the copies of the data blocks. This leads to data space savings while it increases metadata consumption. There are two main deduplication types: * **in-band** *(sometimes also called on-line)* -- all newly written data are considered for deduplication before writing * **out-of-band** *(sometimes also called offline)* -- data for deduplication have to be actively looked for and deduplicated by the user application Both have their pros and cons. BTRFS implements **only out-of-band** type. BTRFS provides the basic building blocks for deduplication allowing other tools to choose the strategy and scope of the deduplication. There are multiple tools that take different approaches to deduplication, offer additional features or make trade-offs. The following table lists tools that are known to be up-to-date, maintained and widely used. .. list-table:: :header-rows: 1 * - Name - File based - Block based - Incremental * - `BEES `_ - No - Yes - Yes * - `duperemove `_ - Yes - No - Yes File based deduplication ------------------------ The tool takes a list of files and tries to find duplicates among data only from these files. This is suitable e.g. for files that originated from the same base image, source of a reflinked file. Optionally the tool could track a database of hashes and allow to deduplicate blocks from more files, or use that for repeated runs and update the database incrementally. Block based deduplication ------------------------- The tool typically scans the filesystem and builds a database of file block hashes, then finds candidate files and deduplicates the ranges. The hash database is kept as an ordinary file and can be scaled according to the needs. As the files change, the hash database may get out of sync and the scan has to be done repeatedly. Safety of block comparison -------------------------- The deduplication inside the filesystem is implemented as an ``ioctl`` that takes a source file, destination file and the range. The blocks from both files are compared for exact match before merging to the same range (i.e. there's no hash based comparison). Pages representing the extents in memory are locked prior to deduplication and prevent concurrent modification by buffered writes or mmapped writes. Blocks are compared byte by byte and not using any hash-based approach, i.e. the existing checksums are not used. Limitations, compatibility -------------------------- Files that are subject to deduplication must have the same status regarding COW, i.e. both regular COW files with checksums, or both NOCOW, or files that are COW but don't have checksums (NODATASUM attribute is set). If the deduplication is in progress on any file in the filesystem, the *send* operation cannot be started as it relies on the extent layout being unchanged. btrfs-progs-6.14/Documentation/Defragmentation.rst000066400000000000000000000033301477105376400224030ustar00rootroot00000000000000Defragmentation =============== Defragmentation of files is supposed to make the layout of the file extents to be more linear or at least coalesce the file extents into larger ones that can be stored on the device more efficiently. The reason there's a need for defragmentation stems from the COW design that BTRFS is built on and is inherent. The fragmentation is caused by rewrites of the same file data in-place, that has to be handled by creating a new copy that may lie on a distant location on the physical device. Fragmentation is the worst problem on rotational hard disks due to the delay caused by moving the drive heads to the distant location. With the modern seek-less devices it's not a problem though it may still make sense because of reduced size of the metadata that's needed to track the scattered extents. File data that are in use can be safely defragmented because the whole process happens inside the page cache, that is the central point caching the file data and takes care of synchronization. Once a filesystem sync or flush is started (either manually or automatically) all the dirty data get written to the devices. This however reduces the chances to find optimal layout as the writes happen together with other data and the result depends on the remaining free space layout and fragmentation. .. warning:: Defragmentation does not preserve extent sharing, e.g. files created by **cp --reflink** or existing on multiple snapshots. Due to that the data space consumption may increase. Defragmentation can be started together with compression on the given range, and takes precedence over per-file compression property or mount options. See command :ref:`btrfs filesystem defrag`. btrfs-progs-6.14/Documentation/DocConventions.rst000066400000000000000000000077241477105376400222420ustar00rootroot00000000000000Conventions and style for documentation --------------------------------------- Manual pages structure: - add references to all external commands mentioned anywhere in the text to the *SEE ALSO* section - add related, not explicitly mentioned commands or pages - the heading levels are validated, underlined text by the following - mandatory, manual page ``===`` - mandatory, sections ``---`` - optional, sub-sections ``^^^`` - optional, paragraphs ``"""`` - command-specific examples are mostly free of restrictions but should be readable in all output formats (manual page, html) - subcommands are in alphabetical order - long command output or shell examples: verbatim output - use ``..code-block::`` directive with ``bash`` or ``plain`` syntax highlighting Quotes, reference, element formatting: - exact syntax: monotype ````usage=0```` - reference to arguments: italics ``*italics*`` - command reference: - any system command, example, bold text by directive ``:command:`btrfs filesystem show``` - subcommands with their own manual page ``:doc:`btrfs-filesystem``` - subcommand names should be spelled in full, i.e. *filesystem* instead of *fi* - file, directory or path references: by directive ``:file:`/path``` - section references without a label: italics ``*EXAMPLES*`` - section references with a target label: reference by directive ``:ref:`visible text ``` - argument name in option description: caps in angle brackets ```` - reference in help text: caps ``NAME`` - also possible: caps italics ``*NAME*`` - command short description: - command name: bold (not by directive) ``**command**`` - optional unspecified: brackets ``[options]`` - mandatory argument: angle brackets ```` - optional parameter with argument: ``[-p ]`` Referencing: - add target labels for commands that are referenced and replace command name with the reference target - NOTE: we have either full doc reference by ``:doc:`docname``` or inter-document reference to an **unambiguous** label ``:ref:`target-label```, i.e. this can't reference a label that may appear in more files due to including, this will lead to the document itself that may not be the full page - **ambiguous** or duplicate labels (that exist in a file that is included from other documents) need to be - defined as ``.. duplabel:: labelname`` - referenced as ``:docref:`visible text ``` - generic links can use the free form link syntax with description ```Link text `__`` (note the double underscore, this is *anonymous* link and does not create a reference) or plain link that will auto-render to a clickable link https://example.com - in manual pages: always use full link as it's meant to be read in terminal output and must allow copy&paste - own manual page references: - ``:doc:`btrfs-filesystem```, i.e. it's the document name, it will render the section automatically - other manual pages ``:manref:page(1)``, the exact name and section number - add more clickable references rather than less - custom rules and directives are implemented in :file:`Documentation/conf.py` Conventions: - version should be formatted like ``6.1`` or ``v6.1`` and clear what project/tool it's related to unless it's obvious from the context Other: - for notes use ``.. note::`` directive, is rendered as a separate paragraph and should be used only for important information - ``.. warning::`` directive is rendered as a separate paragraph and most likely more visible than NOTE, use for critical information that may cause harm, irreversible state or performance problems - should point reader to other part of documentation to seek more details References: - RST https://www.sphinx-doc.org/en/master/ - RST and Sphinx Cheatsheet https://spl.hevs.io/spl-docs/writing/rst/cheatsheet.html - RST Cheat Sheet https://sphinx-tutorial.readthedocs.io/cheatsheet/ btrfs-progs-6.14/Documentation/Feature-by-version.rst000066400000000000000000000640711477105376400227730ustar00rootroot00000000000000Changes (feature/version) ========================= Major features or significant feature enhancements by kernel version. For more information look below. The version states at which version a feature has been merged into the mainline kernel. It does not tell anything about at which kernel version it is considered mature enough for production use. For an estimation on stability of features see :doc:`Status` page. 6.x --- 6.0 - send protocol v2 Send protocol update that adds new commands and extends existing functionality to write large data chunks. Compressed (and encrypted) extents can be optionally emitted and transferred as-is without the need to re-compress (or re-encrypt) on the receiving side. 6.0 - sysfs exports commit stats The file :file:`/sys/fs/btrfs/FSID/commit_stats` shows number of commits and various time related statistics. 6.0 - sysfs exports chunk sizes Chunk size value can be read from :file:`/sys/fs/btrfs/FSID/allocation/PROFILE/chunk_size`. 6.0 - sysfs shows zoned mode among features The zoned mode has been supported since 5.10 and adding functionality. Now it's advertised among features. 6.0 - checksum implementation is logged at mount time When a filesystem is mounted the implementation backing the checksums is logged. The information is also accessible in :file:`/sys/fs/btrfs/FSID/checksum`. 6.1 - sysfs support to temporarily skip exact qgroup accounting Allow user override of qgroup accounting and make it temporarily out of date e.g. in case when there are several subvolumes deleted and the qgroup numbers need to be updated at some cost, an update after that can amortize the costs. 6.1 - scrub also repairs superblock An improvement to scrub in case the superblock is detected to be corrupted, the repair happens immediately. Previously it was delayed until the next transaction commit for performance reasons that would store an updated and correct copy eventually. 6.1 - block group tree An incompatible change that has to be enabled at mkfs time. Add a new b-tree item that stores information about block groups in a compact way that significantly improves mount time that's usually long due to fragmentation and scattered b-tree items tracking the individual block groups. Requires and also enables the free-space-tree and no-holes features. 6.1 - discard stats available in sysfs The directory :file:`/sys/fs/btrfs/FSID/discard` exports statistics and tunables related to discard. 6.1 - additional qgroup stats in sysfs The overall status of qgroups are exported in :file:`/sys/sys/fs/btrfs/FSID/qgroups/`. 6.1 - check that super block is unchanged at thaw time Do full check of super block once a filesystem is thawed. This namely happens when system resumes from suspend or hibernation. Accidental change by other operating systems will be detected. 6.2 - discard=async on by default Devices that support trim/discard will enable the asynchronous discard for the whole filesystem. 6.3 - discard=async settings tuned The default IOPS limit has changed from 100 to 1000 and writing value 0 to :file:`/sys/fs/btrfs/FSID/discard/iops_limit` newly means to not do any throttling. 6.3 - block group allocation class heuristics Pack files by size (up to 128k, up to 8M, more) to avoid fragmentation in block groups, assuming that file size and life time is correlated, in particular this may help during balance. The stats about the number of used classes per block group type is exported in :file:`/sys/fs/btrfs/FSID/allocation/\*/size_classes`. 6.3 - in DEV_INFO ioctl export per-device FSID A seeding device could have a different FSID, available in sysfs and now available via DEV_INFO ioctl. 6.3 - send utimes cache, reduced stream size Utimes for directories are emitted into the send stream only when finalizing the directory, the cache also gains significant speedups (up to 10x). 6.7 - raid-stripe-tree New tree for logical mapping, allows some RAID modes for zoned mode. 6.7 - simplified quota accounting A simplified mode of qgroups accounting 6.7 - temporary fsid Mount of cloned devices is now possible, the filesystem will get a new randomly generated UUID on mount 6.8 - new mount API Use new mount API (https://lwn.net/Articles/753473/) 6.9 - statx can read the subvolume id The extendable syscall *statx* also returns the subvolume id and sets the *result_mask* bit *STATX_SUBVOL*. 6.9 - reflinked file range and concurrent read An optimization for concurrent access to a range that is reflinked and read at the same time, the read latency is decreased due to reduced locking. 6.10 - automatic stale subvolume group removal This applies to 0 level qgroups (the one automatically created for a subvolume), once the subvolume is deleted the respective qgroup is also deleted. This may take some time until the qgroup accounting is correct and consistent again as the subvolume deletion is delayed. This is also affected by presence of the subvolume qgroup in higher level qgroups or the sysfs setting of *drop_subtree_threshold* that will need a quota rescan. 6.10 - sysfs reports reclaim status A per-filesystem report of background reclaim status, file names matching *reclaim_* in the space info directory. 6.10 - tunable dynamic background reclaim threshold Run background block group reclaim (using the relocation/balance mechanism) if the used size is above the configured value and the dynamic reclaim is enabled (not by default). When enabled, there's a heuristic that ties to avoid increasing system load if there's enough unallocated space but will try hard (but cannot be perfect) to avoid a situation when there's last chunk remaining to make the relocation possible. 6.10 - new mount option rescue= mode *ignoremetacsums* When enabled, any metadata checksum mismatch is ignored (in read-only mount), this may be useful in an interrupted checksum type conversion (:doc:`btrfstune`). 6.10 - new mount option rescue= mode *ignoresuperflags* An option to ignore unknown super block flags, at this point applies only to the interrupted checksum conversion, but can be useful for similar operations in the future. 6.10 - tree-checker updates Properly verify all types of directory items and reject unknown ones. Do relevant device item checks. 6.10 - allow to clone/reflink the tail extent Check if the last inode extent (not a full block length) can be cloned and do it, this fixes a problem in send/receive. 6.10 - unlink updates ctime Mandated by POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html), the link count is changed. 6.11 - unconditionally wake up cleaner thread on SYNC ioctl Avoid indirection when the BTRFS_IOC_SYNC ioctl is called and wake up the cleaner thread which is among other things responsible to clean deleted subvolumes. 6.11 - reduced locking around buffered reads Improve concurrency by reducing scope of locking around buffered reads. The direct io is still locked but this should not be mixed with buffered writes. 6.12 - cancellable discard/TRIM Add more points where the discard can be interrupted by signals before it finishes the whole operation. 6.13 - new config option CONFIG_BTRFS_EXPERIMENTAL Add separate config option to distinguish purely debugging features (like extended safety checks) and features that still need some refinements (and were hidden under the debugging config option not to expose them to users). When enabled this namely covers extent tree v2, raid stripe tree, send protocol version 3 and checksum offloading strategy. 6.13 - encoded read integration with io_uring The io_uring subsystem understands a command that is directed to Btrfs encoded read ioctl. 6.13 - new ioctl to wait for cleaned subvolumes Add specialized ioctl to wait for deleted (and maybe not yet cleaned) subvolumes, available to any user. The related command :command:`btrfs subvolume sync` uses the privileged SEARCH_TREE ioctl otherwise. 6.13 - seeding device use case change The sprout device (the writable one added to the seeding device) does not touch the superblock read-only status, preventing removal of accumulated deleted snapshots to be cleaned. 6.13 - update tree-checker to detect more wrong inline extent references 5.x --- 5.0 - swapfile With some limitations where COW design does not work well with the swap implementation (nodatacow file, no compression, cannot be snapshotted, not possible on multiple devices, ...), as this is the most restricted but working setup, we'll try to improve that in the future 5.0 - metadata uuid An optional incompat feature to assign a new filesystem UUID without overwriting all metadata blocks, stored only in superblock, unlike what :command:`btrfstune -u` 5.1 - FORGET_DEV ioctl Unregister devices previously added by the scan ioctl, same effect as if the kernel module is reloaded. 5.1 - ZSTD level Allow to set the ZSTD compression level via mount option, e.g. like *compress=zstd:9*. The levels match the default ZSTD compression levels. The default is 3, maximum is 15. 5.2 - pre-write checks Verify metadata blocks before submitting them to the devices. This can catch consistency problems or bitflips. 5.5 - more checksums New checksum algorithms: xxhash (64b), SHA256 (256b), BLAKE2b (256b). 5.5 - RAID1C34 RAID1 with 3- and 4- copies (over all devices). 5.6 - async discard Mode of discard (*mount -o discard=async*) that merges freed extents to larger chunks and submits them for discard in a less intrusive way 5.6 - device info in sysfs More information about device state can be found in per-filesystem sysfs directory. 5.7 - reflink/clone works on inline files Inline files can be reflinked to the tail extent of other files 5.7 - faster balance cancel More cancellation points in balance that will shorten the time to stop processing once :command:`btrfs balance cancel` is called. 5.7 - *removed flag BTRFS_SUBVOL_CREATE_ASYNC* Remove support of flag BTRFS_SUBVOL_CREATE_ASYNC from subvolume creation ioctl. 5.7 - v2 of snapshot deletion ioctl New ioctl BTRFS_IOC_SNAP_DESTROY_V2, deletion by subvolume id is now possible. 5.9 - mount option *rescue* Unified mount option for actions that may help to access a damaged filesystem. Now supports: nologreplay, usebackuproot 5.9 - qgroups in sysfs The information about qgroup status and relations is exported in :file:`/sys/fs/UUID/qgroups` 5.9 - FS_INFO ioctl Export more information: checksum type, checksum size, generation, metadata_uuid 5.10 - exclusive ops in sysfs Export which filesystem exclusive operation is running (balance, resize, device add/delete/replace, ...) 5.11 - remove *inode_cache* Remove inode number caching feature (mount -o inode_cache) 5.11 - more rescue= modes Additional modes for mount option *rescue=*: ignorebadroots/ibadroots, ignoredatacsums/idatacsums. All are exported in :file:`/sys/fs/btrfs/features/supported_rescue_options`. 5.12 - zoned mode Support for zoned devices with special allocation/write mode to fixed-size zones. See :doc:`Zoned`. 5.13 - supported_sectorsizes in sysfs List supported sector sizes in sysfs file :file:`/sys/fs/btrfs/features/supported_sectorsizes`. 5.14 - sysfs scrub bw limit Tunable bandwidth limit :file:`/sys/fs/btrfs/FSID/devinfo/DEVID/scrub_speed_max` for scrub (and device replace) for a given device. 5.14 - sysfs device stats The device stats can be also found in :file:`/sys/fs/btrfs/FSID/devinfo/DEVID/error_stats`. 5.14 - cancellable resize, device delete The filesystem resize and device delete operations can be cancelled by specifying *cancel* as the device name. 5.14 - property value reset Change how empty value is interpreted. New behaviour will delete the value and reset it to default. This affects *btrfs.compression* where value *no* sets NOCOMPRESS bit while empty value resets all compression settings (either compression or NOCOMPRESS bit). 5.15 - fsverity The fs-verity is a support layer that filesystems can hook into to support transparent integrity and authenticity protection of read-only files. https://www.kernel.org/doc/html/latest/filesystems/fsverity.html 5.15 - idmapped mount Support mount with UID/GID mapped according to another namespace. https://lwn.net/Articles/837566/ 5.16 - ZNS in zoned Zoned namespaces. https://zonedstorage.io/docs/introduction/zns , https://lwn.net/Articles/865988/ 5.17 - send and relocation Send and relocation (balance, device remove, shrink, block group reclaim) can now work in parallel. 5.17 - device add vs balance It is possible to add a device with paused balance. .. note:: Since kernel 5.17.7 and btrfs-progs 5.17.1 5.17 - *no warning with flushoncommit* Mounting with *-o flushoncommit* does not trigger the (harmless) warning at each transaction commit. .. note:: Also backported to 5.15.27 and 5.16.13 5.18 - zoned and DUP metadata DUP metadata works with zoned mode. 5.18 - encoded data ioctl New ioctls to read and write pre-encoded data (i.e. no transformation and directly written as extents), now works for compressed data. 5.18 - *removed balance ioctl v1* The support for ioctl BTRFS_IOC_BALANCE has been removed, superseded by BTRFS_IOC_BALANCE_V2 long time ago. 5.18 - *cross-mount reflink works* The VFS limitation to reflink files on separate subvolume mounts of the same filesystem has been removed. 5.18 - syslog error messages with filesystem state Messages are printed with a one letter tag ("state: X") that denotes in which state the filesystem was at this point: * A - transaction aborted (permanent) * E - filesystem error (permanent) * M - remount in progress (transient) * R - device replace in progress (transient) * C - checksum checks disabled by mount option (rescue=ignoredatacsums) * L - log tree replay did not complete due to some error 5.18 - tree-checker verifies transaction id pre-write Metadata buffer to be written gets an extra check if the stored transaction number matches the current state of the filesystem. 5.19 - subpage support pages > 4KiB Metadata node size is supported regardless of the CPU page size (minimum size is 4KiB), data sector size is supported <= page size. Additionally subpage also supports RAID56. 5.19 - per-type background threshold for reclaim Add sysfs tunable for background reclaim threshold for all block group types (data, metadata, system). 5.19 - automatically repair device number mismatch Device information is stored in two places, the number in the super block and items in the device tree. When this is goes out of sync, e.g. by device removal short before unmount, the next mount could fail. The b-tree is an authoritative information an can be used to override the stale value in the superblock. 5.19 - defrag can convert inline files to regular ones The logic has been changed so that inline files are considered for defragmentation even if the mount option max_inline would prevent that. No defragmentation might happen but the inlined files are not skipped. 5.19 - explicit minimum zone size is 4MiB Set the minimum limit of zone on zoned devices to 4MiB. Real devices zones are much larger, this is for emulated devices. 5.19 - sysfs tunable for automatic block group reclaim Add possibility to set a threshold to automatically reclaim block groups also in non-zoned mode. By default completely empty block groups are reclaimed automatically but the threshold can be tuned in :file:`/sys/fs/btrfs/FSID/allocation/PROFILE/bg_reclaim_threshold`. 5.19 - tree-checker verifies metadata block ownership Additional check done by tree-checker to verify relationship between a tree block and it's tree root owner. 4.x --- 4.0 - store otime Save creation time (otime) for all new files and directories. For future use, current tool cannot read it directly. 4.2 - rootid ioctl accessible The INO_LOOKUP will return root id (id of the containing subvolume), unrestricted and to all users if the *treeid* is 0. 4.2 - dedupe possible on the same inode The EXTENT_SAME ioctl will accept the same inode as source and destination (ranges must not overlap). 4.3 - trim all free space Trim will be performed also on the space that's not allocated by the chunks, not only free space within the allocated chunks. 4.4 - balance filter updates Enhanced syntax and new balance filters: * limit=min..max * usage=min..max * stripes=min..max 4.5 - free space tree Improved implementation of free space cache (aka v2), using b-trees. .. note:: Default since btrfs-progs 5.15, Kernel 4.9 fixes endianness bugs on big-endian machines, x86* is ok 4.5 - balance filter updates Conversion to data/DUP profile possible through balance filters -- on single-device filesystem. .. note:: mkfs.btrfs allows creating DUP on single device in the non-mixed mode since 4.4 4.6 - max_inline default The default value of max_inline changed to 2048. 4.6 - read features from control device The existing ioctl GET_SUPPORTED_FEATURES can be now used on the control device (:file:`/dev/btrfs-control`) and returns the supported features without any mounted filesystem. 4.7 - delete device by id Add new ioctl RM_DEV_V2, pass device to be deleted by its ID. 4.7 - more renameat2 modes Add support for RENAME_EXCHANGE and RENAME_WHITEOUT to *renameat2* syscall. This also means that *overlayfs* is now supported on top of btrfs. 4.7 - balance filter updates Conversion to data/DUP profile possible through balance filters -- on multiple-device filesystems. .. note:: mkfs.btrfs allows creating DUP on multiple devices since 4.5.1 4.12 - RAID56: auto repair Scrub will attempt auto-repair (similar to raid1/raid10) 4.13 - statx Support for the enhanced statx syscall; file creation timestamp 4.13 - sysfs qgroups override qgroups: new sysfs control file to allow temporary quota override with CAP_SYS_RESOURCE 4.13 - *deprecated mount option alloc_start* That was a debugging helper, not used and not supposed to be used nowadays. 4.14 - ZSTD compression New compression algorithm ZSTD, supposedly better ratio/speed performance. 4.14 - improved degraded mount Allow degraded mount based on the chunk constraints, not device number constraints. E.g. when one device is missing but the remaining one holds all *single* chunks. 4.14 - *deprecated user transaction ioctl* BTRFS_IOC_TRANS_START and BTRFS_IOC_TRANS_END, no known users, tricky to use; scheduled to be removed in 4.17 4.14 - refine SSD optimizations The mount option *ssd* does not make any assumptions about block layout or management by the device anymore, leaving only the speedups based on low seek cost active. This could avoid some corner cases leading to excessive fragmentation. https://git.kernel.org/linus/583b723151794e2ff1691f1510b4e43710293875 The story so far. 4.15 - overlayfs Overlayfs can now use btrfs as the lower filesystem. 4.15 - *ref-verify* Debugging functionality to verify extent references. New mount option *ref-verify*, must be built with CONFIG_BTRFS_FS_REF_VERIFY. 4.15 - ZLIB level Allow to set the ZLIB compression level via mount option, e.g. like *compress=zlib:9*. The levels match the default ZLIB compression levels. The default is 3. 4.15 - v2 of LOGICAL_INO ioctl An enhanced version of ioctl that can translate logical extent offset to inode numbers, "who owns this block". For certain use cases the V1 performs bad and this is addressed by V2. See for more https://git.kernel.org/linus/d24a67b2d997c860a42516076f3315c2ad2d2884 . 4.15 - compression heuristics Apply a few heuristics to the data before they're compressed to decide if it's likely to gain any space savings. The methods: frequency sampling, repeated pattern detection, Shannon entropy calculation. 4.16 - fallocate: zero range Mode of the *fallocate* syscall to zero file range. 4.17 - *removed user transaction ioctl* Deprecated in 4.14, see above. 4.17 - *rmdir* on subvolumes Allow *rmdir* to delete an empty subvolume. 4.18 - XFLAGS ioctl Add support for ioctl FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR, successor of FS_IOC_SETFLAGS/FS_IOC_GETFLAGS ioctl. Currently supports: APPEND, IMMUTABLE, NOATIME, NODUMP, SYNC. Note that the naming is very confusing, though it's named *xattr*, it does not mean the extended attributes. It should be referenced as extended inode flags or *xflags*. 4.18 - EXTENT_SAME ioctl / 16MiB chunks The range for out-of-band deduplication implemented by the EXTENT_SAME ioctl will split the range into 16MiB chunks. Up to now this was the overall limit and effectively only the first 16MiB was deduplicated. 4.18 - GET_SUBVOL_INFO ioctl New ioctl to read subvolume information (id, directory name, generation, flags, UUIDs, time). This does not require root permissions, only the regular access to to the subvolume. 4.18 - GET_SUBVOL_ROOTREF ioctl New ioctl to enumerate subvolume references of a given subvolume. This does not require root permissions, only the regular access to to the subvolume. 4.18 - INO_LOOKUP_USER ioctl New ioctl to lookup path by inode number. This does not require root permissions, only the regular access to to the subvolume, unlike the INO_LOOKUP ioctl. 4.19 - defrag ro/rw Allow to run defrag on files that are normally accessible for read-write, but are currently opened in read-only mode. 3.x --- 3.0 - scrub Read all data and verify checksums, repair if possible. 3.2 - auto raid repair Automatic repair of broken data from a good copy 3.2 - root backups Save a few previous versions of the most important tree roots at commit time, used by *-o recovery* 3.3 - integrity checker Optional infrastructure to verify integrity of written metadata blocks 3.3 - backref walking Groundwork to allow tracking owner of blocks, used via *inspect-internal* 3.3 - restriper RAID profiles can be changed on-line, balance filters 3.4 - big metadata blocks Support for metadata blocks larger than page size .. note:: Default nodesize is 16KiB since btrfs-progs 3.12 3.4 - error handling Generic infrastructure for graceful error handling (EIO) 3.5 - device statistics Persistent statistics about device errors 3.5 - fsync speedup Noticeable improvements in fsync() implementation 3.6 - qgroups Subvolume-aware quotas 3.6 - send/receive Ability to transfer one filesystem via a data stream (full or incremental) and apply the changes on a remote filesystem. 3.7 - extrefs Hardlink count limit is lifted to 65536. .. note:: Default since btrfs-progs 3.12 3.7 - hole punching Implement the FALLOC_FL_PUNCH_HOLE mode of *fallocate*. 3.8 - device replace Efficient replacement of existing device (add/remove in one go). 3.9 - raid 5/6 *(incomplete)* Basic support for RAID5/6 profiles, no crash resiliency, replace and scrub support. 3.9 - snapshot-aware defrag Defrag does not break links between shared extents (snapshots, reflinked files). .. note:: Disabled since 3.14 (and backported to some stable kernel versions) due to problems. Has been completely removed in 5.6. 3.9 - lightweight send A mode of *send* that does not add the actual file data to the stream. 3.9 - on-line label set/get Label editable on mounted filesystems. 3.10 - skinny metadata Reduced metadata size (format change) of extents. .. note:: Default since btrfs-progs 3.18 3.10 - qgroup rescan Sync qgroups with existing filesystem data. 3.12 - UUID tree A map of subvolume/UUID that vastly speeds up send/receive. 3.12 - out-of-bound deduplication Support for deduplicating extents on a given set of files. 3.14 - no-holes No extent representation for file holes (format change), may reduce overall metadata consumption 3.14 - feature bits in sysfs :file:`/sys/fs/btrfs` exports various bits about filesystem capabilities and feature support 3.16 - O_TMPFILE Mode of open() to safely create a temporary file 3.16 - search ioctl v2 The extended SEARCH_TREE ioctl able to get more than a 4k data 3.18 - auto block group reclaim Automatically remove block groups (aka. chunks) that become completely empty. 3.19 - RAID56: scrub, replace Scrub and device replace works on RAID56 filesystems. btrfs-progs-6.14/Documentation/Glossary.rst000066400000000000000000000000601477105376400210740ustar00rootroot00000000000000Glossary ======== .. include:: ch-glossary.rst btrfs-progs-6.14/Documentation/Hardware.rst000066400000000000000000000001351477105376400210310ustar00rootroot00000000000000Hardware considerations ======================= .. include:: ch-hardware-considerations.rst btrfs-progs-6.14/Documentation/INSTALL.rst000077700000000000000000000000001477105376400216422../INSTALLustar00rootroot00000000000000btrfs-progs-6.14/Documentation/Inline-files.rst000066400000000000000000000037261477105376400216230ustar00rootroot00000000000000Inline files ============ Files up to some size can be stored in the metadata section ("inline" in the b-tree nodes), i.e. no separate blocks for the extents. The default limit is 2048 bytes and can be configured by mount option ``max_inline``. The data of inlined files can be also compressed as long as they fit into the b-tree nodes. If the filesystem has been created with different data and metadata profiles, namely with different level of integrity, this also affects the inlined files. It can be completely disabled by mounting with ``max_inline=0``. The upper limit is either the size of b-tree node or the page size of the host. An inline file can be identified by enumerating the extents, e.g. by the tool :command:`filefrag`: .. code-block:: bash $ filefrag -v inlinefile Filesystem type is: 9123683e File size of inlinefile is 463 (1 block of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 4095: 0.. 4095: 4096: last,not_aligned,inline,eof In the above example, the file is not compressed, otherwise it would have the *encoded* flag. The inline files have no limitations and behave like regular files with respect to copying, renaming, reflink, truncate etc. .. note:: This is not `tail packing `__, known e.g. from `ReiserFS `__ . The whole inline file must fit and is stored in the metadata block. Larger files have their extents stored in blocks and the last one can be underutilized. With tail packing such blocks would be stored elsewhere out of order, possibly mixed with other last blocks from other files. This was an early design decision not to implement it due to experience with the complexity in ReiserFS and does not seem justified with the possible space savings in the data blocks but increased metadata to track the packed blocks. btrfs-progs-6.14/Documentation/Interoperability.rst000066400000000000000000000061361477105376400226300ustar00rootroot00000000000000.. BTRFS integration related pages index Interoperability ================ .. _interop-cgroups: cgroups ------- Cgroups are supported for the IO controller, for compressed and uncompressed data. This can be used to limit bandwidth or for accounting. The cgroups can be configured directly or e.g. via systemd directives *IOAccounting*, *IOWeight* etc. See also :manref:`systemd.resource-control(5)`. .. _interop-fsverity: fsverity -------- The fs-verity is a support layer that filesystems can hook into to support transparent integrity and authenticity protection of read-only files. This requires a separate management utility :command:`fsverity`. The ioctls supported by btrfs: * `FS_IOC_ENABLE_VERITY `__ * `FS_IOC_MEASURE_VERITY `__ * `FS_IOC_READ_VERITY_METADATA `__ See also: https://www.kernel.org/doc/html/latest/filesystems/fsverity.html .. _interop-idmapped: idmapped mounts --------------- Btrfs supports mount with UID/GID mapped according to another namespace since version 5.15. See also: https://lwn.net/Articles/837566/ Device mapper, MD-RAID ---------------------- Btrfs works on top of device mapper (DM) and linux multi-device software RAID (MD-RAID) block devices transparently without any need for additional configuration. There is no integration so device failures are not handled automatically in any way, must be resolved either in btrfs or on the DM/MD layer. The functionality of DM/MD may duplicate the one provided by btrfs (like mirroring), it's possible to use it that way but it's probably wasteful and may degrade performance. Creating a filesystem on top of the multiplexed device is likely the desired way. overlayfs --------- Since kernel 4.15 the btrfs filesystem can be used as *lower* filesystem for overlayfs (supporting the rename modes of *exchange* and *whiteout*). SELinux ------- The SELinux labels can be defined via mount option *context* and since version 6.8 there are no limitations. Until that version some cases were not supported. .. _interop-io-uring: io_uring -------- Basic file operations are supported. Since 6.12 the *Encoded IO read/write ioctls* the *read* is supported and write since 6.13. .. _interop-nfs: NFS --- NFS is supported. When exporting a subvolume it is recommended to use the *fsid* option with a unique id in case the server needs to restart. This is recommended namely when clients use the mount option *hard*. Example of server side export: .. code-block:: none /mnt/data/subvolume1 192.168.1.2/24(fsid=12345,rw,sync) /mnt/data/subvolume2 192.168.1.2/24(fsid=23456,rw,sync) See also :manref:`exports(5)`. .. _interop-samba: Samba ----- The Samba VFS module *btrfs* adds support for compression, snapshots and server-side copy (backed by reflink/clone range ioctl). See also: https://wiki.samba.org/index.php/Server-Side_Copy#Btrfs_Enhanced_Server-Side_Copy_Offload btrfs-progs-6.14/Documentation/Introduction.rst000066400000000000000000000067121477105376400217640ustar00rootroot00000000000000Introduction ============ BTRFS is a modern copy on write (COW) filesystem for Linux aimed at implementing advanced features while also focusing on fault tolerance, repair and easy administration. Its main features and benefits are: * Snapshots which do not make a full copy of the files * Built-in volume management, support for software-based RAID 0, RAID 1, RAID 10 and others * Self-healing - checksums for data and metadata, automatic detection of silent data corruptions * Data compression * Reflinks, fast and efficient file copies Feature overview ---------------- * Extent based file storage * 2\ :sup:`64` byte (16 EiB) :ref:`maximum file size` (practical limit is 8 EiB due to Linux VFS) * :doc:`Space-efficient packing of small files` * Space-efficient indexed directories * :ref:`Dynamic inode allocation` * :doc:`Writable snapshots, read-only snapshots, subvolumes (separate internal filesystem roots)` * :doc:`Checksums on data and metadata` (crc32c, xxhash, sha256, blake2b) * :doc:`Compression (ZLIB, LZO, ZSTD), heuristics` * :doc:`Integrated multiple device support`: * File Striping (like RAID0) * File Mirroring (like RAID1 up to 4 copies) * File Striping+Mirroring (like RAID10) * Single and Dual Parity implementations (like RAID5/6, experimental, not production-ready) * SSD/NVMe (flash storage) awareness, :doc:`TRIM/Discard` for reporting free blocks for reuse and optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters. * :doc:`Background scrub` process for finding and repairing errors of files with redundant copies * :doc:`Online filesystem defragmentation` * :doc:`Offline filesystem check` * :doc:`In-place conversion` of existing ext2/3/4 and reiserfs filesystems * :doc:`Seeding device.` Create a (readonly) filesystem that acts as a template to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged. * :doc:`Subvolume-aware quota` support * :doc:`Send/receive of subvolume changes`, efficient incremental filesystem mirroring and backup * :doc:`Batch, or out-of-band deduplication` (happens after writes, not during) * :doc:`Swapfile support` * :doc:`Tree-checker`, post-read and pre-write metadata verification * :doc:`Zoned mode support` (SMR/ZBC/ZNS friendly allocation, emulated on non-zoned devices) A more detailed list of features and compatibility is on the :doc:`status page `. Quick start ----------- For a really quick start you can simply create and mount the filesystem. Make sure that the block device you'd like to use is suitable so you don't overwrite existing data. .. code-block:: shell # mkfs.btrfs /dev/sdx # mount /dev/sdx /mnt/test The default options should be acceptable for most users and sometimes can be changed later. The example above is for a single device filesystem, creating a *single* profile for data (no redundant copies of the blocks), and *DUP* for metadata (each block is duplicated). Read more about: * creating a filesystem at :doc:`mkfs.btrfs` * mount options at :doc:`Administration` btrfs-progs-6.14/Documentation/Kernel-by-version.rst000066400000000000000000002723551477105376400226260ustar00rootroot00000000000000Changes (kernel/version) ======================== Summary of kernel changes for each version. 6.x --- 6.0 (Oct 2022) ^^^^^^^^^^^^^^ Pull requests: `v6.0-rc1 `__, `v6.0-rc1 `__, `v6.0-rc2 `__, `v6.0-rc3 `__, `v6.0-rc5 `__, `v6.0-rc7 `__ - sysfs updates: - export chunk size, in debug mode add tunable for setting its size - show zoned among features (was only in debug mode) - show commit stats (number, last/max/total duration) - mixed_backref and big_metadata sysfs feature files removed, they've been default for sufficiently long time, there are no known users and mixed_backref could be confused with mixed_groups - send protocol updated to version 2 - new commands: - ability write larger data chunks than 64K - send raw compressed extents (uses the encoded data ioctls), ie. no decompression on send side, no compression needed on receive side if supported - send 'otime' (inode creation time) among other timestamps - send file attributes (a.k.a file flags and xflags) - this is first version bump, backward compatibility on send and receive side is provided - there are still some known and wanted commands that will be implemented in the near future, another version bump will be needed, however we want to minimize that to avoid causing usability issues - print checksum type and implementation at mount time - don't print some messages at mount (mentioned as people asked about it), we want to print messages namely for new features so let's make some space for that: - big metadata - this has been supported for a long time and is not a feature that's worth mentioning - skinny metadata - same reason, set by default by mkfs Performance improvements: - reduced amount of reserved metadata for delayed items - when inserted items can be batched into one leaf - when deleting batched directory index items - when deleting delayed items used for deletion - overall improved count of files/sec, decreased subvolume lock contention - metadata item access bounds checker micro-optimized, with a few percent of improved runtime for metadata-heavy operations - increase direct io limit for read to 256 sectors, improved throughput by 3x on sample workload Notable fixes: - raid56 - reduce parity writes, skip sectors of stripe when there are no data updates - restore reading from stripe cache instead of triggering new read - refuse to replay log with unknown incompat read-only feature bit set - tree-checker verifies if extent items don't overlap - check that subvolume is writable when changing xattrs from security namespace - fix space cache corruption and potential double allocations; this is a rare bug but can be serious once it happens, stable backports and analysis tool will be provided - zoned: - fix page locking when COW fails in the middle of allocation - improved tracking of active zones, ZNS drives may limit the number and there are ENOSPC errors due to that limit and not actual lack of space - adjust maximum extent size for zone append so it does not cause late ENOSPC due to underreservation - mirror reading error messages show the mirror number - don't fallback to buffered IO for NOWAIT direct IO writes, we don't have the NOWAIT semantics for buffered io yet - send, fix sending link commands for existing file paths when there are deleted and created hardlinks for same files - repair all mirrors for profiles with more than 1 copy (raid1c34) - fix repair of compressed extents, unify where error detection and repair happen 6.1 (Dec 2022) ^^^^^^^^^^^^^^ Pull requests: `v6.1-rc1 `__, `v6.1-rc1 `__, `v6.1-rc2 `__, `v6.1-rc4 `__, `v6.1-rc4 `__, `v6.1-rc5 `__, `v6.1-rc7 `__ Performance: - outstanding FIEMAP speed improvements: - algorithmic change how extents are enumerated leads to orders of magnitude speed boost (uncached and cached) - extent sharing check speedup (2.2x uncached, 3x cached) - add more cancellation points, allowing to interrupt seeking in files with large number of extents - more efficient hole and data seeking (4x uncached, 1.3x cached) - sample results: 256M, 32K extents: 4s -> 29ms (~150x) 512M, 64K extents: 30s -> 59ms (~550x) 1G, 128K extents: 225s -> 120ms (~1800x) - improved inode logging, especially for directories (on dbench workload throughput +25%, max latency -21%) - improved buffered IO, remove redundant extent state tracking, lowering memory consumption and avoiding rb tree traversal - add sysfs tunable to let qgroup temporarily skip exact accounting when deleting snapshot, leading to a speedup but requiring a rescan after that, will be used by snapper - support io_uring and buffered writes, until now it was just for direct IO, with the no-wait semantics implemented in the buffered write path it now works and leads to speed improvement in IOPS (2x), throughput (2.2x), latency (depends, 2x to 150x) - small performance improvements when dropping and searching for extent maps as well as when flushing delalloc in COW mode (throughput +5MB/s) User visible changes: - new incompatible feature block-group-tree adding a dedicated tree for tracking block groups, this allows a much faster load during mount and avoids seeking unlike when it's scattered in the extent tree items - this reduces mount time for many-terabyte sized filesystems - conversion tool will be provided so existing filesystem can also be updated in place - to reduce test matrix and feature combinations requires no-holes and free-space-tree (mkfs defaults since 5.15) - improved reporting of super block corruption detected by scrub - scrub also tries to repair super block and does not wait until next commit - discard stats and tunables are exported in sysfs (/sys/fs/btrfs/FSID/discard) - qgroup status is exported in sysfs (/sys/sys/fs/btrfs/FSID/qgroups/) - verify that super block was not modified when thawing filesystem Fixes: - FIEMAP fixes: - fix extent sharing status, does not depend on the cached status where merged - flush delalloc so compressed extents are reported correctly - fix alignment of VMA for memory mapped files on THP - send: fix failures when processing inodes with no links (orphan files and directories) - handle more corner cases for read-only compat feature verification - fix crash on raid0 filesystems created with <5.4 mkfs.btrfs that could lead to division by zero Core: - preliminary support for fs-verity in send - more effective memory use in scrub for subpage where sector is smaller than page - block group caching progress logic has been removed, load is now synchronous - add no-wait semantics to several functions (tree search, nocow, flushing, buffered write 6.2 (Feb 2023) ^^^^^^^^^^^^^^ Pull requests: `v6.2-rc1 `__, `v6.2-rc3 `__, `v6.2-rc3 `__, `v6.2-rc5 `__, `v6.2-rc5 `__, `v6.2-rc5 `__, `v6.2-rc8 `__, `v6.2-rc8 `__ User visible features: - raid56 reliability vs performance trade off: - fix destructive RMW for raid5 data (raid6 still needs work) - do full RMW cycle for writes and verify all checksums before overwrite, this should prevent rewriting potentially corrupted data without notice - stripes are cached in memory which should reduce the performance impact but still can hurt some workloads - checksums are verified after repair again - this is the last option without introducing additional features (write intent bitmap, journal, another tree), the RMW cycle was supposed to be avoided by the original implementation exactly for performance reasons but that caused all the reliability problems - discard=async by default for devices that support it - implement emergency flush reserve to avoid almost all unnecessary transaction aborts due to ENOSPC in cases where there are too many delayed refs or delayed allocation - skip block group synchronization if there's no change in used bytes, can reduce transaction commit count for some workloads - print more specific errors to system log when device scan ioctl fails Performance improvements: - fiemap and lseek: - overall speedup due to skipping unnecessary or duplicate searches (-40% run time) - cache some data structures and sharedness of extents (-30% run time) - send: - faster backref resolution when finding clones - cached leaf to root mapping for faster backref walking - improved clone/sharing detection - overall run time improvements (-70%) Fixes: - fix compat ro feature check at read-write remount - handle case when read-repair happens with ongoing device replace - reset defrag ioctl buffer on memory allocation error - fix potential crash in quota when rescan races with disable - fix qgroup accounting warning when rescan can be started at time with temporarily disabled accounting - don't cache a single-device filesystem device to avoid cases when a loop device is reformatted and the entry gets stale - limit number of send clones by maximum memory allocated 6.3 (Apr 2023) ^^^^^^^^^^^^^^ Pull requests: `v6.3-rc1 `__, `v6.3-rc2 `__, `v6.3-rc4 `__, `v6.3-rc5 `__, `v6.3-rc7 `__, `v6.3 `__ Features: - block group allocation class heuristics: - pack files by size (up to 128k, up to 8M, more) to avoid fragmentation in block groups, assuming that file size and life time is correlated, in particular this may help during balance - with tracepoints and extensible in the future - sysfs export of per-device fsid in DEV_INFO ioctl to distinguish seeding devices, needed for testing - print sysfs stats for the allocation classes Performance: - send: cache directory utimes and only emit the command when necessary - speedup up to 10x - smaller final stream produced (no redundant utimes commands issued), - compatibility not affected - fiemap: - skip backref checks for shared leaves - speedup 3x on sample filesystem with all leaves shared (e.g. on snapshots) - micro optimized b-tree key lookup, speedup in metadata operations (sample benchmark: fs_mark +10% of files/sec) Core changes: - change where checksumming is done in the io path - checksum and read repair does verification at lower layer - cascaded cleanups and simplifications Fixes: - sysfs: make sure that a run-time change of a feature is correctly tracked by the feature files - scrub: better reporting of tree block errors - fix calculation of unusable block group space reporting bogus values due to 32/64b division - fix unnecessary increment of read error stat on write error - scan block devices in non-exclusive mode to avoid temporary mkfs failures - fix fast checksum detection, this affects filesystems with non-crc32c checksum, calculation would not be offloaded to worker threads (since 5.4) - restore thread_pool mount option behaviour for endio workers, the new value for maximum active threads would not be set to the actual work queues (since 6.0) 6.4 (Jun 2023) ^^^^^^^^^^^^^^ Pull requests: `v6.4-rc1 `__, `v6.4-rc2 `__, `v6.4-rc2 `__, `v6.4-rc4 `__, `v6.4-rc5 `__, `v6.4-rc5 `__, `v6.4-rc7 `__, `v6.4-rc7 `__, `v6.4 `__, `v6.4 `__ Performance improvements: - improve logging changes in a directory during one transaction, avoid iterating over items and reduce lock contention (fsync time 4x lower) - when logging directory entries during one transaction, reduce locking of subvolume trees by checking tree-log instead (improvement in throughput and latency for concurrent access to a subvolume) Notable fixes: - device replace: - properly honor read mode when requested to avoid reading from source device - target device won't be used for eventual read repair, this is unreliable for NODATASUM files - when there are unpaired (and unrepairable) metadata during replace, exit early with error and don't try to finish whole operation - scrub ioctl properly rejects unknown flags - fix partial direct io write when there's a page fault in the middle, iomap will try to continue with partial request but the btrfs part did not match that, this can lead to zeros written instead of data - fix backref walking, this breaks a mode of LOGICAL_INO_V2 ioctl that is used in deduplication tools - make mount option clear_cache work with block-group-tree, to rebuild free-space-tree instead of temporarily disabling it that would lead to a forced read-only mount Core changes: - io path - continued cleanups and refactoring around bio handling - extent io submit path simplifications and cleanups - flush write path simplifications and cleanups - rework logic of passing sync mode of bio, with further cleanups - rewrite scrub code flow, restructure how the stripes are enumerated and verified in a more unified way - allow to set lower threshold for block group reclaim in debug mode to aid zoned mode testing - remove obsolete time-based delayed ref throttling logic when truncating items 6.5 (Aug 2023) ^^^^^^^^^^^^^^ Pull requests: `v6.5-rc1 `__, `v6.5-rc3 `__, `v6.5-rc4 `__, `v6.5-rc6 `__, `v6.5-rc7 `__ Performance improvements: - speedup in fsync(), better tracking of inode logged status can avoid transaction commit - IO path structures track logical offsets in data structures and does not need to look it up - submit IO synchronously for fast checksums (crc32c and xxhash), remove high priority worker kthread User visible changes: - don't commit transaction for every created subvolume, this can reduce time when many subvolumes are created in a batch - print affected files when relocation fails - trigger orphan file cleanup during START_SYNC ioctl - the ``async=discard`` has been enabled in 6.2 unconditionally, but for zoned mode it does not make that much sense to do it asynchronously as the zones are reset as needed 6.6 (Oct 2023) ^^^^^^^^^^^^^^ Pull requests: `v6.6-rc1 `__, `v6.6-rc2 `__, `v6.6-rc3 `__, `v6.6-rc4 `__, `v6.6-rc5 `__, `v6.6-rc6 `__, `v6.6-rc7 (1) `__, `v6.6-rc8 (2) `__, Notable fixes: - scrub performance drop due to rewrite in 6.4 partially restored, the drop is noticeable on fast PCIe devices, -66% and restored to -33% of the original - copy directory permissions and time when creating a stub subvolume - fix transaction commit stalls when auto relocation is running and blocks other tasks that want to commit - change behaviour of readdir()/rewinddir() when new directory entries are created after opendir(), properly tracking the last entry Core: - debugging feature integrity checker deprecated, to be removed in 6.7 - in zoned mode, zones are activated just before the write, making error handling easier, now the overcommit mechanism can be enabled again which improves performance by avoiding more frequent flushing - v0 extent handling completely removed, deprecated long time ago 6.7 (Jan 2024) ^^^^^^^^^^^^^^ Pull requests: `v6.7-rc1 `__, `v6.7-rc2 `__, `v6.7-rc4 `__, `v6.7-rc6 (1) `__, `v6.7-rc6 (2) `__, New features: - raid-stripe-tree: New tree for logical file extent mapping where the physical mapping may not match on multiple devices. This is now used in zoned mode to implement RAID0/RAID1* profiles, but can be used in non-zoned mode as well. The support for RAID56 is in development and will eventually fix the problems with the current implementation. This is a backward incompatible feature and has to be enabled at mkfs time. - simple quota accounting (squota): A simplified mode of qgroup that accounts all space on the initial extent owners (a subvolume), the snapshots are then cheap to create and delete. The deletion of snapshots in fully accounting qgroups is a known CPU/IO performance bottleneck. Note: The squota is not suitable for the general use case but works well for containers where the original subvolume exists for the whole time. This is a backward incompatible feature as it needs extending some structures, but can be enabled on an existing filesystem. - temporary filesystem fsid (temp_fsid): The fsid identifies a filesystem and is hard coded in the structures, which disallows mounting the same fsid found on different devices. For a single device filesystem this is not strictly necessary, a new temporary fsid can be generated on mount e.g. after a device is cloned. This will be used by Steam Deck for root partition A/B testing, or can be used for VM root images. - filesystems with partially finished metadata_uuid conversion cannot be mounted anymore and the uuid fixup has to be done by btrfs-progs (btrfstune). Performance improvements: - reduce reservations for checksum deletions (with enabled free space tree by factor of 4), on a sample workload on file with many extents the deletion time decreased by 12% - make extent state merges more efficient during insertions, reduce rb-tree iterations (run time of critical functions reduced by 5%) Core changes: - the integrity check functionality has been removed, this was a debugging feature and removal does not affect other integrity checks like checksums or tree-checker - space reservation changes: - more efficient delayed ref reservations, this avoids building up too much work or overusing or exhausting the global block reserve in some situations - move delayed refs reservation to the transaction start time, this prevents some ENOSPC corner cases related to exhaustion of global reserve - adjust overcommit logic in near full situations, account for one more chunk to eventually allocate metadata chunk, this is mostly relevant for small filesystems (<10GiB) - single device filesystems are scanned but not registered (except seed devices), this allows temp_fsid to work 6.8 (Mar 2024) ^^^^^^^^^^^^^^ Pull requests: `v6.8-rc1 `__, `v6.8-rc2 `__, `v6.8-rc4 `__, `v6.8-rc5 `__, `v6.8-rc6 `__, `v6.8-rc7 (1) `__, `v6.8-rc7 (2) `__ Core changes: - convert extent buffers to folios: - direct API conversion where possible - performance can drop by a few percent on metadata heavy workloads, the folio sizes are not constant and the calculations add up in the item helpers - both regular and subpage modes - data cannot be converted yet, we need to port that to iomap and there are some other generic changes required - convert mount to the new API, should not be user visible: - options deprecated long time ago have been removed: inode_cache, recovery - the new logic that splits mount to two phases slightly changes timing of device scanning for multi-device filesystems - LSM options will now work (like for selinux) - convert delayed nodes radix tree to xarray, preserving the preload-like logic that still allows to allocate with GFP_NOFS Performance improvements: - refactor chunk map structure, reduce size and improve performance - extent map refactoring, smaller data structures, improved performance - reduce size of struct extent_io_tree, embedded in several structures - temporary pages used for compression are cached and attached to a shrinker, this may slightly improve performance Fixes: - fix over-reservation of metadata chunks due to not keeping proper balance between global block reserve and delayed refs reserve; in practice this leaves behind empty metadata block groups, the workaround is to reclaim them by using the '-musage=1' balance filter - fix corner case of send that would generate potentially large stream of zeros if there's a hole at the end of the file - fix chunk validation in zoned mode on conventional zones, it was possible to create chunks that would not be allowed on sequential zones 6.9 (May 2024) ^^^^^^^^^^^^^^ Pull requests: `v6.9-rc1 (1) `__, `v6.9-rc1 (2) `__, `v6.9-rc2 `__, `v6.9-rc3 `__, `v6.9-rc5 `__, `v6.9-rc6 `__, `v6.9-rc7 `__, `v6.9-rc8 `__, Performance improvements: - minor speedup in logging when repeatedly allocated structure is preallocated only once, improves latency and decreases lock contention - minor throughput increase (+6%), reduced lock contention after clearing delayed allocation bits, applies to several common workload types - features under CONFIG_BTRFS_DEBUG: - sysfs knob for setting the how checksums are calculated when submitting IO, inline or offloaded to a thread, this affects latency and throughput on some block group profiles Notable fixes: - fix device tracking in memory that broke grub-probe - zoned mode fixes: - use zone-aware super block access during scrub - delete zones that are 100% unusable to reclaim space Other notable changes: - additional validation of devices by major:minor numbers 6.10 (Jul 2024) ^^^^^^^^^^^^^^^ Pull requests: `v6.10-rc1 (1) `__, `v6.10-rc1 (2) `__, `v6.10-rc3 (1) `__, `v6.10-rc3 (2) `__, `v6.10-rc5 `__, `v6.10-rc6 `__, `v6.10-rc7 (1) `__, `v6.10-rc7 (2) `__, `v6.10-rc8 `__, Performance improvements: - inline b-tree locking functions, improvement in metadata-heavy changes - relax locking on a range that's being reflinked, allows read operations to run in parallel - speed up NOCOW write checks (throughput +9% on a sample test) - extent locking ranges have been reduced in several places, namely around delayed ref processing Notable fixes or changes: - add back mount option *norecovery*, deprecated long time ago and removed in 6.8 but still in use - fix potential infinite loop when doing block group reclaim - extent map shrinker, allow memory consumption reduction for direct io loads 6.11 (Sep 2024) ^^^^^^^^^^^^^^^ Pull requests: `v6.11-rc1 (1) `__, `v6.11-rc1 (2) `__, `v6.11-rc2 `__, `v6.11-rc3 `__, `v6.11-rc4 `__, `v6.11-rc4 `__, `v6.11-rc6 `__, `v6.11-rc7 `__, User visible features: - dynamic block group reclaim: - tunable framework to avoid situations where eager data allocations prevent creating new metadata chunks due to lack of unallocated space - reuse sysfs knob bg_reclaim_threshold (otherwise used only in zoned mode) for a fixed value threshold - new on/off sysfs knob "dynamic_reclaim" calculating the value based on heuristics, aiming to keep spare working space for relocating chunks but not to needlessly relocate partially utilized block groups or reclaim newly allocated ones - stats are exported in sysfs per block group type, files "reclaim_*" - this may increase IO load at unexpected times but the corner case of no allocatable block groups is known to be worse - automatically remove qgroup of deleted subvolumes: - adjust qgroup removal conditions, make sure all related subvolume data are already removed, or return EBUSY, also take into account setting of sysfs drop_subtree_threshold - also works in squota mode - mount option updates: new modes of 'rescue=' that allow to mount images (read-only) that could have been partially converted by user space tools - ignoremetacsums - invalid metadata checksums are ignored - ignoresuperflags - super block flags that track conversion in progress (like UUID or checksums) Other notable changes or fixes: - space cache v1 marked as deprecated (a warning printed in syslog), the free-space tree (i.e. the v2) has been default in "mkfs.btrfs" since 5.15, the kernel code will be removed in the future on a conservative schedule - tree checker improvements: - validate data reference items - validate directory item type - send also detects last extent suitable for cloning (and not a write) - extent map shrinker (a memory reclaim optimization) added in 6.10 now available only under CONFIG_BTRFS_DEBUG due to performance problems - update target inode's ctime on unlink, `mandated by POSIX `__ - in zoned mode, detect unexpected zone write pointer change 6.12 (Nov 2024) ^^^^^^^^^^^^^^^ Pull requests: `v6.12-rc1 `__, `v6.12-rc1 `__, `v6.12-rc2 `__, `v6.12-rc3 `__, `v6.12-rc4 `__, `v6.12-rc5 `__, `v6.12-rc6 `__, `v6.12-rc7 `__, `v6.12 `__ User visible changes: - the FSTRIM ioctl updates the processed range even after an error or interruption - cleaner thread is woken up in SYNC ioctl instead of waking the transaction thread that can take some delay before waking up the cleaner, this can speed up cleaning of deleted subvolumes - print an error message when opening a device fail, e.g. when it's unexpectedly read-only Core changes: - improved extent map handling in various ways (locking, iteration, ...) - new assertions and locking annotations - raid-stripe-tree locking fixes - use xarray for tracking dirty qgroup extents, switched from rb-tree - turn the subpage test to compile-time condition if possible (e.g. on x86_64 with 4K pages), this allows to skip a lot of ifs and remove dead code - more preparatory work for compression in subpage mode Cleanups and refactoring: - folio API conversions, many simple cases where page is passed so switch it to folios - more subpage code refactoring, update page state bitmap processing - introduce auto free for btrfs_path structure, use for the simple cases 6.13 (Jan 2025) ^^^^^^^^^^^^^^^ Pull requests: `v6.13-rc1 `__, `v6.13-rc2 `__, `v6.13-rc3 `__, `v6.13-rc4 `__, `v6.13-rc5 `__, `v6.13-rc7 `__, `v6.13 `__ User visible changes: - wire encoded read (ioctl) to io_uring commands, this can be used on itself, in the future this will allow 'send' to be asynchronous. As a consequence, the encoded read ioctl can also work in non-blocking mode - new ioctl to wait for cleaned subvolumes, no need to use the generic and root-only SEARCH_TREE ioctl, will be used by "btrfs subvol sync" - recognize different paths/symlinks for the same devices and don't report them during rescanning, this can be observed with LVM or DM - seeding device use case change, the sprout device (the one capturing new writes) will not clear the read-only status of the super block; this prevents accumulating space from deleted snapshots - swapfile activation updates that are nice to CPU and activation is interruptible Performance improvements: - reduce lock contention when traversing extent buffers - reduce extent tree lock contention when searching for inline backref - switch from rb-trees to xarray for delayed ref tracking, improvements due to better cache locality, branching factors and more compact data structures - enable extent map shrinker again (prevent memory exhaustion under some types of IO load), reworked to run in a single worker thread (there used to be problems causing long stalls under memory pressure) Core changes: - raid-stripe-tree feature updates: - make device replace and scrub work - implement partial deletion of stripe extents - new selftests - split the config option BTRFS_DEBUG and add EXPERIMENTAL for features that are experimental or with known problems so we don't misuse debugging config for that - subpage mode updates (sector < page): - update compression implementations - update writepage, writeback - continued folio API conversions, buffered writes - make buffered write copy one page at a time, preparatory work for future integration with large folios, may cause performance drop - proper locking of root item regarding starting send - error handling improvements - code cleanups and refactoring: - dead code removal - unused parameter reduction - lockdep assertions 6.14 (Mar 2025) ^^^^^^^^^^^^^^^ Pull requests: `v6.14-rc1 `__, `v6.14-rc2 `__, `v6.14-rc3 `__, `v6.14-rc5 `__, `v6.14-rc6 `__, User visible changes, features: - rebuilding of the free space tree at mount time is done in more transactions, fix potential hangs when the transaction thread is blocked due to large amount of block groups - more read IO balancing strategies (experimental config), add two new ways how to select a device for read if the profiles allow that (all RAID1*), the current default selects the device by pid which is good on average but less performant for single reader workloads - select preferred device for all reads (namely for testing) - round-robin, balance reads across devices relevant for the requested IO range - add encoded write ioctl support to io_uring (read was added in 6.12), basis for writing send stream using that instead of syscalls, non-blocking mode is not yet implemented - support FS_IOC_READ_VERITY_METADATA, applications can use the metadata to do their own verification - pass inode's i_write_hint to bios, for parity with other filesystems, ioctls F_GET_RW_HINT/F_SET_RW_HINT Core: - in zoned mode: allow to directly reclaim a block group by simply resetting it, then it can be reused and another block group does not need to be allocated - super block validation now also does more comprehensive sys array validation, adding it to the points where superblock is validated (post-read, pre-write) - subpage mode fixes: - fix double accounting of blocks due to some races - improved or fixed error handling in a few cases (compression, delalloc) - raid stripe tree: - fix various cases with extent range splitting or deleting - implement hole punching to extent range - reduce number of stripe tree lookups during bio submission - more self-tests - updated self-tests (delayed refs) - error handling improvements - cleanups, refactoring - remove rest of backref caching infrastructure from relocation, not needed anymore - error message updates - remove unnecessary calls when extent buffer was marked dirty - unused parameter removal - code moved to new files 5.x --- 5.0 (Mar 2019) ^^^^^^^^^^^^^^ Pull requests: `v5.0-rc1 `__, `v5.0-rc2 `__, `v5.0-rc3 `__, `v5.0-rc5 `__ Features, highlights: - swapfile support (with some limitations) - metadata uuid - new feature that allows fast uuid change without rewriting all metadata blocks (backward incompatible) - balance messages in the syslog when operations start or stop Fixes: - improved check of filesystem id associated with a device during scan to detect duplicate devices that could be mixed up during mount - fix device replace state transitions - fix a crash due to a race when quotas are enabled during snapshot creation - GFP_NOFS/memalloc_nofs_* fixes - fsync fixes Other: - remove first phase of balance that tried to remove some space (not necessary) - separate reserve for delayed refs from global reserve - cleanups - see [https://git.kernel.org/linus/32ee34eddad13cd44ad0cb3e659fe6fd49143b62 pull request] 5.1 (May 2019) ^^^^^^^^^^^^^^ Pull requests: `v5.1-rc1 `__, `v5.1-rc1 `__, `v5.1-rc3 `__, `v5.1-rc5 `__, `v5.1-rc7 `__ New features, highlights: - zstd compression levels can be set as mount options - new ioctl to unregister scanned devices - scrub prints messages about start/stop/cancel to the log Other changes: - qgroups skip some work (est. speedup during balance 20%) - reclaim vs GFP_KERNEL fixes - fsync fixes for rename/unlink/rmdir - improved enospc handling on a highly fragmented filesystem - no trim on filesystem with unreplayed log - see [https://git.kernel.org/linus/b1e243957e9b3ba8e820fb8583bdf18e7c737aa2 pull request] 5.2 (Jul 2019) ^^^^^^^^^^^^^^ Pull requests: `v5.2-rc1 `__, `v5.2-rc2 `__, `v5.2-rc3 `__, `v5.2-rc5 `__, `v5.2-rc6 `__ User visible changes, highlights: - better read time and write checks to catch errors early and before writing data to disk - qgroups + metadata relocation: last speed up patch in the series there should be no overhead comparing balance with and without qgroups - FIEMAP ioctl does not start a transaction unnecessarily - LOGICAL_INO (v1, v2) does not start transaction unnecessarily - fsync on files with many (but not too many) hardlinks is faster - send tries harder to find ranges to clone - trim/discard will skip unallocated chunks that haven't been touched since the last mount - tree-checker does more validations: device item, inode item, block group item: - improved space flushing logic for intense DIO vs buffered workloads - metadata reservations for delalloc reworked to better adapt in many-writers/low-space scenarios Fixes: - send flushes delayed allocation before start - fix fallocate with qgroups accounting underflow - send and dedupe can't be run at the same time - fix crash in relocation/balance after resume Other: - new tracepoints for locking - async write preallocates memory to avoid failures deep in call chains - lots of cleanups 5.3 (Sep 2019) ^^^^^^^^^^^^^^ Pull requests: `v5.3-rc1 `__, `v5.3-rc2 `__, `v5.3-rc2 `__, `v5.3-rc3 `__, `v5.3-rc5 `__, `v5.3 `__ New features, highlights: - chunks that have been trimmed and unchanged since last mount are tracked and skipped on repeated trims - use hw assisted crc32c on more arches - the RAID56 incompat bit is automatically removed when the last block group of that type is removed Fixes: - update ctime/mtime/iversion after hole punching - fsync fixes - send and balance can't be run at the same time Other: - code refactoring, file splits - preparatory work for more checksums - tree checker to verify lengths of various items - delayed iput happens at unlink time, not in cleaner thread - new tracepoints for space updates 5.4 (Nov 2019) ^^^^^^^^^^^^^^ Pull requests: `v5.4-rc1 `__, `v5.4-rc1 `__, `v5.4-rc3 `__, `v5.4-rc5 `__, `v5.4-rc7 `__, `v5.4-rc8 `__ - tree checker: added sanity checks for tree items, extent items, and references - deprecated subvolume creation mode BTRFS_SUBVOL_CREATE_ASYNC - qgroup relation deletion tries harder, orphan entries are removed too - space handling improvements (ticket reservations, flushing, overcommit logic) - fix possible lockups during send of large subvolumes - see [https://git.kernel.org/linus/7d14df2d280fb7411eba2eb96682da0683ad97f6 pull request] 5.5 (Jan 2020) ^^^^^^^^^^^^^^ Pull requests: `v5.5-rc1 `__, `v5.5-rc1 `__, `v5.5-rc2 `__, `v5.5-rc3 `__, `v5.5-rc5 `__, `v5.5-rc7 `__, `v5.5 `__ - new block group profiles: RAID1 with 3- and 4- copies - RAID1 in btrfs has always 2 copies, now add support for 3 and 4 - this is an incompat feature (named RAID1C34) - recommended use of RAID1C3 is replacement of RAID6 profile on metadata, this brings a more reliable resiliency against 2 device loss/damage - support for new checksums - per-filesystem, set at mkfs time - fast hash (crc32c successor): xxhash, 64bit digest - strong hashes (both 256bit): sha256 (slower, FIPS), blake2b (faster) - speed up lseek, don't take inode locks unnecessarily, this can speed up parallel SEEK_CUR/SEEK_SET/SEEK_END by 80% - send: - allow clone operations within the same file - limit maximum number of sent clone references to avoid slow backref walking - error message improvements: device scan prints process name and PID - new tree-checker sanity tests (INODE_ITEM, DIR_ITEM, DIR_INDEX, INODE_REF, XATTR) 5.6 (Mar 2020) ^^^^^^^^^^^^^^ Pull requests: `v5.6-rc1 `__, `v5.6-rc1 `__, `v5.6-rc1 `__, `v5.6-rc2 `__, `v5.6-rc3 `__, `v5.6-rc3 `__, `v5.6-rc5 `__, `v5.6-rc7 `__ Highlights: - async discard - "mount -o discard=async" to enable it - freed extents are not discarded immediately, but grouped together and trimmed later, with IO rate limiting - the actual discard IO requests have been moved out of transaction commit to a worker thread, improving commit latency - IO rate and request size can be tuned by sysfs files, for now enabled only with CONFIG_BTRFS_DEBUG as we might need to add/delete the files and don't have a stable-ish ABI for general use, defaults are conservative - export device state info in sysfs, e.g. missing, writeable - no discard of extents known to be untouched on disk (e.g. after reservation) - device stats reset is logged with process name and PID that called the ioctl Core changes: - qgroup assign returns ENOTCONN when quotas not enabled, used to return EINVAL that was confusing - device closing does not need to allocate memory anymore - snapshot aware code got removed, disabled for years due to performance problems, reimplementation will allow to select whether defrag breaks or does not break COW on shared extents - tree-checker: - check leaf chunk item size, cross check against number of stripes - verify location keys for DIR_ITEM, DIR_INDEX and XATTR items - new self test for physical -> logical mapping code, used for super block range exclusion Fixes: - fix missing hole after hole punching and fsync when using NO_HOLES - writeback: range cyclic mode could miss some dirty pages and lead to OOM - two more corner cases for metadata_uuid change after power loss during the change - fix infinite loop during fsync after mix of rename operations 5.7 (May 2020) ^^^^^^^^^^^^^^ Pull requests: `v5.7-rc1 `__, `v5.7-rc2 `__, `v5.7-rc2 `__, `v5.7-rc4 `__, `v5.7-rc4 `__ Highlights: - v2 of ioctl to delete subvolumes, allowing to delete by id and more future extensions - removal of obsolete ioctl flag BTRFS_SUBVOL_CREATE_ASYNC - more responsive balance cancel - speedup of extent back reference resolution - reflink/clone_range works on inline extents - lots of other core changes, see the [https://git.kernel.org/linus/15c981d16d70e8a5be297fa4af07a64ab7e080ed pull request] 5.8 (Aug 2020) ^^^^^^^^^^^^^^ Pull requests: `v5.8-rc1 `__, `v5.8-rc1 `__, `v5.8-rc3 `__, `v5.8-rc5 `__, `v5.8-rc5 `__, `v5.8-rc7 `__ Highlights: - speedup dead root detection during orphan cleanup - send will emit file capabilities after chown Core changes: - improved global block reserve utilization - direct io cleanups and fixes - refactored block group reading code 5.9 (Oct 2020) ^^^^^^^^^^^^^^ Pull requests: `v5.9-rc1 `__, `v5.9-rc1 `__, `v5.9-rc3 `__, `v5.9-rc4 `__, `v5.9-rc4 `__, `v5.9-rc5 `__, `v5.9-rc6 `__, `v5.9-rc7 `__, `v5.9-rc8 `__ Highlights: - add mount option ''rescue'' to unify options for various recovery tasks on a mounted filesystems - mount option ''inode_cache'' is deprecated and will be removed in 5.11 - removed deprecated options ''alloc_start'' and ''subvolrootid'' - sysfs exports information about qgroups and relations - FS_INFO ioctl exports more information from the filesystem (notably type of checksum) - running balance detects Ctrl-C too - performance improvements in fsync - mount-time prefetch of chunk tree 5.10 (Dec 2020) ^^^^^^^^^^^^^^^ Pull requests: `v5.10-rc1 `__, `v5.10-rc2 `__, `v5.10-rc4 `__, `v5.10-rc6 `__ Highlights: - performance improvements in fsync (dbench workload: higher throughput, lower latency) - sysfs exports current exclusive operation (balance, resize, device add/del/...) - sysfs exports supported send stream version Core: - direct io uses iomap infrastructure (no more ''struct buffer_head'') - space reservations for data now use ticket infrastructure - cleanups, refactoring, preparatory work - error handling improvements - fixes 5.11 (Feb 2021) ^^^^^^^^^^^^^^^ Pull requests: `v5.11-rc1 `__, `v5.11-rc3 `__, `v5.11-rc4 `__, `v5.11-rc5 `__, `v5.11-rc6 `__, `v5.11 `__ - new mount option ''rescue'', various modes how to access a damaged filesystem - sysfs updates: filesystem generation, supported ''rescue'' modes, read mirror policy - removed feature: ''mount -o inode_cache'' - free space tree fixes, v1 cache removed during conversion Core: - locking switched to standard rw semaphores - direct IO ported to iomap infrastructure - zoned allocation mode preparation - subpage blocksize preparation - various performance improvements (skipping unnecessary work) 5.12 (Apr 2021) ^^^^^^^^^^^^^^^ Pull requests: `v5.12-rc1 `__, `v5.12-rc1 `__, `v5.12-rc2 `__, `v5.12-rc2 `__, `v5.12-rc2 `__, `v5.12-rc4 `__, `v5.12-rc5 `__, `v5.12-rc7 `__ Features: - zoned mode (SMR/ZBC/ZNS friendly allocation mode), first working version with limitations - misc performance improvements - flushing and ticket space reservations - preemptive background flushing - less lock contention for delayed refs - dbench-like workload (+7% throughput, -20% latency) Core changes: - subpage block size support preparations Fixes: - swapfile fixes (vs scrub, activation vs snapshot creation) 5.13 (Jun 2021) ^^^^^^^^^^^^^^^ Pull requests: `v5.13-rc1 `__, `v5.13-rc2 `__, `v5.13-rc2 `__, `v5.13-rc3 `__, `v5.13-rc3 `__, `v5.13-rc5 `__, `v5.13-rc6 `__, `v5.13-rc7 `__ User visible improvements - readahead for send, improving run time of full send by 10% and for incremental by 25% - make reflinks respect O_SYNC, O_DSYNC and S_SYNC flags - export supported sectorsize values in sysfs (currently only page size, more once full subpage support lands) - more graceful errors and warnings on 32bit systems when logical addresses for metadata reach the limit posed by unsigned long in page::index - error: fail mount if there's a metadata block beyond the limit - error: new metadata block would be at unreachable address - warn when 5/8th of the limit is reached, for 4K page systems it's 10T, for 64K page it's 160T - zoned mode - relocated zones get reset at the end instead of discard - automatic background reclaim of zones that have 75%+ of unusable space, the threshold is tunable in sysfs Fixes - fix inefficient preemptive reclaim calculations - fix exhaustion of the system chunk array due to concurrent allocations - fix fallback to no compression when racing with remount - fix unmountable seed device after fstrim - fix fiemap to print extents that could get misreported due to internal extent splitting and logical merging for fiemap output - preemptive fix for dm-crypt on zoned device that does not properly advertise zoned support Core changes - add inode lock to synchronize mmap and other block updates (e.g. deduplication, fallocate, fsync) - subpage support update: metadata changes now support read and write - error handling through out relocation call paths - many other cleanups and code simplifications 5.14 (Aug 2021) ^^^^^^^^^^^^^^^ Pull requests: `v5.14-rc1 `__, `v5.14-rc2 `__, `v5.14-rc3 `__, `v5.14-rc4 `__, `v5.14-rc7 `__, `v5.14 `__ Highlights: - new sysfs knob to limit scrub IO bandwidth per device - device stats are also available in /sys/fs/btrfs/FSID/devinfo/DEVID/error_stats - support cancellable resize and device delete ioctls - change how the empty value is interpreted when setting a property, so far we have only 'btrfs.compression' and we need to distinguish a reset to defaults and setting "do not compress", in general the empty value will always mean 'reset to defaults' for any other property, for compression it's either 'no' or 'none' to forbid compression - performance improvements (xattrs, truncate) - space handling improvements, preemptive flushing - more subpage support preparation 5.15 (Nov 2021) ^^^^^^^^^^^^^^^ Pull requests: `v5.15-rc1 `__, `v5.15-rc1 `__, `v5.15-rc3 `__, `v5.15-rc6 `__, `v5.15 `__ Features: - fs-verity support, using standard ioctls, backward compatible with read-only limitation on inodes with previously enabled fs-verity - idmapped mount support - make mount with rescue=ibadroots more tolerant to partially damaged trees - allow raid0 on a single device and raid10 on two devices, degenerate cases but might be useful as an intermediate step during conversion to other profiles - zoned mode block group auto reclaim can be disabled via sysfs knob Performance improvements: - continue readahead of node siblings even if target node is in memory, could speed up full send (on sample test +11%) - batching of delayed items can speed up creating many files - fsync/tree-log speedups - avoid unnecessary work (gains +2% throughput, -2% run time on sample load) - reduced lock contention on renames (on dbench +4% throughput, up to -30% latency) Fixes: - various zoned mode fixes - preemptive flushing threshold tuning, avoid excessive work on almost full filesystems Core: - continued subpage support, preparation for implementing remaining features like compression and defragmentation; with some limitations, write is now enabled on 64K page systems with 4K sectors, still considered experimental - no readahead on compressed reads - inline extents disabled - disabled raid56 profile conversion and mount - improved flushing logic, fixing early ENOSPC on some workloads - inode flags have been internally split to read-only and read-write incompat bit parts, used by fs-verity - new tree items for fs-verity: descriptor item, Merkle tree item - inode operations extended to be namespace-aware - cleanups and refactoring 5.16 (Jan 2022) ^^^^^^^^^^^^^^^ Pull requests: `v5.16-rc1 `__, `v5.16-rc1 `__, `v5.16-rc2 `__, `v5.16-rc3 `__, `v5.16-rc5 `__, `v5.16-rc6 `__ Related projects: kernel port of zstd 1.4.10 also [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8c109546a19613d323a319d0c921cb1f317e629 released] in 5.16 Performance related: - misc small inode logging improvements (+3% throughput, -11% latency on sample dbench workload) - more efficient directory logging: bulk item insertion, less tree searches and locking - speed up bulk insertion of items into a b-tree, which is used when logging directories, when running delayed items for directories (fsync and transaction commits) and when running the slow path (full sync) of an fsync (bulk creation run time -4%, deletion -12%) Core: - continued subpage support - make defragmentation work - make compression write work - zoned mode - support ZNS (zoned namespaces), zone capacity is number of usable blocks in each zone - add dedicated block group (zoned) for relocation, to prevent out of order writes in some cases - greedy block group reclaim, pick the ones with least usable space first - preparatory work for send protocol updates - error handling improvements - cleanups and refactoring 5.17 (Mar 2022) ^^^^^^^^^^^^^^^ Pull requests: `v5.17-rc1 `__, `v5.17-rc2 `__, `v5.17-rc3 `__, `v5.17-rc5 `__, `v5.17-rc6 `__, `v5.17-rc7 `__ Features: - make send work with concurrent block group relocation - new exclusive operation 'balance paused' to allow adding a device to filesystem with paused balance - new sysfs file for fsid stored in the per-device directory to help distinguish devices when seeding is enabled Performance: - less metadata needed for directory logging, directory deletion is 20-40% faster - in zoned mode, cache zone information during mount to speed up repeated queries (about 50% speedup) - free space tree entries get indexed and searched by size (latency -30%, search run time -30%) - less contention in tree node locking when inserting a key and no splits are needed (files/sec in fsmark improves by 1-20%) Fixes: - defrag rewrite from 5.16 fixed - get rid of warning when mounted with flushoncommit Core: - global reserve stealing got simplified and cleaned up in evict - more preparatory work for extent tree v2 - remove readahead framework - error handling improvements - for other changes see the [https://git.kernel.org/linus/d601e58c5f2901783428bc1181e83ff783592b6b pull request] 5.18 (May 2022) ^^^^^^^^^^^^^^^ Pull requests: `v5.18-rc1 `__, `v5.18-rc2 `__, `v5.18-rc3 `__, `v5.18-rc5 `__, `v5.18-rc6 `__, `v5.18-rc6 `__ - encoded read/write ioctls, allows user space to read or write raw data directly to extents (now compressed, encrypted in the future), will be used by send/receive v2 where it saves processing time - zoned mode now works with metadata DUP (the mkfs.btrfs default) - allow reflinks/deduplication from two different mounts of the same filesystem - error message header updates: - print error state: transaction abort, other error, log tree errors - print transient filesystem state: remount, device replace, ignored checksum verifications - tree-checker: verify the transaction id of the to-be-written dirty extent buffer - fsync speedups - directory logging speedups (up to -90% run time) - avoid logging all directory changes during renames (up to -60% run time) - avoid inode logging during rename and link when possible (up to -60% run time) - prepare extents to be logged before locking a log tree path (throughput +7%) - stop copying old file extents when doing a full fsync () - improved logging of old extents after truncate - remove balance v1 ioctl, superseded by v2 in 2012 Core, fixes: - continued extent tree v2 preparatory work - disable features that won't work yet - add wrappers and abstractions for new tree roots - prevent deleting subvolume with active swapfile - remove device count in superblock and its item in one transaction so they can't get out of sync - for subpage, force the free space v2 mount to avoid a warning and make it easy to switch a filesystem on different page size systems - export sysfs status of exclusive operation 'balance paused', so the user space tools can recognize it and allow adding a device with paused balance 5.19 (Jul 2022) ^^^^^^^^^^^^^^^ Pull requests: `v5.19-rc1 `__, `v5.19-rc4 `__, `v5.19-rc4 `__, `v5.19-rc7 `__, `v5.19-rc7 `__ Features: - subpage: - support on PAGE_SIZE > 4K (previously only 64K) - make it work with raid56 - prevent remount with v1 space cache - repair super block num_devices automatically if it does not match the number of device items - defrag can convert inline extents to regular extents, up to now inline files were skipped but the setting of mount option max_inline could affect the decision logic - zoned: - minimal accepted zone size is explicitly set to 4MiB - make zone reclaim less aggressive and don't reclaim if there are enough free zones - add per-profile sysfs tunable of the reclaim threshold - allow automatic block group reclaim for non-zoned filesystems, with sysfs tunables - tree-checker: new check, compare extent buffer owner against owner rootid Performance: - avoid blocking on space reservation when doing nowait direct io writes, (+7% throughput for reads and writes) - NOCOW write throughput improvement due to refined locking (+3%) - send: reduce pressure to page cache by dropping extent pages right after they're processed 4.x --- 4.0 (Apr 2015) ^^^^^^^^^^^^^^ - file creation time is stored (no easy interface to read it yet) - fsync and log replay fixes - lots of cleanups and other fixes 4.1 (Jun 2015) ^^^^^^^^^^^^^^ Fixes: - regression in chunk removal, conversion to raid1 possible again - log tree corruption fix with ''-o discard'' mount - bare xattr namespace attribute is not accepted - orphan cleanup is started for implicitly mounted default subvolume - send fixes - cloning within same file - EXTENT_SAME ioctl infinite loop fix - avoid more ENOSPC in delayed-iput context - a few ENOMEM fixes - 'automatic empty block group removal' fixups Speedups: - large file deletion: run delayed refs more often - large file deletion: don't build up too much work from crc - transaction commit latency improved - block group cache writeout Qgroup: - limits are shared upon snapshot - allow to remove qgroup which has parent but no child - fix status of qgroup consistency after rescan - fix quota status bits after disabling - mark qgroups inconsistent after assign/delete actions - code cleanups 4.2 (Aug 2015) ^^^^^^^^^^^^^^ Enhancements: - transaction abort now reports the caller, not the helper function - INO_LOOKUP ioctl: unprivileged if used to just get the rootid (aka. subvolume id) - unified ''subvol='' and ''subvolid='' mounting, show the mounted subvol in mount options; also, ''/proc/self/mountinfo'' now always correctly shows the mounted subvolume - reworked internal qgroup logic - send: use received_uuid of parent during send - sysfs: preparatory works for exporting more stats about devices - deduplication on the same inode works - deduplication does not change mtime/ctime Fixes: - in send: cloning, renames, orphans - few more ENOSPC fixes in case of block group creation/removal - fix hang during inode eviction due to concurrent readahead - EXTENT_SAME ioctl: handle unaligned length - more fixes around automatic block group removal - deadlock with EXTENT_SAME and readahead - for feature NO_HOLES: fsync, truncate 4.3 (Nov 2015) ^^^^^^^^^^^^^^ - fix raid56 rebuild with missing device - discard ioctl will return the number of bytes - more bugfixes and cleanups 4.4 (Jan 2016) ^^^^^^^^^^^^^^ - send fixes: cloning, sending with parent - improved handling of fragmented space using bitmaps - new mount option for debugging: fragment=data|metadata|all - updated balance filters: limit, stripes, usage - more bugfixes and cleanups 4.5 (Mar 2016) ^^^^^^^^^^^^^^ - free space cache v2: an incompat feature to track the free space cache as a b-tree - balance: - '-dconvert=dup' supported - continue but warn if metadata have lower redundancy than data - fix: trim does not overwrite bootloader area (introduced in 4.3, fixed in 4.4.x stable kernels) - assorted bugfixes, improvements or cleanups 4.6 (May 2016) ^^^^^^^^^^^^^^ - mount options: - usebackuproot - replace 'recovery' (works but is deprecated) - logreplay, nologreplay - disable log replay at mount time, does no writes to the device - norecovery - synthetic option to disable recovery at mount time and disable writes (now does: nologreplay) - default inline limit is now 2048 (instead of page size, usually 4096) - /dev/btrfs-control now understands the GET_SUPPORTED_FEATURES ioctl - get rid of harmless message "''could not find root %llu''" - preparatory work for subpage-blocksize patchset - fix bug when using overlayfs - fixes in readahead, log replay, fsync, and more 4.7 (Jul 2016) ^^^^^^^^^^^^^^ - allow balancing to dup with multi-device - device deletion by id (additionally to by path) - renameat2: add support for RENAME_EXCHANGE and RENAME_WHITEOUT - enhanced selftests - more preparatory work for "blocksize < page size" - more validation checks of superblock (discovered by fuzzing) - advertise which crc32c implementation is being used at module load - fixed space report by ''df'' with mixed block groups - log replay fixes - device replace fixes 4.8 (Oct 2016) ^^^^^^^^^^^^^^ - space reservations and handling uses ticketed system, this should improve latency and fairness in case when there are several threads blocked on flushing - fixes of bugs triggered by fuzzed images - global ratelmit of all printed messages - several send, qgroup fixes - cleanups 4.9 (Dec 2016) ^^^^^^^^^^^^^^ - improved performance of extent sharing detection in FIEMAP Fixes: - device delete hang at the end of the operation - free space tree bitmap endianness fixed on big-endian machines - parallel incremental send and balance issue fixed - cloning ioctl can be interrupted by a fatal signal - other stability fixes or cleanups 4.10 (Feb 2017) ^^^^^^^^^^^^^^^ - balance: human readable block group description in the log - balance: fix storing of stripes_min, stripes_max filters to the on-disk item - qgroup: fix accounting bug during concurrent balance run - better worker thread resource limit checks - fix ENOSPC during hole punching - fix ENOSPC when reflinking a heavily fragmented file - fix crash when certain tracepoints are enabled - fix compat ioctl calls on non-compat systems - improved delayed ref iteration performance - many cleanups 4.11 (May 2017) ^^^^^^^^^^^^^^^ - mostly a cleanup release - improved csum mismatch messages - move some qgroup work out of transaction commit - let unlink temporarily exceed quotas - fix truncate and lockless DIO writes - incremental send fixes - fix remount using ssd and nossd combinations 4.12 (Jul 2017) ^^^^^^^^^^^^^^^ - new tracepoints: file item - fix qgroup accounting when inode_cache is in use - fix incorrect number report in stat::t_blocks under certain conditions - raid56 fixes: - enable auto-repair during read (ie. similar to what raid1 and raid10 do) - fix potential crash with concurrent scrub and dev-replace - fix potential crash when cancelling dev-replace - fix false reports during scrub when it's possible to do repair - fix wrong mirror report during repair - many cleanups 4.13 (Sep 2017) ^^^^^^^^^^^^^^^ - deprecated: mount option ''alloc_start'' - qgroups: new sysctl to allow temporary quota override with CAP_SYS_RESOURCE - statx syscall support - nowait AIO support - lots of cleanups around bio processing and error handling - memory allocation constraint cleanups and improvements - more sanity checks (for dir_item) - compression will be skipped if there's no improvement (at least one block) - fix invalid extent maps due to hole punching - fix: sgid not cleared when changing acls - some enospc corner case fixes - send fixes - other cleanups 4.14 (Nov 2017) ^^^^^^^^^^^^^^^ - added zstd compression - fine-grained check for degraded mount (verify raid constraints on chunk level, not device level) - userspace transaction ioctl has been deprecated, scheduled for removal in 4.17 - foundation code for compression heuristics - mount option 'ssd' does not force block allocation alignments Fixes: - potential raid repair and compression crash - prevent to set invalid default subvolid - resume qgroup rescan on rw remount - better reporting of detected checksum mismatches for DIO - compression for defrag vs per-file behaves as expected, respecting the requested value - possible deadlock with readdir and pagefault - emission of invalid clone operations in send - cleanups and refactoring 4.15 (Jan 2018) ^^^^^^^^^^^^^^^ New features: - extend mount options to specify zlib compression level, -o compress=zlib:9 - v2 of ioctl "extent to inode mapping" - populate compression heuristics logic - enable indexing for btrfs as lower filesystem in overlayfs - speedup page cache readahead during send on large files Internal changes: - more sanity checks of b-tree items when reading them from disk - more EINVAL/EUCLEAN fixups, missing BLK_STS_* conversion, other errno or error handling fixes - remove some homegrown IO-related logic, that's been obsoleted by core block layer changes (batching, plug/unplug, own counters) - add ref-verify, optional debugging feature to verify extent reference accounting - simplify code handling outstanding extents, make it more clear where and how the accounting is done - make delalloc reservations per-inode, simplify the code and make the logic more straightforward - extensive cleanup of delayed refs code - fix send ioctl on 32bit with 64bit kernel 4.16 (Apr 2018) ^^^^^^^^^^^^^^^ - fallocate: implement zero range mode - avoid losing data raid profile when deleting a device - tree item checker: more checks for directory items and xattrs - raid56 recovery: don't use cached stripes, that could be potentially changed and a later RMW or recovery would lead to corruptions or failures - let raid56 try harder to rebuild damaged data, reading from all stripes if necessary - fix scrub to repair raid56 in a similar way as in the case above - cleanups: device freeing, removed some call indirections, redundant bio_put/_get, unused parameters, refactorings and renames - RCU list traversal fixups - simplify mount callchain, remove recursing back when mounting a subvolume - plug for fsync, may improve bio merging on multiple devices - compression heuristic: replace heap sort with radix sort, gains some performance - add extent map selftests, buffered write vs dio - see [https://git.kernel.org/linus/31466f3ed710e5761077190809e694f55aed5deb pull request] 4.17 (Jun 2018) ^^^^^^^^^^^^^^^ - mount options: new nossd_spread; subvolid will detect junk after the number and fail the mount - add message after cancelled device replace - direct module dependency on libcrc32, removed own crc wrappers - removed user space transaction ioctls - use lighter locking when reading /proc/self/mounts (RCU) - skip writeback of last page when truncating file to same size - send: do not issue unnecessary truncate operations - selftests: more tree block validation - fix fsync after hole punching when using no-holes feature - raid56: - make sure target is identical to source when raid56 rebuild fails after dev-replace - faster rebuild during scrub, batch by stripes and not block-by-block - make more use of cached data when rebuilding from a missing device - [https://git.kernel.org/linus/94514bbe9e5c402c4232af158a295a8fdfd72a2c pull request] 4.18 (Aug 2018) ^^^^^^^^^^^^^^^ - added support for the ioctl FS_IOC_FSGETXATTR, per-inode flags, successor of GET/SETFLAGS; now supports only existing flags: append, immutable, noatime, nodump, sync - 3 new unprivileged ioctls to allow users to enumerate subvolumes - dedupe syscall implementation does not restrict the range to 16MiB, though it still splits the whole range to 16MiB chunks - on user demand, rmdir() is able to delete an empty subvolume, export the capability in sysfs - fix inode number types in tracepoints, other cleanups - send: improved speed when dealing with a large removed directory, measurements show decrease from 2000 minutes to 2 minutes on a directory with 2 million entries - pre-commit check of superblock to detect a mysterious in-memory corruption - log message updates - [https://git.kernel.org/linus/704996566f97e0e24c97052f81678060c213c260 pull request] 4.19 (Oct 2018) ^^^^^^^^^^^^^^^ Highlights, no big changes in this release: - allow defrag on opened read-only files that have rw permissions - tree checker improvements, reported by fuzzing - send, fix incorrect file layout after hole punching beyond eof - reset on-disk device stats value after replace - assorted fixes, cleanups and dead code removal - [https://git.kernel.org/linus/318b067a5dd649d198c2ba00cf7408d778fc00b4 pull request] 4.20 (Dec 2018) ^^^^^^^^^^^^^^^ Performance improvements: - fewer wakeups and blocking during b-tree traversals, improved latencies and scalability - qgroups: 30+% run time improvement during balance, no accounting on unchanged subtrees (continued) - use a cached variant of rb-tree, speeds up traversal in some cases Fixes: - trim: - could miss some block groups, if logical offset was too high and did not fit the range - better error reporting, continue as far as possible - less interaction with transaction commit - fsync: fix log replay and O_TMPFILE warnings - qgroups: fix rescan that might misc some dirty groups - don't clean dirty pages during buffered writes, this could lead to lost updates in some corner cases - some block groups could have been delayed in creation, if the allocation triggered another one - error handling improvements - other cleanups and refactoring - [https://git.kernel.org/linus/a1a4f841ec4585185c0e75bfae43a18b282dd316 pull request] 3.x --- 3.0 (Jul 2011) ^^^^^^^^^^^^^^ * Filesystem scrub * Auto-defragmentation (autodefrag mount option) * Improved block allocator * Sped up file creation/deletion by delayed operation 3.1 (Oct 2011) ^^^^^^^^^^^^^^ * Stability fixes (lots of them, really), notably fixing early ENOSPC, improved handling of a few error paths and corner cases, fix for the crash during log replay. 3.2 (Jan 2012) ^^^^^^^^^^^^^^ * Log of past roots to aid recovery (option ''recovery'') * Subvolumes mountable by full path * Added ''nospace_cache'' option * Lots of space accounting fixes * Improved scrub performance thanks to new read-ahead infrastructure * Scrub prints paths of corrupted files * ioctl for resolving logical->inode and inode->path * Integrated raid-repair (if possible) * Data corruption fix for parallel snapshot creation * Write barriers for multiple devices were fixed to be more resistant in case of power failure 3.3 (Mar 2012) ^^^^^^^^^^^^^^ * restriper - infrastructure to change btrfs raid profiles on the fly via balance * optional integrity checker infrastructure ([http://lwn.net/Articles/466493/ details]) * fixed a few corner cases where TRIM did not process some blocks * cluster allocator improvements (less fragmentation, some speedups) 3.4 (May 2012) ^^^^^^^^^^^^^^ * Allow metadata blocks larger than the page size (4K). This allows metadata blocks up to 64KB in size. In practice 16K and 32K seem to work best. For workloads with lots of metadata, this cuts down the size of the extent allocation tree dramatically and fragments much less. (Chris Mason) * Improved error handling (IO errors). This gives Btrfs the ability to abort transactions and go read-only on errors other than internal logic errors and ENOMEM more gracefully instead of crashing. (Jeff Mahoney) * Reworked the way in which metadata interacts with the page cache. page->private now points to the btrfs extent_buffer object, which makes everything faster. The code was changed so it now writes a whole extent buffer at a time instead of allowing individual pages to go down. It is now more aggressive about dropping pages for metadata blocks that were freed due to COW. Overall, metadata caching is much faster now. (Josef Bacik) 3.5 (Jun 2012) ^^^^^^^^^^^^^^ * collect device statistics (read/write failures, checksum errors, corrupted blocks) * integrity checker (3.3+) supports bigblocks (3.4+) * more friendly NFS support (native ''i_version'') * ''thread_pool'' mount option tunable via remount * ''fsync'' speed improvements * several fixes related to read-only mounts * scrub thread priority lowered to idle * preparatory works for 3.6 features (''tree_mod_log'') 3.6 (Sep 2012) ^^^^^^^^^^^^^^ * subvolume-aware quotas (''qgroups'') * support for send/receive between snapshot changes ([http://lwn.net/Articles/506244/ LWN article]) * ''atime'' is not updated on read-only snapshots ([http://lwn.net/Articles/499293/ LWN article]) * allowed cross-subvolume file clone (aka. reflink) * remount with ''no'' compression possible * new ioctl to read device readiness status * speed improvement for concurrent multithreaded reads 3.7 (Dec 2012) ^^^^^^^^^^^^^^ * ''fsync'' speedups * removed limitation of number of hardlinks in a single directory * file hole punching ([http://lwn.net/Articles/415889/ LWN article]) * per-file ''NOCOW'' * fixes to send/receive 3.8 (Feb 2013) ^^^^^^^^^^^^^^ * ability to replace devices at runtime in an effective way ([http://lwn.net/Articles/524589/ description]) * speed improvements (cumulative effect of many small improvements) * a few more bugfixes 3.9 (Apr 2013) ^^^^^^^^^^^^^^ * preliminary Raid 5/6 support (details in the [http://www.spinics.net/lists/linux-btrfs/msg22169.html announcement]) * snapshot-aware defrag * a mode of ''send'' to avoid transferring file data * direct IO speedup ([https://patchwork.kernel.org/patch/2114921/ numbers]) * new ''ioctl''s to set/get filesystem label * defrag is cancellable 3.10 (Jun 2013) ^^^^^^^^^^^^^^^ * reduced size of metadata by so-called :ref:`skinny extents` [http://git.kernel.org/linus/3173a18f70554fe7880bb2d85c7da566e364eb3c] * enhanced syslog message format [http://permalink.gmane.org/gmane.comp.file-systems.btrfs/24330] * the mount option ''subvolrootid'' is deprecated * lots of stability improvements, removed many< BUG_ONs * qgroups are automatically created when quotas are enabled [http://git.kernel.org/linus/7708f029dca5f1b9e9d6ea01ab10cd83e4c74ff2] * qgroups are able to ''rescan'' current filesystem and sync the quota state with the existing subvolumes * enhanced ''send/recv '' format for multiplexing more data into one stream [http://git.kernel.org/linus/c2c71324ecb471c932bc1ff59e46ffcf82f274fc] * various unsorted code cleanups, minor performance updates 3.11 (Sep 2013) ^^^^^^^^^^^^^^^ * extent cloning within one file * ioctl to wait for quota rescan completion * device deletion returns error code to userspace (not in syslog anymore) * usual load of small fixes and improvements 3.12 (Nov 2013) ^^^^^^^^^^^^^^^ * Major performance improvement for send/receive with large numbers of subvolumes * Support for batch :doc:`deduplication` (userspace tools required) * new mount option ''commit'' to set the commit interval * Lots of stability and bugfix patches 3.13 (Jan 2014) ^^^^^^^^^^^^^^^ * ''fiemap'' exports information about shared extents * bugfix and stability focused release 3.14 (Mar 2014) ^^^^^^^^^^^^^^^ * optional incompat disk format improvement aiming at speedup, removing file hole representation, named ''no-holes'' * ioctl to query/change feature bits (e.g. switching on extended refs on-line now possible) * export filesystem info through sysfs: features, allocation profiles * added pairing mount options (for remount) * heap of small performance optimizations * snapshot-aware defrag was disabled due to problems 3.15 (Jun 2014) ^^^^^^^^^^^^^^^ * pile of ''send'' fixes (stability, speed) * worker threads now use kernel workqueues 3.16 (Aug 2014) ^^^^^^^^^^^^^^^ * ''O_TMPFILE'' support [http://kernelnewbies.org/Linux_3.11#head-8be09d59438b31c2a724547838f234cb33c40357] * reworked qgroup accounting, to fix negative numbers after subvol deletion * SEARCH_TREE ioctl v2, extended for retrieving more data [http://www.spinics.net/lists/linux-btrfs/msg31213.html] * new balance filter ''limit'' for more finegrained balancing [http://www.spinics.net/lists/linux-btrfs/msg33872.html] * ioctl FS_INFO and it's sysfs counterpart export information about ''nodesize'', ''sectorsize'' and ''clone_alignment'' * snapshots are protected during send 3.17 (Oct 2014) ^^^^^^^^^^^^^^^ * fix for the infamous deadlock [https://git.kernel.org/linus/9e0af23764344f7f1b68e4eefbe7dc865018b63d] * fixed longstanding bug in qgroups accounting after snapshot deletion [https://git.kernel.org/linus/1152651a081720ef6a8c76bb7da676e8c900ac30] * updated (less inaccurate) ''df'' numbers [https://git.kernel.org/linus/ba7b6e62f420f5a8832bc161ab0c7ba767f65b3d] * speedup for ''rename'' and ''truncate'', less strict flushes [https://git.kernel.org/linus/8d875f95da43c6a8f18f77869f2ef26e9594fecc] * updated and fixes to the ''seeding'' feature 3.17 (Oct 2014) ^^^^^^^^^^^^^^^ * fix for the infamous deadlock [https://git.kernel.org/linus/9e0af23764344f7f1b68e4eefbe7dc865018b63d] * fixed longstanding bug in qgroups accounting after snapshot deletion [https://git.kernel.org/linus/1152651a081720ef6a8c76bb7da676e8c900ac30] * updated (less inaccurate) ''df'' numbers [https://git.kernel.org/linus/ba7b6e62f420f5a8832bc161ab0c7ba767f65b3d] * speedup for ''rename'' and ''truncate'', less strict flushes [https://git.kernel.org/linus/8d875f95da43c6a8f18f77869f2ef26e9594fecc] * updated and fixes to the ''seeding'' feature 3.18 (Dec 2014) ^^^^^^^^^^^^^^^ 3.19 (Feb 2015) ^^^^^^^^^^^^^^^ * raid56 supports scrub and device replace 2.6.x ----- 2.6.39 (May 2011) ^^^^^^^^^^^^^^^^^ Per-file compression and NOCOW control. Support for bulk TRIM on SSDs. 2.6.38 (March 2011) ^^^^^^^^^^^^^^^^^^^ Added LZO compression method, FIEMAP bugfixes with delalloc, subvol flags get/set ioctl, allow compression during defrag. 2.6.37 (January 2011) ^^^^^^^^^^^^^^^^^^^^^ On-disk free space cache, asynchronous snapshots, unprivileged subvolume deletion, extent buffer switches from a rbtree with spinlocks to a radix tree with RCU. (Explanations of these features are described in [http://www.linux-mag.com/id/7945 this] article [registration needed]). 2.6.35 (August 2010) ^^^^^^^^^^^^^^^^^^^^ Direct I/O support and -ENOSPC handling of volume management operations, completing the -ENOSPC support. 2.6.34 (May 2010) ^^^^^^^^^^^^^^^^^ Support for changing the default subvolume, a new userspace tool (btrfs), an ioctl that lists all subvolumes, an ioctl to allow improved df math, and other improvements. 2.6.33 (February 2010) ^^^^^^^^^^^^^^^^^^^^^^ Some minor -ENOSPC improvements. 2.6.32 (December 2009) ^^^^^^^^^^^^^^^^^^^^^^ ENOSPC Btrfs has not had serious -ENOSPC ("no space") handling, the COW oriented design makes handling such situations more difficult than filesystems that just rewrite the blocks. In this release Josef Bacik (Red Hat) has added the necessary infrastructure to fix that problem. Note: The filesystem may run out of space and still show some free space. That space comes from a data/metadata chunk that can't get filled because there's not space left to create its metadata/data counterpart chunk. This is unrelated to the -ENOSPC handling and will be fixed in the future. Code: [http://git.kernel.org/linus/9ed74f2dba6ebf9f30b80554290bfc73cc3ef083 (commit)] Proper snapshot and subvolume deletion In the last btrfs-progs version you have options that allow to delete snapshots and subvolumes without having to use rm. This is much faster because it does the deletion via btree walking. It's also now possible to rename snapshots and subvols. Work done by Yan Zheng (Oracle). Code: [http://git.kernel.org/linus/4df27c4d5cc1dda54ed7d0a8389347f2df359cf9 (commit 1)], [http://git.kernel.org/linus/76dda93c6ae2c1dc3e6cde34569d6aca26b0c918 2)] Performance improvements Streaming writes on very fast hardware were previously CPU bound at around 400MB/s. Chris Mason (Oracle) has improved the code so that now it can push over 1GB/s while using the same CPU as XFS (factoring out checksums). There are also improvements for writing large portions of extents, and other workloads. Multidevice setups are also much faster due to the per-BDI writeback changes. The performance of fsync() was greatly improved, which fixed a severe slowdown while using yum in Fedora 11. Support for "discard" operation on SSD devices "Discard" support is a way to telling SSD devices which blocks are free so that the underlying firmware knows that it's safe to do some optimizations [http://git.kernel.org/linus/e244a0aeb6a599c19a7c802cda6e2d67c847b154 (commit)], [http://git.kernel.org/linus/0634857488ec6e28fa22920cd0bee3c2ac07ccfd (commit)] 0.x --- 0.13 and older ^^^^^^^^^^^^^^ * Copy on write FS * Checksumming * Transactions * Snapshotting * Subvolumes 0.14 (April 30, 2008) ^^^^^^^^^^^^^^^^^^^^^ * Support for multiple devices * raid0, raid1 and raid10, single spindle metadata duplication 0.15 (May 29, 2008) ^^^^^^^^^^^^^^^^^^^ * Metadata back references * Online growing and shrinking * Conversion program from Ext3 * data=ordered support * COW-free data writes. * focus on stability fixes for the multiple device code 0.16 (August 2008) ^^^^^^^^^^^^^^^^^^ v0.16 does change the disk format from v0.15, and it includes a long list of performance and stability updates. Fine grained Btree locking Locking is now done in a top down fashion while searching the btree, and higher level locks are freed when they are no longer required. Extent allocations still have a coarse grained lock, but that will be improved in the next release. Improved data=ordered Ordered data mode loosely means any system that prevents garbage or stale data blocks after a crash. It was previously implemented the same way ext3 does it, which is to force pending data writes down before a transaction commits. The data=ordered code was changed to only modify metadata in the btree after data extents are fully written on disk. This allows a transaction commit to proceed without waiting for all the data writes on the FS to finish. A single fsync or synchronous write no longer forces all the dirty data on the FS to disk, as it does in ext3 and reiserfsv3. Although it is not implemented yet, the new data=ordered code would allow atomic writes of almost any size to a single file to be exported to userland. ACL support (Josef Bacik) ACLs are implemented and enabled by default. Lost file prevention (Josef Bacik) The VFS and posix APIs force filesystems allow files to be unlinked from a directory before they are deleted from the FS. If the system crashes between the unlink and the deletion, the file is still consuming space on disk, but not listed in any directory. Btrfs now tracks these files and makes sure they are reclaimed if the system crashes before they are fully deleted. New directory index format (Josef Bacik) Btrfs indexes directories in two ways. The first index allows fast name lookups, and the second is optimized to return inodes in something close to disk order for readdir. The second index is an important part of good performance for full filesystem backups. A per-directory sequence number is now used for the second index, removing some worst case conditions around files that are hard linked into the same directory many times. Faster unmount times (Yan Zheng) Btrfs waits for old transactions to be completely removed from the FS before unmount finishes. A new reference count cache was added to make this much less IO intensive, improving FS performance in all workloads. Improved streaming reads and writes The new data=ordered code makes streaming writes much faster. Streaming reads are improved by tuning the thread pools used to process data checksums after the read is done. On machines with sufficient CPU power to keep up with the disks, data checksumming is able to run as fast as nodatasum mounts. 0.17 (January 2009) ^^^^^^^^^^^^^^^^^^^ Btrfs is now in 2.6.29-rc1! v0.17 has a new disk format since v0.16. Future releases will try to maintain backwards compatibility with this new format. Compression Transparent zlib compression of file data is enabled by mount -o compress. Improved block allocation routines (Josef Bacik) Many performance problems in the allocator are addressed in this release Improved block sharing while moving extents (Yan Zheng) The btrfs-vol commands to add, remove and balance space across devices triggers a COW of metadata and data blocks. This release is much better at maintaining shared blocks between snapshots when that COW happens. Seed Device support It is now possible to create a filesystem to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point to the new FS. All modifications go onto different devices and the COW machinery makes sure the original is unchanged. Many bug fixes and performance improvements 0.18 (January 2009) ^^^^^^^^^^^^^^^^^^^ v0.18 has the same disk format as 0.17, but a bug was found in the ioctl interface shared between 32 bit and 64 bit programs. This was fixed by changing the ioctl interface. Anyone using 2.6.29-rc2 will need to update to v0.18 of the btrfs progs. There is no need to reformat though, the disk format is still compatible. 0.19 (June 2009) ^^^^^^^^^^^^^^^^ v0.19 is a forward rolling format change, which means that it can read the v0.18 disk format but older kernels and older btrfs-progs code will not be able to read filesystems created with v0.19. The new code changes the way that extent back references are recorded, making them significantly more efficient. In general, v0.19 is a dramatic speed improvement over v0.18 in almost every workload. The v0.19 utilities are meant for use with kernels 2.6.31-rc1 and higher. Git trees are available with the new format code for 2.6.30 kernels, please see the download section for details. If you do not wish to roll forward to the new disk format, use the v0.18 utilities. btrfs-progs-6.14/Documentation/Makefile.in000066400000000000000000000036261477105376400206170ustar00rootroot00000000000000# Source files for manual pages are listed in conf.py in variable man_pages # You can set these variables from the command line, and also from the # environment for the first two. SPHINXOPTS ?= -N SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build INSTALL = @INSTALL@ RM = @RM@ RMDIR = @RMDIR@ LN_S = @LN_S@ SED = @SED@ BTRFS_VERSION = $(shell $(SED) -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p' ../config.h) ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V QUIET_RM = @ QUIET_SPHINX = @echo " SPHINX $@"; SPHINXOPTS += -q endif endif mandir ?= $(prefix)/share/man man2dir = $(mandir)/man2 man3dir = $(mandir)/man3 man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 .PHONY: all man help # Build manual pages by default all: man # Workaround for old sphinx that requires the contents.rst file man: @if [ "$$(sphinx-build --version | cut -d' ' -f2)" \< "1.7.7" ]; then \ touch contents.rst; \ fi $(QUIET_SPHINX)$(SPHINXBUILD) -M man "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) install: man $(INSTALL) -d -m 755 $(DESTDIR)$(man2dir) $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir) $(INSTALL) -m 644 $(BUILDDIR)/man/*.2 $(DESTDIR)$(man2dir) $(INSTALL) -m 644 $(BUILDDIR)/man/*.5 $(DESTDIR)$(man5dir) $(INSTALL) -m 644 $(BUILDDIR)/man/*.8 $(DESTDIR)$(man8dir) $(INSTALL) -m 644 btrfsck.8 $(DESTDIR)$(man8dir) uninstall: cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8 $(MAN8) $(RMDIR) -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir) clean: $(QUIET_RM)$(RM) -rf $(BUILDDIR)/* $(QUIET_RM)$(RM) -df -- $(BUILDDIR) $(QUIET_RM)$(RM) -f contents.rst # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: $(QUIET_SPHINX)$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) btrfs-progs-6.14/Documentation/Qgroups.rst000066400000000000000000000000731477105376400207350ustar00rootroot00000000000000Quota groups ============ .. include:: ch-quota-intro.rst btrfs-progs-6.14/Documentation/Reflink.rst000066400000000000000000000027361477105376400206770ustar00rootroot00000000000000Reflink ======= Reflink is a type of shallow copy of file data that shares the blocks but otherwise the files are independent and any change to the file will not affect the other. This builds on the underlying COW mechanism. A reflink will effectively create only a separate metadata pointing to the shared blocks which is typically much faster than a deep copy of all blocks. The reflink is typically meant for whole files but a partial file range can be also copied, though there are no ready-made tools for that. .. code-block:: shell cp --reflink=always source target There are some constraints: - cross-filesystem reflink is not possible, there's nothing in common between so the block sharing can't work - reflink crossing two mount points of the same filesystem support depends on kernel version: - until 5.17 it's not supported and fails with "Cross device link", can be worked around by performing the operation on the toplevel subvolume - works since 5.18 - reflink requires source and target file that have the same status regarding NOCOW and checksums, for example if the source file is NOCOW (once created with the :command:`chattr +C` attribute) then the above command won't work unless the target file is pre-created with the +C attribute as well, or the NOCOW attribute is inherited from the parent directory (:command:`chattr +C` on the directory) or if the whole filesystem is mounted with *-o nodatacow* that would create the NOCOW files by default btrfs-progs-6.14/Documentation/Resize.rst000066400000000000000000000012401477105376400205330ustar00rootroot00000000000000Resize ====== A mounted filesystem can be resized after creation, grown or shrunk. On a multi-device filesystem the space occupied on each device can be resized independently. Data that reside in the area that would be out of the new size are relocated to the remaining space below the limit, so this constrains the minimum size to which a filesystem can be shrunk. Growing a filesystem is quick as it only needs to take note of the available space, while shrinking a filesystem needs to relocate potentially lots of data and this is IO intense. It is possible to shrink a filesystem in smaller steps. See :ref:`btrfs filesystem resize` for more. btrfs-progs-6.14/Documentation/Scrub.rst000066400000000000000000000000551477105376400203530ustar00rootroot00000000000000Scrub ===== .. include:: ch-scrub-intro.rst btrfs-progs-6.14/Documentation/Seeding-device.rst000066400000000000000000000001021477105376400221010ustar00rootroot00000000000000Seeding device ============== .. include:: ch-seeding-device.rst btrfs-progs-6.14/Documentation/Send-receive.rst000066400000000000000000000027511477105376400216130ustar00rootroot00000000000000Send/receive ============ Send and receive are complementary features that allow to transfer data from one filesystem to another in a streamable format. The send part traverses a given read-only subvolume and either creates a full stream representation of its data and metadata (*full mode*), or given a set of subvolumes for reference it generates a difference relative to that set (*incremental mode*). Receive on the other hand takes the stream and reconstructs a subvolume with files and directories equivalent to the filesystem that was used to produce the stream. The result is not exactly 1:1, e.g. inode numbers can be different and other unique identifiers can be different (like the subvolume UUIDs). The full mode starts with an empty subvolume, creates all the files and then turns the subvolume to read-only. At this point it could be used as a starting point for a future incremental send stream, provided it would be generated from the same source subvolume on the other filesystem. The stream is a sequence of encoded commands that change e.g. file metadata (owner, permissions, extended attributes), data extents (create, clone, truncate), whole file operations (rename, delete). The stream can be sent over network, piped directly to the receive command or saved to a file. Each command in the stream is protected by a CRC32C checksum, with 0 as the initial value and no inversion. See :doc:`btrfs-send` and :doc:`btrfs-receive` for more, for protocol description :doc:`dev/dev-send-stream`. btrfs-progs-6.14/Documentation/Source-repositories.rst000066400000000000000000000112431477105376400232630ustar00rootroot00000000000000Source repositories =================== Since 2.6.29-rc1, Btrfs has been included in the mainline kernel. Kernel module ------------- The kernel.org git repository is not used for development, only for pull requests that go to Linus and for `linux-next `__ integration: * https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git -- pull request source * branch `for-next `__ gets pulled to the *linux-next* tree, is rebased and contains base development branches and topic branches * branch `next-fixes `__ has fixes for the next upcoming *rcN* and is usually turned into a pull request The following git repository is used for group development and is updated with patches from the mailing list: * https://github.com/btrfs/linux The main branch with patches is `for-next `__ . Note that it gets rebased or updated (fixed typos, added Reviewed-by tags etc). The base point for patches depend on the development phase. See :ref:`development schedule`. Independent changes can be based on the *linus/master* branch, changes that could depend on patches that have been added to one of the queues should use that as a base. btrfs-progs git repository -------------------------- Release repositories ^^^^^^^^^^^^^^^^^^^^ The sources of the userspace utilities can be obtained from these repositories: * git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git (``__) - release repository, not for development The **master** branch contains the latest released version is never rebased and updated after a release. Development repositories ^^^^^^^^^^^^^^^^^^^^^^^^ * git://github.com/kdave/btrfs-progs.git (``__) * git://gitlab.com/kdave/btrfs-progs.git (``__) For build dependencies and installation instructions please see https://github.com/kdave/btrfs-progs/blob/master/INSTALL Development branches ^^^^^^^^^^^^^^^^^^^^ The latest **development branch** is called **devel**. Contains patches that are reviewed or tested and on the way to the next release. When a patch is added to the branch, a mail notification is sent as a reply to the patch. The git repositories on *kernel.org* are not used for development or integration branches. GitHub development ^^^^^^^^^^^^^^^^^^ Pull requests are accepted for contributions, and slightly more preferred as they get tested by the CI (Github actions). Patches to the mailing are also accepted but not mandatory. You can link to a branch in any git repository if the mails do not make it to the mailing list or for convenience. The development model of btrfs-progs has moved from kernel model to github and is less strict about some things. :doc:`dev/GithubReviewWorkflow`. It is still desired to write good changelogs: * proper **subject line**: e.g. prefix with *btrfs-progs: subpart, ...* , descriptive yet not too long * proper **changelog**: the changelogs are often missing or lacking explanation *why* the change was made, or *how* is something broken, *what* are user-visible effects of the bug or the fix, *how* does an improvement help or the intended *usecase* * the **Signed-off-by** line: this document who authored the change, you can read more about the *The Developer's Certificate of Origin* `here (chapter 11) `_] * **one logical change** per patch: e.g. not mixing bug fixes, cleanups, features etc., sometimes it's not clear and will be usually pointed out during reviews * references to reports, issues, pull requests Pull requests allow to update commits, fixups are possible and recommended. Administration and support tools -------------------------------- There is a separate repository of useful scripts for common administrative tasks on btrfs. This is at: https://github.com/kdave/btrfsmaintenance/ Patches sent to mailing list ---------------------------- A convenient interface to get an overview of patches and the related mail discussions can be found at https://patchwork.kernel.org/project/linux-btrfs/list/ . It is possible to directly apply a patch by pasting the *mbox* link from the patch page to the command: .. code-block:: bash $ wget -O - 'https://patchwork.kernel.org/patch/123456/mbox' | git am - You may want to add *--reject*, or decide otherwise what to do with the patch. btrfs-progs-6.14/Documentation/Status.rst000066400000000000000000000355211477105376400205660ustar00rootroot00000000000000Status ====== Overview -------- For a list of features by the kernel version of their introduction, please see :doc:`/Feature-by-version`. The table below is an overview of the stability status of the features that BTRFS supports. While a feature may be functionally safe and reliable, it does not necessarily mean that it is suitable for all use cases or workloads, for example performance. Combination of features can vary in performance, the table does not cover all possibilities. **The table is based on the latest released linux kernel: 6.13** Since kernel version 6.12 there's a config option *CONFIG_BTRFS_EXPERIMENTAL* that enables features that are in development and do not have stabilized interface or have known problems. See the :ref:`list below`. The columns for each feature reflect the status of the implementation in following ways: | *Stability* - completeness of the implementation, use case coverage | *Performance* - how much it could be improved until the inherent limits are hit | *Notes* - short description of the known issues, or other information related to status *Legend:* - **OK**: should be safe to use, no known major deficiencies - **mostly OK**: safe for general use, there are some known problems that do not affect majority of users - **Unstable**: do not use for other then testing purposes, known severe problems, missing implementation of some core parts .. role:: statusok .. role:: statusmok .. role:: statusunstable .. role:: statusunsupp .. role:: statusincompat .. list-table:: :header-rows: 1 * - Feature - Stability - Performance - Notes * - :doc:`Subvolumes, snapshots` - :statusok:`OK` - OK - * - :doc:`Compression` - :statusok:`OK` - - * - :doc:`Checksumming algorithms` - :statusok:`OK` - OK - * - :doc:`Defragmentation` - :statusmok:`mostly OK` - - extents get unshared (see below) * - :docref:`Autodefrag ` - :statusok:`OK` - - * - :doc:`Discard (synchronous)` - :statusok:`OK` - - mounted with `-o discard` (has performance implications), also see `fstrim` * - :doc:`Discard (asynchronous)` - :statusok:`OK` - - mounted with `-o discard=async` (improved performance) * - :doc:`Out-of-band dedupe` - :statusok:`OK` - :statusmok:`mostly OK` - (reflink), heavily referenced extents have a noticeable performance hit (see below) * - :doc:`File range cloning` - :statusok:`OK` - :statusmok:`mostly OK` - (reflink), heavily referenced extents have a noticeable performance hit (see below) * - :doc:`Filesystem resize` - :statusok:`OK` - OK - shrink, grow * - :doc:`Device replace` - :statusmok:`mostly OK` - mostly OK - (see below) * - :doc:`Auto-repair` - :statusok:`OK` - OK - automatically repair from a correct spare copy if possible (DUP, RAID1, RAID10, RAID56) * - :doc:`Scrub` - :statusok:`OK` - OK - * - Scrub + RAID56 - :statusmok:`mostly OK` - mostly OK - * - :docref:`Degraded mount ` - :statusok:`OK` - n/a - * - :doc:`Balance` - :statusok:`OK` - OK - balance + qgroups can be slow when there are many snapshots * - Dynamic block group reclaim - TBD - TBD - Tunable thresholds for automatic background block group reclaim. * - :doc:`Send` - :statusok:`OK` - OK - * - :doc:`Receive` - :statusok:`OK` - OK - * - Offline UUID change - :statusok:`OK` - OK - * - Metadata UUID change - :statusok:`OK` - OK - * - Temporary FSID - 6.8 - 6.8 - Single devices with same FSID can be mounted repeatedly, getting a temporary UUID. * - :doc:`Seeding` - :statusok:`OK` - OK - * - :doc:`Quotas, qgroups` - :statusmok:`mostly OK` - mostly OK - qgroups with many snapshots slows down balance * - :doc:`Squota, simplified qgroups` - 6.8 - 6.8 - simplified qgroup accounting, better performance, specific use case * - :doc:`Swapfile` - :statusok:`OK` - n/a - with some limitations * - nodatacow - :statusok:`OK` - OK - * - Encoded io read/write - :statusok:`OK` - OK - Special *ioctls* to read or write file extent data directly, the raw compressed bytes in particular. * - :doc:`Subpage block size` - :statusok:`OK` - OK - Also see :ref:`table below` for compatibility. * - :doc:`Zoned mode` - :statusmok:`mostly OK` - mostly OK - Not yet feature complete but moderately stable, also see :ref:`table below` for compatibility. Block group profiles ^^^^^^^^^^^^^^^^^^^^ .. list-table:: :header-rows: 1 * - Feature - Stability - Performance - Notes * - :ref:`Single (block group profile)` - :statusok:`OK` - OK - * - :ref:`DUP (block group profile)` - :statusok:`OK` - OK - * - :ref:`RAID0` - :statusok:`OK` - OK - * - :ref:`RAID1` - :statusok:`OK` - mostly OK - reading from mirrors in parallel can be optimized further (see below) * - :ref:`RAID1C3` - :statusok:`OK` - mostly OK - reading from mirrors in parallel can be optimized further (see below) * - :ref:`RAID1C4` - :statusok:`OK` - mostly OK - reading from mirrors in parallel can be optimized further (see below) * - :ref:`RAID10` - :statusok:`OK` - mostly OK - reading from mirrors in parallel can be optimized further (see below) * - :ref:`RAID56` - :statusunstable:`unstable` - n/a - (see below) * - :ref:`Mixed block groups` - :statusok:`OK` - OK - On-disk format ^^^^^^^^^^^^^^ Features that are typically set at *mkfs* time (sometimes can be changed or converted later). .. list-table:: :header-rows: 1 * - Feature - Stability - Performance - Notes * - :ref:`extended-refs` - :statusok:`OK` - OK - mkfs.btrfs default since 3.12 * - :ref:`skinny-metadata` - :statusok:`OK` - OK - mkfs.btrfs default since 3.18 * - :ref:`no-holes` - :statusok:`OK` - OK - mkfs.btrfs default since 5.15 * - :ref:`Free space tree` - :statusok:`OK` - OK - mkfs.btrfs default since 5.15 * - :ref:`Block group tree` - :statusok:`OK` - OK - * - :ref:`Raid stripe tree` - :statusmok:`mostly OK` - OK - not all profiles are supported and RST is behind CONFIG_BTRFS_DEBUG/CONFIG_BTRFS_EXPERIMENTAL build option * - :doc:`Squota` - :statusok:`OK` - OK - Simplified tracking needs on-disk format update, but may work in a limited way without it. Interoperability ^^^^^^^^^^^^^^^^ Integration with other Linux features or external systems. :doc:`See also`. .. list-table:: :header-rows: 1 * - Feature - Stability - Performance - Notes * - :ref:`NFS` - :statusok:`OK` - OK - * - :ref:`cgroups` - :statusok:`OK` - OK - IO controller * - :ref:`io_uring` - :statusok:`OK` - OK - Can be combined with *Encoded read/write ioctls*. * - :ref:`fsverity` - :statusok:`OK` - OK - * - :ref:`idmapped mount` - :statusok:`OK` - OK - * - :ref:`Samba` - :statusok:`OK` - OK - compression, server-side copies, snapshots Please open an issue if: - there's a known missing entry - a particular feature combination that has a different status and is worth mentioning separately - you know of a bug that lowers the feature status .. _status-subpage-block-size: Subpage block size ------------------ Most commonly used page sizes are 4KiB, 16KiB and 64KiB. All combinations with a 4KiB sector size filesystems are supported. Some features are not compatible with subpage or require another feature to work. Since btrfs-progs 6.7 the default sector size is 4KiB as this allows cross-architecture compatibility. .. list-table:: :header-rows: 1 * - Feature - Status - Notes * - Inline files - :statusunsupp:`unsupported` - The max_inline mount option value is ignored, as if mounted with max_inline=0 * - Free space cache v1 - :statusunsupp:`unsupported` - Free space tree is mandatory, v1 makes some assumptions about page size * - Compression - :statusok:`partial support` - Only page-aligned ranges can be compressed * - Sectorsize - :statusok:`supported` - The list of supported sector sizes on a given version can be found in file :file:`/sys/fs/btrfs/features/supported_sectorsizes` .. _status-zoned: Zoned mode ---------- Features that completely incompatible with zoned mode are listed below. Compatible features may not be listed and are assumed to work as they are unaffected by the zoned device constraints. .. list-table:: :header-rows: 1 * - Feature - Status - Notes * - Boot - :statusincompat:`incompatible` - The blocks where partition table is stored are used for super block * - Mixed block groups - :statusincompat:`incompatible` - Interleaving data and metadata would lead to out of order write * - NODATACOW - :statusincompat:`incompatible` - In-place overwrite * - fallocate - :statusincompat:`incompatible` - Preallocation of blocks would require an out of order write * - Free space cache v1 - :statusincompat:`incompatible` - Cache data are updated in a NODATACOW-way * - Swapfile - :statusincompat:`incompatible` - Swap blocks are written out of order * - Offline UUID change - :statusincompat:`incompatible` - Metadata blocks are updated in-place * - Free space tree - :statusok:`supported` - * - Block group tree - :statusok:`supported` - * - Raid stripe tree - :statusok:`supported` - Allows to use RAID in zoned mode * - Filesystem resize - :statusok:`supported` - * - Balance - :statusok:`supported` - * - Metadata UUID change - :statusok:`supported` - * - RAID0, RAID1* - :statusok:`supported` - requires `raid-stripe-tree` * - RAID56 - not implemented - Will be supported once raid-stripe-tree support is implemented * - discard - not implemented - May not be required at all due to automatic zone reclaim * - subpage blocksize - not implemented - Missing support for compressed data * - fsverity - TBD - * - seeding - TBD - Details that do not fit the table --------------------------------- Defrag ^^^^^^ The data affected by the defragmentation process will be newly written and will consume new space, the links to the original extents will not be kept. See also :doc:`btrfs-filesystem` . Though autodefrag affects newly written data, it can read a few adjacent blocks (up to 64KiB) and write the contiguous extent to a new location. The adjacent blocks will be unshared. This happens on a smaller scale than the on-demand defrag and doesn't have the same impact. RAID1, RAID10 ^^^^^^^^^^^^^ The simple redundancy RAID levels utilize different mirrors in a way that does not achieve the maximum performance. The logic can be improved so the reads will spread over the mirrors evenly or based on device congestion. RAID56 ^^^^^^ Please see https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#raid56-status-and-recommended-practices . Device replace ^^^^^^^^^^^^^^ Device *replace* and device *delete* insist on being able to read or reconstruct all data. If any read fails due to an IO error, the delete/replace operation is aborted and the administrator must remove or replace the damaged data before trying again. On-disk format -------------- The filesystem disk format is stable. This means it is not expected to change unless there are very strong reasons to do so. If there is a format change, filesystems which implement the previous disk format will continue to be mountable and usable by newer kernels. The core of the on-disk format that comprises building blocks of the filesystem: - layout of the main data structures, e.g. superblock, b-tree nodes, b-tree keys, block headers - the COW mechanism, based on the original design of Ohad Rodeh's paper "B-trees, Shadowing and Clones" (http://sylab-srv.cs.fiu.edu/lib/exe/fetch.php?media=paperclub:shadow_btree.pdf) Newly introduced features build on top of the above and could add specific structures. If a backward compatibility is not possible to maintain, a bit in the filesystem superblock denotes that and the level of incompatibility (full, read-only mount possible). .. _status-experimental-features: Experimental features --------------------- Until kernel 6.12 the *CONFIG_OPTION_DEBUG* was used to hide features that still need some work and should not be exposed to users in general. With the increasing number of such features or functionality this started to conflict with regular debugging features. Currently the following is behind the experimental option. Use with caution and if you find problems or have feedback please report that to the mailing list. .. list-table:: :header-rows: 1 * - Feature - Version - Description * - Raid stripe tree - ... - The RIAD5/6 block group is still not implemented and on-disk format is not finalized (last change was in 6.12). * - Send stream protocol v3 - ... - The fs-verity stream command is implemented. More updates to the protocol specification are pending. * - Checksum offload mode - ... - Fast devices with a combination of block group profiles benefits from calculating checksums at the time of IO submission, while other combinations benefit from offloading that to the worker threads. A sysfs tunable is exported to switch that. * - Read balancing - 6.13 - Spread IO read requests across available devices. A tunable is provided in sysfs. * - Extent tree v2 - ... - Incomplete implementation. btrfs-progs-6.14/Documentation/Subpage.rst000066400000000000000000000025631477105376400206710ustar00rootroot00000000000000Subpage support =============== Subpage block size support, or just *subpage* for short, is a feature to allow using a filesystem that has different size of data block size (*sectorsize*) and the host CPU page size. For easier implementation the support was limited to the exactly same size of the block and page. On x86_64 this is typically 4KiB, but there are other architectures commonly used that make use of larger pages, like 64KiB on 64bit ARM or PowerPC or 16KiB on Apple Silicon. This means filesystems created with 64KiB sector size cannot be mounted on a system with 4KiB page size. Since btrfs-progs 6.7, filesystems are created with a 4KiB sector size by default, though it remains possible to create filesystems with other sector sizes (such as 64KiB with the "-s 64k" option for :command:`mkfs.btrfs`). This ensures that new filesystems are compatible across other architecture variants using larger page sizes. Requirements, limitations ------------------------- The initial subpage support has been added in kernel 5.15. Most features are already working without problems. On a 64KiB page system, a filesystem with 4KiB sectorsize can be mounted and used as long as the initial mount succeeds. Subpage support is used by default for systems with a non-4KiB page size since btrfs-progs 6.7. Please refer to status page of :ref:`status-subpage-block-size` for compatibility. btrfs-progs-6.14/Documentation/Subvolumes.rst000066400000000000000000000000731477105376400214410ustar00rootroot00000000000000Subvolumes ========== .. include:: ch-subvolume-intro.rst btrfs-progs-6.14/Documentation/Swapfile.rst000066400000000000000000000000601477105376400210430ustar00rootroot00000000000000Swapfile ======== .. include:: ch-swapfile.rst btrfs-progs-6.14/Documentation/Tree-checker.rst000066400000000000000000000104231477105376400215760ustar00rootroot00000000000000Tree checker ============ Tree checker is a feature that verifies metadata blocks before write or after read from the devices. The b-tree nodes contain several items describing the filesystem structures and to some degree can be verified for consistency or validity. This is an additional check to the checksums that only verify the overall block status while the tree checker tries to validate and cross reference the logical structure. This takes a slight performance hit but is comparable to calculating the checksum and has no noticeable impact while it does catch all sorts of errors. There are two occasions when the checks are done: Pre-write checks ---------------- When metadata blocks are in memory and about to be written to the permanent storage, the checks are performed, before the checksums are calculated. This can catch random corruptions of the blocks (or pages) either caused by bugs or by other parts of the system or hardware errors (namely faulty RAM). Once a block does not pass the checks, the filesystem refuses to write more data and turns itself to read-only mode to prevent further damage. At this point some of the recent metadata updates are held *only* in memory so it's best to not panic and try to remember what files could be affected and copy them elsewhere. Once the filesystem gets unmounted, the most recent changes are unfortunately lost. The filesystem that is stored on the device is still consistent and should mount fine. A message may look like: .. code-block:: none [ 1716.823895] BTRFS critical (device vdb): corrupt leaf: root=18446744073709551607 block=38092800 slot=0, invalid key objectid: has 1 expect 6 or [256, 18446744073709551360] or 18446744073709551604 [ 1716.829499] BTRFS info (device vdb): leaf 38092800 gen 19 total ptrs 4 free space 15851 owner 18446744073709551607 [ 1716.832891] BTRFS info (device vdb): refs 3 lock (w:0 r:0 bw:0 br:0 sw:0 sr:0) lock_owner 0 current 1506 [ 1716.836054] item 0 key (1 1 0) itemoff 16123 itemsize 160 [ 1716.837993] inode generation 1 size 0 mode 100600 [ 1716.839760] item 1 key (256 1 0) itemoff 15963 itemsize 160 [ 1716.841742] inode generation 4 size 0 mode 40755 [ 1716.843393] item 2 key (256 12 256) itemoff 15951 itemsize 12 [ 1716.845320] item 3 key (18446744073709551611 48 1) itemoff 15951 itemsize 0 [ 1716.847505] BTRFS error (device vdb): block=38092800 write time tree block corruption detected The line(s) before the *write time tree block corruption detected* message is specific to the found error. Post-read checks ---------------- Metadata blocks get verified right after they're read from devices and the checksum is found to be valid. This protects against changes to the metadata that could possibly also update the checksum, less likely to happen accidentally but rather due to intentional corruption or fuzzing. .. code-block:: none [ 4823.612832] BTRFS critical (device vdb): corrupt leaf: root=7 block=30474240 slot=0, invalid nritems, have 0 should not be 0 for non-root leaf [ 4823.616798] BTRFS error (device vdb): block=30474240 read time tree block corruption detected The checks ---------- As implemented right now, the metadata consistency is limited to one b-tree node and what items are stored there, i.e. there's no extensive or broad check done e.g. against other data structures in other b-tree nodes. This still provides enough opportunities to verify consistency of individual items, besides verifying general validity of the items like the length or offset. The b-tree items are also coupled with a key so proper key ordering is also part of the check and can reveal random bitflips in the sequence (this has been the most successful detector of faulty RAM). The capabilities of tree checker have been improved over time and it's possible that a filesystem created on an older kernel may trigger warnings or fail some checks on a new one. Reporting problems ------------------ In many cases the bug is caused by hardware and cannot be automatically fixed by *btrfs check --repair*, so do not try that without being advised to. Even if the error is unfixable it's useful to report it, either to validate the cause but also to give more ideas how to improve the tree checker. Please consider reporting it to the mailing list *linux-btrfs@vger.kernel.org*. btrfs-progs-6.14/Documentation/Trim.rst000066400000000000000000000042501477105376400202110ustar00rootroot00000000000000Trim/discard ============ Trim or discard is an operation on a storage device based on flash technology (SSD, NVMe or similar), a thin-provisioned device or could be emulated on top of other block device types. On real hardware, there's a different lifetime span of the memory cells and the driver firmware usually tries to optimize for that. The trim operation issued by user provides hints about what data are unused and allow to reclaim the memory cells. On thin-provisioned or emulated this could simply free the space. There are three main uses of trim that BTRFS supports: synchronous enabled by mounting filesystem with ``-o discard`` or ``-o discard=sync``, the trim is done right after the file extents get freed, this however could have severe performance hit and is not recommended as the ranges to be trimmed could be too fragmented asynchronous enabled by mounting filesystem with ``-o discard=async``, which is an improved version of the synchronous trim where the freed file extents are first tracked in memory and after a period or enough ranges accumulate the trim is started, expecting the ranges to be much larger and allowing to throttle the number of IO requests which does not interfere with the rest of the filesystem activity manually by fstrim the tool :command:`fstrim` starts a trim operation on the whole filesystem, no mount options need to be specified, so it's up to the filesystem to traverse the free space and start the trim, this is suitable for running it as periodic service The trim is considered only a hint to the device, it could ignore it completely, start it only on ranges meeting some criteria, or decide not to do it because of other factors affecting the memory cells. The device itself could internally relocate the data, however this leads to unexpected performance drop. Running trim periodically could prevent that too. When a filesystem is created by :doc:`mkfs.btrfs` and is capable of trim, then it's by default performed on all devices. Since kernel 6.2 the *discard=async* mount option is automatically enabled on devices that support that. btrfs-progs-6.14/Documentation/Volume-management.rst000066400000000000000000000001211477105376400226500ustar00rootroot00000000000000Volume management ================= .. include:: ch-volume-management-intro.rst btrfs-progs-6.14/Documentation/Zoned-mode.rst000066400000000000000000000000671477105376400213010ustar00rootroot00000000000000Zoned mode ========== .. include:: ch-zoned-intro.rst btrfs-progs-6.14/Documentation/_static/000077500000000000000000000000001477105376400201715ustar00rootroot00000000000000btrfs-progs-6.14/Documentation/_static/style.css000066400000000000000000000010461477105376400220440ustar00rootroot00000000000000.wy-nav-content { max-width: 1200px !important; } .wy-table-responsive { white-space: normal !important; } .wy-table-responsive table td, .wy-table-responsive table th { white-space: normal !important; } .green { color: green; } .statusok { color: green; } .statusmok { /* color: orange; */ /* color: #ffae42; */ color: darkorange; } .statusunstable { color: red; } .statusunsupp { color: darkorange; } .statusincompat { color: goldenrod; }; table.main-table { border: 1px; width: 100%; } td.main-table-col { width: 33%; } btrfs-progs-6.14/Documentation/_templates/000077500000000000000000000000001477105376400207005ustar00rootroot00000000000000btrfs-progs-6.14/Documentation/_templates/layout.html000066400000000000000000000002351477105376400231030ustar00rootroot00000000000000{% extends "!layout.html" %} {% block extrahead %} {% endblock %} btrfs-progs-6.14/Documentation/btrfs-balance.rst000066400000000000000000000243071477105376400220060ustar00rootroot00000000000000btrfs-balance(8) ================ SYNOPSIS -------- **btrfs balance** DESCRIPTION ----------- .. include:: ch-balance-intro.rst SUBCOMMAND ---------- cancel cancels a running or paused balance, the command will block and wait until the current block group being processed completes Since kernel 5.7 the response time of the cancellation is significantly improved, on older kernels it might take a long time until currently processed chunk is completely finished. pause pause running balance operation, this will store the state of the balance progress and used filters to the filesystem resume resume interrupted balance, the balance status must be stored on the filesystem from previous run, e.g. after it was paused or forcibly interrupted and mounted again with *skip_balance* start [options] start the balance operation according to the specified filters, without any filters the data and metadata from the whole filesystem are moved. The process runs in the foreground. .. note:: The balance command without filters will basically move everything in the filesystem to a new physical location on devices (i.e. it does not affect the logical properties of file extents like offsets within files and extent sharing). The run time is potentially very long, depending on the filesystem size. To prevent starting a full balance by accident, the user is warned and has a few seconds to cancel the operation before it starts. The warning and delay can be skipped with *--full-balance* option. Please note that the filters must be written together with the *-d*, *-m* and *-s* options, because they're optional and bare *-d* and *-m* also work and mean no filters. .. note:: When the target profile for conversion filter is *raid5* or *raid6*, there's a safety timeout of 10 seconds to warn users about the status of the feature ``Options`` -d[] act on data block groups, see section :ref:`FILTERS` for details about *filters* -m[] act on metadata chunks, see :ref:`FILTERS` for details about *filters* -s[] act on system chunks (requires *-f*), see :ref:`FILTERS` for details about *filters*. -f force a reduction of metadata integrity, e.g. when going from *raid1* to *single*, or skip safety timeout when the target conversion profile is *raid5* or *raid6* --background|--bg run the balance operation asynchronously in the background, uses :manref:`fork(2)` to start the process that calls the kernel ioctl --enqueue wait if there's another exclusive operation running, otherwise continue -v (deprecated) alias for global '-v' option status [-v] Show status of running or paused balance. ``Options`` -v (deprecated) alias for global *-v* option .. _man-balance-filters: FILTERS ------- .. include:: ch-balance-filters.rst ENOSPC ------ The way balance operates, it usually needs to temporarily create a new block group and move the old data there, before the old block group can be removed. For that it needs the work space, otherwise it fails for ENOSPC reasons. This is not the same ENOSPC as if the free space is exhausted. This refers to the space on the level of block groups, which are bigger parts of the filesystem that contain many file extents. The free work space can be calculated from the output of the **btrfs filesystem show** command: .. code-block:: none Label: 'BTRFS' uuid: 8a9d72cd-ead3-469d-b371-9c7203276265 Total devices 2 FS bytes used 77.03GiB devid 1 size 53.90GiB used 51.90GiB path /dev/sdc2 devid 2 size 53.90GiB used 51.90GiB path /dev/sde1 *size* - *used* = *free work space* *53.90GiB* - *51.90GiB* = *2.00GiB* An example of a filter that does not require workspace is *usage=0*. This will scan through all unused block groups of a given type and will reclaim the space. After that it might be possible to run other filters. **CONVERSIONS ON MULTIPLE DEVICES** Conversion to profiles based on striping (RAID0, RAID5/6) require the work space on each device. An interrupted balance may leave partially filled block groups that consume the work space. EXAMPLES -------- A more comprehensive example when going from one to multiple devices, and back, can be found in section *TYPICAL USECASES* of :doc:`btrfs-device`. MAKING BLOCK GROUP LAYOUT MORE COMPACT ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The layout of block groups is not normally visible; most tools report only summarized numbers of free or used space, but there are still some hints provided. Let's use the following real life example and start with the output: .. code-block:: none $ btrfs filesystem df /path Data, single: total=75.81GiB, used=64.44GiB System, RAID1: total=32.00MiB, used=20.00KiB Metadata, RAID1: total=15.87GiB, used=8.84GiB GlobalReserve, single: total=512.00MiB, used=0.00B Roughly calculating for data, *75G - 64G = 11G*, the used/total ratio is about *85%*. How can we can interpret that: * chunks are filled by 85% on average, i.e. the *usage* filter with anything smaller than 85 will likely not affect anything * in a more realistic scenario, the space is distributed unevenly, we can assume there are completely used chunks and the remaining are partially filled Compacting the layout could be used on both. In the former case it would spread data of a given chunk to the others and removing it. Here we can estimate that roughly 850 MiB of data have to be moved (85% of a 1 GiB chunk). In the latter case, targeting the partially used chunks will have to move less data and thus will be faster. A typical filter command would look like: .. code-block:: none # btrfs balance start -dusage=50 /path Done, had to relocate 2 out of 97 chunks $ btrfs filesystem df /path Data, single: total=74.03GiB, used=64.43GiB System, RAID1: total=32.00MiB, used=20.00KiB Metadata, RAID1: total=15.87GiB, used=8.84GiB GlobalReserve, single: total=512.00MiB, used=0.00B As you can see, the *total* amount of data is decreased by just 1 GiB, which is an expected result. Let's see what will happen when we increase the estimated usage filter. .. code-block:: none # btrfs balance start -dusage=85 /path Done, had to relocate 13 out of 95 chunks $ btrfs filesystem df /path Data, single: total=68.03GiB, used=64.43GiB System, RAID1: total=32.00MiB, used=20.00KiB Metadata, RAID1: total=15.87GiB, used=8.85GiB GlobalReserve, single: total=512.00MiB, used=0.00B Now the used/total ratio is about 94% and we moved about *74G - 68G = 6G* of data to the remaining block groups, i.e. the 6GiB are now free of filesystem structures, and can be reused for new data or metadata block groups. We can do a similar exercise with the metadata block groups, but this should not typically be necessary, unless the used/total ratio is really off. Here the ratio is roughly 50% but the difference as an absolute number is "a few gigabytes", which can be considered normal for a workload with snapshots or reflinks updated frequently. .. code-block:: none # btrfs balance start -musage=50 /path Done, had to relocate 4 out of 89 chunks $ btrfs filesystem df /path Data, single: total=68.03GiB, used=64.43GiB System, RAID1: total=32.00MiB, used=20.00KiB Metadata, RAID1: total=14.87GiB, used=8.85GiB GlobalReserve, single: total=512.00MiB, used=0.00B Just 1 GiB decrease, which possibly means there are block groups with good utilization. Making the metadata layout more compact would in turn require updating more metadata structures, i.e. lots of IO. As running out of metadata space is a more severe problem, it's not necessary to keep the utilization ratio too high. For the purpose of this example, let's see the effects of further compaction: .. code-block:: none # btrfs balance start -musage=70 /path Done, had to relocate 13 out of 88 chunks $ btrfs filesystem df . Data, single: total=68.03GiB, used=64.43GiB System, RAID1: total=32.00MiB, used=20.00KiB Metadata, RAID1: total=11.97GiB, used=8.83GiB GlobalReserve, single: total=512.00MiB, used=0.00B GETTING RID OF COMPLETELY UNUSED BLOCK GROUPS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Normally the balance operation needs a work space, to temporarily move the data before the old block groups gets removed. If there's no work space, it ends with *no space left*. There's a special case when the block groups are completely unused, possibly left after removing lots of files or deleting snapshots. Removing empty block groups is automatic since 3.18. The same can be achieved manually with a notable exception that this operation does not require the work space. Thus it can be used to reclaim unused block groups to make it available. .. code-block:: bash # btrfs balance start -dusage=0 /path This should lead to decrease in the *total* numbers in the **btrfs filesystem df** output. EXIT STATUS ----------- Unless indicated otherwise below, all **btrfs balance** subcommands return a zero exit status if they succeed, and non zero in case of failure. The **pause**, **cancel**, and **resume** subcommands exit with a status of **2** if they fail because a balance operation was not running. The **status** subcommand exits with a status of **0** if a balance operation is not running, **1** if the command-line usage is incorrect or a balance operation is still running, and **2** on other errors. AVAILABILITY ------------ **btrfs** is part of btrfs-progs. Please refer to the documentation at `https://btrfs.readthedocs.io `_. SEE ALSO -------- :doc:`mkfs.btrfs`, :doc:`btrfs-device` btrfs-progs-6.14/Documentation/btrfs-check.rst000066400000000000000000000132401477105376400214700ustar00rootroot00000000000000btrfs-check(8) ============== SYNOPSIS -------- **btrfs check** [options] DESCRIPTION ----------- The filesystem checker is used to verify structural integrity of a filesystem and attempt to repair it if requested. It is recommended to unmount the filesystem prior to running the check, but it is possible to start checking a mounted filesystem (see :ref:`--force`). By default, :command:`btrfs check` will not modify the device but you can reaffirm that by the option *--readonly*. :command:`btrfsck` is an alias of :command:`btrfs check` command and is now deprecated. .. note:: Even though the filesystem checker requires a device argument, it scans for all devices belonging to the same filesystem, thus it should not cause a difference using different devices of the same filesystem. Furthermore :doc:`btrfs-check` will automatically choose the good mirror, thus as long as there is a good copy for metadata, it will not report such case as an error. .. warning:: Do not use *--repair* unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no *fsck* successfully repair all types of filesystem corruption. E.g. some other software or hardware bugs can fatally damage a volume. The structural integrity check verifies if internal filesystem objects or data structures satisfy the constraints, point to the right objects or are correctly connected together. There are several cross checks that can detect wrong reference counts of shared extents, backreferences, missing extents of inodes, directory and inode connectivity etc. The amount of memory required can be high, depending on the size of the filesystem, similarly the run time. Check the modes that can also affect that. SAFE OR ADVISORY OPTIONS ------------------------ -b|--backup use the first valid set of backup roots stored in the superblock This can be combined with *--super* if some of the superblocks are damaged. --check-data-csum verify checksums of data blocks This expects that the filesystem is otherwise OK, and is basically an offline *scrub* that does not repair data from spare copies. --chunk-root use the given offset *bytenr* for the chunk tree root -E|--subvol-extents show extent state for the given subvolume --mode select mode of operation regarding memory and IO The *MODE* can be one of: original The metadata are read into memory and verified, thus the requirements are high on large filesystems and can even lead to out-of-memory conditions. The possible workaround is to export the block device over network to a machine with enough memory. lowmem This mode is supposed to address the high memory consumption at the cost of increased IO when it needs to re-read blocks. This may increase run time. -p|--progress indicate progress at various checking phases -Q|--qgroup-report verify qgroup accounting and compare against filesystem accounting -r|--tree-root use the given offset 'bytenr' for the tree root --readonly (default) run in read-only mode, this option exists to calm potential panic when users are going to run the checker -s|--super use Nth superblock copy, valid values are 0, 1 or 2 if the respective superblock offset is within the device size This can be used to use a different starting point if some of the primary superblock is damaged. DANGEROUS OPTIONS ----------------- --repair enable the repair mode and attempt to fix problems where possible .. note:: There's a warning and 10 second delay when this option is run without *--force* to give users a chance to think twice before running repair, the warnings in documentation have shown to be insufficient. --init-csum-tree create a new checksum tree and recalculate checksums in all files .. warning:: Do not blindly use this option to fix checksum mismatch problems. --init-extent-tree build the extent tree from scratch .. warning:: Do not use unless you know what you're doing. .. _man-check-option-force: --force allow work on a mounted filesystem and skip mount checks. Note that this should work fine on a quiescent or read-only mounted filesystem but may crash if the device is changed externally, e.g. by the kernel module. .. note:: It is possible to run with --repair but on a mounted filesystem that will most likely lead to a corruption unless the filesystem is in a quiescent state which may not be possible to guarantee. This option also skips the delay and warning in the repair mode (see *--repair*). DEPRECATED OR REMOVED OPTIONS ----------------------------- --clear-space-cache v1|v2 completely remove the free space cache of the given version See also the *clear_cache* mount option. .. warning:: This option is deprecated, please use `btrfs rescue clear-space-cache` instead, this option would be removed in the future eventually. EXIT STATUS ----------- **btrfs check** returns a zero exit status if it succeeds. Non zero is returned in case of failure. AVAILABILITY ------------ **btrfs** is part of btrfs-progs. Please refer to the documentation at `https://btrfs.readthedocs.io `_. SEE ALSO -------- :doc:`mkfs.btrfs`, :doc:`btrfs-scrub`, :doc:`btrfs-rescue` btrfs-progs-6.14/Documentation/btrfs-convert.rst000066400000000000000000000047551477105376400221060ustar00rootroot00000000000000btrfs-convert(8) ================ SYNOPSIS -------- **btrfs-convert** [options] DESCRIPTION ----------- .. include:: ch-convert-intro.rst OPTIONS ------- --csum , --checksum Specify the checksum algorithm. Default is *crc32c*. Valid values are *crc32c*, *xxhash*, *sha256* or *blake2*. To mount such filesystem kernel must support the checksums as well. -d|--no-datasum disable data checksum calculations and set the NODATASUM file flag, this can speed up the conversion -i|--no-xattr ignore xattrs and ACLs of files -n|--no-inline disable inlining of small files to metadata blocks, this will decrease the metadata consumption and may help to convert a filesystem with low free space -N|--nodesize set filesystem nodesize, the tree block size in which btrfs stores its metadata. The default value is 16KiB (16384) or the page size, whichever is bigger. Must be a multiple of the sectorsize, but not larger than 65536. See :doc:`mkfs.btrfs` for more details. -r|--rollback rollback to the original ext2/3/4 filesystem if possible -l|--label