summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-05-22bcachefs: bch2_dev_data_drop_by_backpointers()Kent Overstreet2-15/+105
Currently, device removal has to scan all metadata for pointers to the device being removed. Add a new method, with the same interface as bch2_dev_data_drop(), that scans by backpointers instead - this will drastically speed up device removal. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: BCH_SB_MEMBER_DELETED_UUIDKent Overstreet4-2/+39
Add a sentinal value for devices that have been removed, but don't want to reuse their index until a fsck has completed. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_dev_remove_stripes() respects degraded flagsKent Overstreet4-25/+62
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: opts.rebalance_on_ac_onlyKent Overstreet6-6/+60
Add an option for setting rebalance to only run when connected to mains power. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: __bch2_fs_free() cleanupKent Overstreet1-16/+17
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Improve bch2_extent_ptr_set_cached()Kent Overstreet1-19/+36
Preferentially keep existing cached pointers instead of adding new ones. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: improve check_inode_hash_info_matches_root() error messageKent Overstreet2-15/+24
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: inline bch2_ob_ptr()Kent Overstreet2-15/+14
This was an oversight, we want bch2_alloc_sectors_append_ptrs_inlined() fully inlined. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_dev_in_target() no longer takes rcu_read_lock()Kent Overstreet2-7/+9
Minor optimization, the caller generally has it already. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_journal_write() refactoringKent Overstreet1-64/+46
Make the locking easier to follow; also take io_refs earlier, in __journal_write_alloc(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: delete_dead_snapshot_keys_v2()Kent Overstreet1-28/+136
Since extents, dirents and xattrs require an inode with the corresponding snapshot ID to exists, we can avoid a lot of scanning by only scanning those trees for keys to process if the correspending inode exists. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bcachefs_metadata_version_snapshot_deletion_v2Kent Overstreet6-56/+122
We're going to be speeding up snapshot deletion, by only having it process the extents/dirents/xattrs btrees if an inode of a given snapshot ID was present. This raises the possibility of 'bkey_in_missing_snapshot' errors popping up, if we ever accidentally don't do the corresponding inode update, or if the new algorithm has bugs. So instead of deleting snapshot IDs, add a new deleted flag, so that 'key in missing snapshot' errors can more definitively tell what happened and automatically repair. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: BCH_SNAPSHOT_DELETED -> BCH_SNAPSHOT_WILL_DELETEKent Overstreet2-7/+7
We're going to be speeding up snapshot deletion, by only having it process the extents/dirents/xattrs btrees if an inode of a given snapshot ID was present. This raises the possibility of 'bkey_in_missing_snapshot' errors popping up, if we ever accidentally don't do the corresponding inode update, or if the new algorithm has bugs. So we'll want to be able to differentiate more definitively between 'snapshot went missing' (and perhaps needs to be reconstructed), and 'key in snapshot that was deleted'. So instead of deleting snapshot IDs, we'll be adding a new deleted flag and leaving them permanently. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Skip unrelated snapshot trees in snapshot deletionKent Overstreet2-2/+44
Don't scan keys in inodes for which the snapshot tree doesn't match any we're deleting from. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: BCH_FSCK_ERR_snapshot_key_missing_inode_snapshotKent Overstreet1-18/+47
We're going to be doing some snapshot deletion performance improvements, and those will strictly require that if an extent/dirent/xattr is present, an inode is present in that snapshot ID. We already check for this, but we don't repair it on disk: this patch adds that repair and turns it into a real fsck_err(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: get_inodes_all_snapshots() now includes whiteoutsKent Overstreet1-52/+63
The next patch is going to change lookup_inode_for_snapshot to rigorously require that a extent/dirent/xattr keys have a corresponding inode key present - whiteouts included, so this simplifies the checks lookup_inode_for_snapshot() will have to do. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_inode_unpack() cleanupKent Overstreet1-4/+3
bi_snapshot is now handled like other fields Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Improve bch2_request_incompat_feature() messageKent Overstreet1-1/+2
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Fix inconsistent req->ecAlan Huang1-3/+3
There is req->ec = erasure_code above. Signed-off-by: Alan Huang <mmpgouride@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: kill inode_walker_entry.snapshotKent Overstreet1-24/+22
redundant Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Add comments for inode snapshot requirementsKent Overstreet2-0/+11
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: snapshot delete progress indicatorKent Overstreet8-61/+127
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Don't emit bch_sb_field_members_v1 if not requiredKent Overstreet1-0/+5
In 'bcachefs_metadata_extent_flags', we stopped requireding members_v1 to be present - only that either v1 or v2 is present. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Rename x_name to x_name_and_valueAlan Huang3-12/+12
The flexible array contains name and value, the x_name is misleading. Signed-off-by: Alan Huang <mmpgouride@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Improve bch2_disk_groups_to_text()Kent Overstreet1-58/+53
Print out the actual name of each path/label, instead of just the integer indexes. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22docs: bcachefs: add casefolding referenceKent Overstreet1-0/+18
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Fix setting ca->name in device addKent Overstreet1-6/+8
Device add doesn't get the devide index and attach to the filesystem until after attaching the block device, and setting the device name from the block device name - these needs some minor tweaks. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: sysfs trigger_recalc_capacityKent Overstreet1-2/+10
For bug diagnosis Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Avoid -Wflex-array-member-not-at-end warningsGustavo A. R. Silva4-13/+16
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Refactor a couple of structs that contain flexible arrays in the middle by replacing them with unions. So, with these changes, fix the following warnings: fs/bcachefs/disk_accounting.c:429:51: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] fs/bcachefs/ec_types.h:8:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_dev_add() can run on a non-started fsKent Overstreet1-17/+20
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_fs_open() now takes a darrayKent Overstreet7-21/+22
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_trans_update_ip()Kent Overstreet3-6/+15
Allow btree_insert_entry.ip_allocated to be passed in, so we get better info on where alloc updates are coming from. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Run most explicit recovery passes persistentKent Overstreet6-9/+6
If we detect an error that requires running a recovery pass, and we're not in recovery, we won't be able to fix it until the next mount - make sure we're noting in the superblock that it needs to run. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: provide unlocked version of run_explicit_recovery_pass_persistentKent Overstreet5-18/+38
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_dirent_to_text() shows casefolded direntsKent Overstreet1-3/+10
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Single err message for btree node readsKent Overstreet3-111/+151
Like we just did with the data read path, emit a single error message per btree node reads, nicely formatted, with all the actions we took grouped together. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_mark_btree_validate_failure()Kent Overstreet3-5/+28
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_fsck_err_opt()Kent Overstreet3-0/+47
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Plumb printbuf through bch2_btree_lost_data()Kent Overstreet5-35/+50
Part of the ongoing project to improve error messages by building them up in printbufs and emitting them all at once, so that we can easily see what events are related in the log. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: kill bch2_run_explicit_recovery_pass_persistent()Kent Overstreet3-34/+16
No longer has users, so we can kill it and rename bch2_run_explicit_recovery_pass_persistent_locked(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Remove redundant calls to btree_lost_data()Kent Overstreet2-10/+0
The btree node read path calls this before returning the read error. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_btree_lost_data() now handles snapshots treeKent Overstreet2-4/+4
We have a consolidated places for "this btree lost data, run this repair", so use it. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Kill redundant error message in topology repairKent Overstreet1-4/+1
The btree node read path already logs btree node read errors, this isn't needed. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Emit a single log message on data read errorKent Overstreet2-62/+31
Instead of emitting a message immediately when we get an error in the read path, and then another at the end if we successfully retry - emit one single log message before returning from bch2_rbio_retry(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_io_failures_to_text()Kent Overstreet2-0/+42
Pretty printer for bch_io_failures, to be used for better read error messages. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: print_string_as_lines: avoid printing empty lineKent Overstreet1-0/+13
If the final line in in the message to be printed is blang, don't print it. This happens with indented printbufs - after a newline we emit spaces up to the indent level. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Make various async objs visible in debugfsKent Overstreet7-15/+100
Add async objs list for - promote_op - bch_read_bio - btree_read_bio - btree_write_bio This gets us introspection on in-flight async ops, and because under the hood it uses fast_lists (percpu slot buffer on top of a radix tree), it'll be fast enough to enable in production. This will be very helpful for debugging "something got stuck" issues, which have been cropping up from time to time (in the CI, especially with folio writeback). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: Async object debuggingKent Overstreet10-32/+224
Debugging infrastructure for async objs: this lets us easily create fast_lists for various object types so they'll be visible in debugfs. Add new object types to the BCH_ASYNC_OBJS_TYPES() enum, and drop a pretty-printer wrapper in async_objs.c. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: fast_listKent Overstreet3-0/+198
A fast "list" data structure, which is actually a radix tree, with an IDA for slot allocation and a percpu buffer on top of that. Items cannot be added or moved to the head or tail, only added at some (arbitrary) position and removed. The advantage is that adding, removing and iteration is generally lockless, only hitting the lock in ida when the percpu buffer is full or empty. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-22bcachefs: bch2_read_bio_to_textKent Overstreet3-3/+52
Pretty printer for struct bch_read_bio. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>