Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btrfs-progs: cmds/qgroup: use sysfs to detect inconsistent status early #952

Open
wants to merge 27 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a77705a
btrfs-progs: mkfs: update subvolume relatd error messages
kdave Feb 11, 2025
d0ed24d
btrfs-progs: mkfs: print errno string instead of numeric values
kdave Feb 11, 2025
83c3bc4
btrfs-progs: mkfs: fix printing of subvolumes in the summary
kdave Feb 11, 2025
b34ba84
btrfs-progs: mkfs: print type of subvolume in the listing
kdave Feb 11, 2025
8f580ad
btrfs-progs: docs: update mkfs.btrfs manual page
kdave Feb 11, 2025
06e9c95
btrfs-progs: ci: update Dockerfile CMD syntax
kdave Feb 11, 2025
800d7b0
btrfs-progs: ci: add workflow for CodeQL
kdave Feb 11, 2025
6609489
btrfs-progs: README: add status badge of codeql workflow
kdave Feb 11, 2025
3d8ab67
btrfs-progs: fix UNITS_DECIMAL and UNITS_NEGATIVE bit definitions
kdave Feb 11, 2025
083d226
btrfs-progs: scrub status: fix rate units
kdave Feb 11, 2025
4382c2f
btrfs-progs: docs: update json API
kdave Feb 12, 2025
c5c9456
btrfs-progs: docs: fix typos
kdave Feb 12, 2025
9e7853c
btrfs-progs: docs: update sysfs descriptions
kdave Feb 12, 2025
49faefa
btrfs-progs: docs: fix document references in html build
kdave Feb 12, 2025
7535901
btrfs-progs: mkfs: set BTRFS_INODE_ROOT_ITEM_INIT on new FS root
maharmstone Feb 6, 2025
80cd98e
btrfs-progs: mkfs: add dev stats and device items
maharmstone Feb 6, 2025
2bb184d
btrfs-progs: mkfs: set incompat bit BIG_METADATA if nodesize > PAGE_SIZE
maharmstone Feb 6, 2025
e15bba1
btrfs-progs: docs: add a note on qgroup limit with inconsitent flag
adam900710 Jan 15, 2025
5a24fb1
btrfs-progs: docs: add a warning when converting to a profile with lo…
adam900710 Feb 3, 2025
e1085e6
btrfs-progs: tests: adjust number of misc/065-image-filename
kdave Feb 12, 2025
92ab5b5
btrfs-progs: tests: adjust number of misc/065-btrfstune-simple-quota
kdave Feb 12, 2025
792fe15
btrfs-progs: tests: adjust number of misc/064-reverse-receive
kdave Feb 12, 2025
ab0d5e2
btrfs-progs: tests: rename and update convert/027-large-symbol-link
kdave Feb 12, 2025
f6ec4de
btrfs-progs: tests: add prefix to test templates and update permissions
kdave Feb 12, 2025
d12e76e
btrfs-progs: tests: update README
kdave Feb 12, 2025
a1926e3
btrfs-progs: ci: add option to run only codespell workflow
kdave Feb 12, 2025
efd8a2e
btrfs-progs: cmds/qgroup: use sysfs to detect inconsistent status early
adam900710 Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "devel" ]
pull_request:
branches: [ "devel" ]
schedule:
- cron: '37 22 * * 0'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# 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)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || '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
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: 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
# 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 the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
./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}}"
5 changes: 3 additions & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 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
Expand All @@ -9,12 +11,11 @@ on:
branches:
- devel
- 'ci/**'
- 'CI/**'
- 'codespell/**'
pull_request:
branches:
- devel
- 'ci/**'
- 'CI/**'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion Documentation/DocConventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Referencing:

- generic links can use the free form link syntax with description ```Link text <https://example.com>`__``
(note the double underscore, this is *anonymous* link and does not create a reference)
or plain link that will auto-render to a clikable link https://example.com
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
Expand Down
16 changes: 8 additions & 8 deletions Documentation/Kernel-by-version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ Pull requests:
`v5.4-rc7 <https://git.kernel.org/linus/00aff6836241ae5654895dcea10e6d4fc5878ca6>`__,
`v5.4-rc8 <https://git.kernel.org/linus/afd7a71872f14062cc12cac126bb8e219e7dacf6>`__

- tree checker: adde sanity checks for tree items, extent items, and references
- 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)
Expand Down Expand Up @@ -1023,7 +1023,7 @@ Pull requests:
Highlights:

- performance improvements in fsync (dbench workload: higher throughput, lower latency)
- sysfs exports current exclusive operataion (balance, resize, device add/del/...)
- sysfs exports current exclusive operation (balance, resize, device add/del/...)
- sysfs exports supported send stream version

Core:
Expand Down Expand Up @@ -1083,7 +1083,7 @@ Features:

Core changes:

- subpage block size support peparations
- subpage block size support preparations

Fixes:

Expand Down Expand Up @@ -1434,7 +1434,7 @@ 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 dsiabling
- fix quota status bits after disabling
- mark qgroups inconsistent after assign/delete actions
- code cleanups

Expand Down Expand Up @@ -1475,7 +1475,7 @@ Fixes:
^^^^^^^^^^^^^^

- send fixes: cloning, sending with parent
- improved handling of framgented space using bitmaps
- 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
Expand All @@ -1501,7 +1501,7 @@ Fixes:
writes (now does: nologreplay)

- default inline limit is now 2048 (instead of page size, usually 4096)
- /dev/btrfs-control now understands the GET_SUPPORTE_FEATURES ioctl
- /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
Expand Down Expand Up @@ -1574,7 +1574,7 @@ Fixes:
^^^^^^^^^^^^^^^

- new tracepoints: file item
- fix qgoup accounting when inode_cache is in use
- fix qgroup accounting when inode_cache is in use
- fix incorrect number report in stat::t_blocks under certain conditions
- raid56 fixes:

Expand Down Expand Up @@ -1877,7 +1877,7 @@ Fixes:
^^^^^^^^^^^^^^^

* ''fiemap'' exports information about shared extents
* bugfix and stability foucsed release
* bugfix and stability focused release

3.14 (Mar 2014)
^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Send-receive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ 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-send-stream`.
for protocol description :doc:`dev/dev-send-stream`.
2 changes: 1 addition & 1 deletion Documentation/btrfs-filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ defragment [options] <file>|<dir> [<file>|<dir>...]
logic. Reasonable values are from tens to hundreds of megabytes.

--step SIZE
Perform defragmention in the range in SIZE steps and flush (*-f*) after each one.
Perform defragmentation in the range in SIZE steps and flush (*-f*) after each one.
The range is default (the whole file) or given by *-s* and *-l*, split into
the steps or done in one go if the step is larger. Minimum range size is 256KiB.

Expand Down
4 changes: 2 additions & 2 deletions Documentation/btrfs-ioctl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ BTRFS_IOC_ADD_DEV

Add a given block device to the filesystem. Unlike the command :command:`btrfs device add`
there's are no safety checks (like existence of another filesystem on the
device), device preparataion (like TRIM or zone reset), so use it with care.
device), device preparation (like TRIM or zone reset), so use it with care.

This is a filesystem-exclusive operation and it will fail if there's another
one already running, with one exception, when there's a paused balance.
Expand Down Expand Up @@ -968,7 +968,7 @@ Use cases (:ref:`definition of constants<struct_btrfs_ioctl_subvol_wait>`):
* - ioctl args
- :ref:`struct btrfs_ioctl_subvol_wait<struct_btrfs_ioctl_subvol_wait>`
* - args.subvolid
- Depending on the mode, the numeric id of subolume to wait for, or
- Depending on the mode, the numeric id of subvolume to wait for, or
the one queried by *PEEK* modes
* - args.mode
- mode of operation described above
Expand Down
2 changes: 1 addition & 1 deletion Documentation/btrfs-man5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ SYSFS INTERFACE

.. include:: ch-sysfs.rst

.. _man-btrfs5-fileysstem-exclusive-operations:
.. _man-btrfs5-filesystem-exclusive-operations:

FILESYSTEM EXCLUSIVE OPERATIONS
-------------------------------
Expand Down
6 changes: 6 additions & 0 deletions Documentation/btrfs-qgroup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ ownership. For example a fresh snapshot shares almost all the blocks with the
original subvolume, new writes to either subvolume will raise towards the
exclusive limit.

.. note::
Qgroup limit only works when qgroup is in a consistent state.
If some workload marks qgroup inconsistent (like assigning a qgroup to another
qgroup), the limit will no longer work until the inconsistent flag is cleared
by :command:`btrfs quota rescan`.

The qgroup identifiers conform to *level/id* where level 0 is reserved to the
qgroups associated with subvolumes. Such qgroups are created automatically.

Expand Down
18 changes: 17 additions & 1 deletion Documentation/ch-balance-filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,26 @@ convert=<profile>
Starting with kernel 4.5, the ``data`` chunks can be converted to/from the
``DUP`` profile on a single device.

.. note::
Starting with kernel 4.6, all profiles can be converted to/from ``DUP`` on
multi-device filesystems.

.. warning::
Bad or missing device are not detected immediately during
runtime and this depends on some later event like failed write
or failed transaction commit. If there's a known failing
device, or a device deleted by :file:`/sys/block/<dev>/device/delete` interface,
the device will be still accessed and written to.

In such case, one should not convert to a profile with lower
redundancy (e.g. from *RAID1* to *SINGLE*),
as attempts to create new chunks on the new devices will cause
various problems.

The proper action is to use :command:`btrfs replace` or
:command:`btrfs device remove` to handle the failing/missing
device first. Then convert will work with all devices
correctly.

limit=<number>, limit=<range>
Process only given number of chunks, after all filters are applied. This can be
used to specifically target a chunk in connection with other filters (``drange``,
Expand Down
Loading