History log of /linux-6.15/fs/bcachefs/btree_cache.c (Results 1 – 25 of 169)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7
# 19b22d04 13-May-2025 Kent Overstreet <[email protected]>

bcachefs: Don't set btree nodes as accessed on fill

Prevent jobs that do lots of scanning (i.e. evacuatee, scrub) from
causing OOMs.

The shrinker code seems to be having issues when it doesn't do a

bcachefs: Don't set btree nodes as accessed on fill

Prevent jobs that do lots of scanning (i.e. evacuatee, scrub) from
causing OOMs.

The shrinker code seems to be having issues when it doesn't do any
freeing because it's just flipping off the acccessed bit - and the
accessed bit shouldn't be set on first use anyways.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1
# 1ece5323 26-Mar-2025 Kent Overstreet <[email protected]>

bcachefs: Consistent indentation of multiline fsck errors

Add the new helper printbuf_indent_add_nextline(), and use it in
__bch2_fsck_err() to centralize setting the indentation of multiline
fsck e

bcachefs: Consistent indentation of multiline fsck errors

Add the new helper printbuf_indent_add_nextline(), and use it in
__bch2_fsck_err() to centralize setting the indentation of multiline
fsck errors.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.14, v6.14-rc7
# 7c1e2a25 14-Mar-2025 Kent Overstreet <[email protected]>

bcachefs: Add a cond_resched() to btree cache teardown

[12308.606480] watchdog: BUG: soft lockup - CPU#18 stuck for 26s! [umount:48479]
[12308.606485] Modules linked in: bcachefs lz4hc_compress lz4_

bcachefs: Add a cond_resched() to btree cache teardown

[12308.606480] watchdog: BUG: soft lockup - CPU#18 stuck for 26s! [umount:48479]
[12308.606485] Modules linked in: bcachefs lz4hc_compress lz4_compress lz4_decompress sunrpc overlay nf_conntrack_netlink xt_nat xt_tcpudp veth xt_conntrack xt_MASQUERADE bridge stp llc xfrm_user ip6table_nat ip6table_filter ip6_tables iptable_nat xt_addrtype iptable_filter ip_tables x_tables nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 psample ext4 mbcache jbd2 nls_iso8859_1 nls_cp850 vfat fat binfmt_misc skx_edac_common nfit edac_core libnvdimm cbc encrypted_keys intel_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency_common ipmi_ssif x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm drivetemp rapl intel_cstate coretemp mgag200 i2c_algo_bit ixgbe drm_shmem_helper drm_kms_helper mdio_devres xfrm_algo mdio drm ptp intel_uncore mei_me efi_pstore evdev uas pl2303 pps_core libphy usb_storage usbserial lpc_ich mei drm_panel_orientation_quirks acpi_power_meter tiny_power_button ipmi_si mfd_core intel_pch_thermal acpi_tad acpi_ipmi ioatdma
[12308.606541] ipmi_devintf ipmi_msghandler dca wmi button efivarfs polyval_clmulni polyval_generic ghash_clmulni_intel sha512_ssse3 sha256_ssse3 sha1_ssse3 sha1_generic xhci_pci xhci_hcd aesni_intel ehci_pci ehci_hcd gf128mul crypto_simd cryptd usbcore hpwdt usb_common
[12308.606557] CPU: 18 UID: 0 PID: 48479 Comm: umount Tainted: G L 6.14.0-rc6-x86_64-00159-ga09496a03e63 #1
[12308.606560] Tainted: [L]=SOFTLOCKUP
[12308.606561] Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 07/20/2023
[12308.606563] RIP: 0010:clear_page_erms+0x7/0x10
[12308.606570] Code: 48 89 47 38 48 8d 7f 40 75 d9 90 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 b9 00 10 00 00 31 c0 <f3> aa c3 cc cc cc cc 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90
[12308.606572] RSP: 0018:ffff9ed5b622fba0 EFLAGS: 00010246
[12308.606574] RAX: 0000000000000000 RBX: ffff90347fffe6c0 RCX: 00000000000004c0
[12308.606575] RDX: ffffe34ea9bec1c0 RSI: 00000000000405f0 RDI: ffff902eafb07b40
[12308.606576] RBP: ffff9ed5b622fbf0 R08: 0000000000000001 R09: 0000000000000006
[12308.606577] R10: 0000000000040001 R11: 0000000000000000 R12: ffffe34ea9bec000
[12308.606578] R13: 0000000000000000 R14: 0000000000000006 R15: ffffe34ea9bed000
[12308.606580] FS: 00007fe704ecfb68(0000) GS:ffff9053fea00000(0000) knlGS:0000000000000000
[12308.606581] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[12308.606582] CR2: 00007f18159068ae CR3: 00000001314d0005 CR4: 00000000007726f0
[12308.606583] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[12308.606584] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[12308.606584] PKRU: 55555554
[12308.606585] Call Trace:
[12308.606587] <IRQ>
[12308.606590] ? show_regs.cold+0x19/0x28
[12308.606595] ? watchdog_timer_fn.cold+0x3d/0x9d
[12308.606598] ? __pfx_watchdog_timer_fn+0x10/0x10
[12308.606602] ? __hrtimer_run_queues+0x12e/0x250
[12308.606607] ? hrtimer_interrupt+0xfd/0x220
[12308.606609] ? __sysvec_apic_timer_interrupt+0x53/0xe0
[12308.606614] ? sysvec_apic_timer_interrupt+0x76/0xa0
[12308.606619] </IRQ>
[12308.606620] <TASK>
[12308.606620] ? asm_sysvec_apic_timer_interrupt+0x1b/0x20
[12308.606626] ? clear_page_erms+0x7/0x10
[12308.606628] ? __free_pages_ok+0x374/0x640
[12308.606633] free_frozen_pages+0x34/0x570
[12308.606636] __folio_put+0x87/0xe0
[12308.606641] free_large_kmalloc+0x70/0x80
[12308.606645] kfree+0x2f6/0x390
[12308.606648] kvfree+0x2d/0x40
[12308.606653] __btree_node_data_free+0xaf/0xf0 [bcachefs]
[12308.606726] btree_node_data_free+0x6a/0x80 [bcachefs]
[12308.606778] bch2_fs_btree_cache_exit+0x262/0x440 [bcachefs]
[12308.606829] bch2_fs_release+0xe8/0x340 [bcachefs]
[12308.606905] kobject_put+0x60/0xc0
[12308.606908] bch2_fs_free+0xdd/0x120 [bcachefs]
[12308.606981] bch2_kill_sb+0x1e/0x30 [bcachefs]
[12308.607051] deactivate_locked_super+0x32/0xb0
[12308.607055] deactivate_super+0x40/0x50
[12308.607057] cleanup_mnt+0xc3/0x160
[12308.607060] __cleanup_mnt+0x12/0x20
[12308.607062] task_work_run+0x5f/0xa0
[12308.607064] syscall_exit_to_user_mode+0x194/0x1a0
[12308.607066] do_syscall_64+0x67/0x170
[12308.607068] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[12308.607070] RIP: 0033:0x7fe704e66eed
[12308.607073] Code: 08 49 89 ca b8 a5 00 00 00 0f 05 48 89 c7 e8 8a e6 ff ff 48 83 c4

Reported-by: Stijn Tintel <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.14-rc6, v6.14-rc5
# 677bdb73 26-Feb-2025 Alan Huang <[email protected]>

bcachefs: Fix deadlock

This fixes two deadlocks:

1.pcpu_alloc_mutex involved one as pointed by syzbot[1]
2.recursion deadlock.

The root cause is that we hold the bc lock during alloc_percpu, fix i

bcachefs: Fix deadlock

This fixes two deadlocks:

1.pcpu_alloc_mutex involved one as pointed by syzbot[1]
2.recursion deadlock.

The root cause is that we hold the bc lock during alloc_percpu, fix it
by following the pattern used by __btree_node_mem_alloc().

[1] https://lore.kernel.org/all/[email protected]/T/

Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Alan Huang <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1
# 0c74c85b 25-Jan-2025 Kent Overstreet <[email protected]>

bcachefs: fix bch2_btree_node_flags

Signed-off-by: Kent Overstreet <[email protected]>


Revision tags: v6.13, v6.13-rc7, v6.13-rc6
# cf67f466 30-Dec-2024 Kent Overstreet <[email protected]>

bcachefs: __bch2_btree_pos_to_text()

Factor out a version of bch2_btree_pos_to_text() that doesn't take a
pointer to a in-memory btree node, to be used for btree node scrub.

Signed-off-by: Kent Ove

bcachefs: __bch2_btree_pos_to_text()

Factor out a version of bch2_btree_pos_to_text() that doesn't take a
pointer to a in-memory btree node, to be used for btree node scrub.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12
# c738866e 15-Nov-2024 Kent Overstreet <[email protected]>

bcachefs: check_extents_to_backpointers() now only checks buckets with mismatches

Instead of walking every extent and every backpointer it points to,
first sum up backpointers in each bucket and che

bcachefs: check_extents_to_backpointers() now only checks buckets with mismatches

Instead of walking every extent and every backpointer it points to,
first sum up backpointers in each bucket and check for mismatches, and
only look for missing backpointers if mismatches were detected, and only
check extents in those buckets.

This is a major fsck scalability improvement, since the two backpointers
passes (backpointers -> extents and extents -> backpointers) are the
most expensive fsck passes by far.

Additionally, to speed up the upgrade for backpointer bucket gens, or in
situations when we have to rebuild alloc info, add a special case for
when no backpointers are found in a bucket - don't check each individual
backpointer (in particular, avoiding the write buffer flushes), just
recreate them.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# d9415976 26-Nov-2024 Kent Overstreet <[email protected]>

bcachefs: Fix bch2_btree_node_update_key_early()

Fix an assertion pop from the recent btree cache freelist fixes.

Fixes: baefd3f849ed ("bcachefs: btree_cache.freeable list fixes")
Reported-by: Tyle

bcachefs: Fix bch2_btree_node_update_key_early()

Fix an assertion pop from the recent btree cache freelist fixes.

Fixes: baefd3f849ed ("bcachefs: btree_cache.freeable list fixes")
Reported-by: Tyler <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# abf23afa 25-Nov-2024 Kent Overstreet <[email protected]>

bcachefs: Fix btree node scan when unknown btree IDs are present

btree_root entries for unknown btree IDs are created during recovery,
before reading those btree roots.

But btree_node_scan may find

bcachefs: Fix btree node scan when unknown btree IDs are present

btree_root entries for unknown btree IDs are created during recovery,
before reading those btree roots.

But btree_node_scan may find btree nodes with unknown btree IDs when we
haven't seen roots for those btrees.

Reported-by: [email protected]
Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# 375d21b7 24-Nov-2024 Kent Overstreet <[email protected]>

bcachefs: BCH_ERR_btree_node_read_error_cached

Signed-off-by: Kent Overstreet <[email protected]>


Revision tags: v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3
# db514cf6 10-Oct-2024 Kent Overstreet <[email protected]>

bcachefs: Avoid bch2_btree_id_str()

Prefer bch2_btree_id_to_text() - it prints out the integer ID when
unknown.

Signed-off-by: Kent Overstreet <[email protected]>


# baefd3f8 31-Oct-2024 Kent Overstreet <[email protected]>

bcachefs: btree_cache.freeable list fixes

When allocating new btree nodes, we were leaving them on the freeable
list - unlocked - allowing them to be reclaimed: ouch.

Additionally, bch2_btree_node_

bcachefs: btree_cache.freeable list fixes

When allocating new btree nodes, we were leaving them on the freeable
list - unlocked - allowing them to be reclaimed: ouch.

Additionally, bch2_btree_node_free_never_used() ->
bch2_btree_node_hash_remove was putting it on the freelist, while
bch2_btree_node_free_never_used() was putting it back on the btree
update reserve list - ouch.

Originally, the code was written to always keep btree nodes on a list -
live or freeable - and this worked when new nodes were kept locked.

But now with the cycle detector, we can't keep nodes locked that aren't
tracked by the cycle detector; and this is fine as long as they're not
reachable.

We also have better and more robust leak detection now, with memory
allocation profiling, so the original justification no longer applies.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# 72acab3a 27-Oct-2024 Kent Overstreet <[email protected]>

bcachefs: Fix error handling in bch2_btree_node_prefetch()

Signed-off-by: Kent Overstreet <[email protected]>


Revision tags: v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7
# 7a51608d 05-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: Rework btree node pinning

In backpointers fsck, we do a seqential scan of one btree, and check
references to another: extents <-> backpointers

Checking references generates random lookups

bcachefs: Rework btree node pinning

In backpointers fsck, we do a seqential scan of one btree, and check
references to another: extents <-> backpointers

Checking references generates random lookups, so we want to pin that
btree in memory (or only a range, if it doesn't fit in ram).

Previously, this was done with a simple check in the shrinker - "if
btree node is in range being pinned, don't free it" - but this generated
OOMs, as our shrinker wasn't well behaved if there was less memory
available than expected.

Instead, we now have two different shrinkers and lru lists; the second
shrinker being for pinned nodes, with seeks set much higher than normal
- so they can still be freed if necessary, but we'll prefer not to.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# 91ddd715 05-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: split up btree cache counters for live, freeable

this is prep for introducing a second live list and shrinker for pinned
nodes

Signed-off-by: Kent Overstreet <[email protected]>


# 691f2cba 05-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: btree cache counters should be size_t

32 bits won't overflow any time soon, but size_t is the correct type for
counting objects in memory.

Signed-off-by: Kent Overstreet <kent.overstreet@

bcachefs: btree cache counters should be size_t

32 bits won't overflow any time soon, but size_t is the correct type for
counting objects in memory.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# ad5dbe3c 04-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: Don't count "skipped access bit" as touched in btree cache scan

Signed-off-by: Kent Overstreet <[email protected]>


# ff7f756f 04-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: Use mm_account_reclaimed_pages() when freeing btree nodes

When freeing in a shrinker callback, we need to notify memory reclaim,
so it knows forward progress has been made.

Normally this

bcachefs: Use mm_account_reclaimed_pages() when freeing btree nodes

When freeing in a shrinker callback, we need to notify memory reclaim,
so it knows forward progress has been made.

Normally this is done in e.g. slab code, but we're not freeing through
slab - or rather we are, but these allocations are big, and use the
kmalloc_large() path.

This is really a bug in the slub code, but we're working around it here
for now.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# 895fbf1c 03-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: Use __GFP_ACCOUNT for reclaimable memory

Signed-off-by: Kent Overstreet <[email protected]>


# 3340dee2 01-Sep-2024 Kent Overstreet <[email protected]>

bcachefs: Add pinned to btree cache not freed counters

Signed-off-by: Kent Overstreet <[email protected]>


Revision tags: v6.11-rc6, v6.11-rc5
# b36f679c 19-Aug-2024 Kent Overstreet <[email protected]>

bcachefs: Drop memalloc_nofs_save() in bch2_btree_node_mem_alloc()

It's really not needed: the only locks used here are the btree cache
lock, which we drop for GFP_WAIT allocations, and btree node l

bcachefs: Drop memalloc_nofs_save() in bch2_btree_node_mem_alloc()

It's really not needed: the only locks used here are the btree cache
lock, which we drop for GFP_WAIT allocations, and btree node locks - but
we also drop those for GFP_WAIT allocations.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


# 5dbfc4ef 20-Aug-2024 Kent Overstreet <[email protected]>

bcachefs: fix failure to relock in btree_node_fill()

Signed-off-by: Kent Overstreet <[email protected]>


# 3c5d0b72 19-Aug-2024 Kent Overstreet <[email protected]>

bcachefs: fix failure to relock in bch2_btree_node_mem_alloc()

We weren't always so strict about trans->locked state - but now we are,
and new assertions are shaking some bugs out.

Signed-off-by: K

bcachefs: fix failure to relock in bch2_btree_node_mem_alloc()

We weren't always so strict about trans->locked state - but now we are,
and new assertions are shaking some bugs out.

Signed-off-by: Kent Overstreet <[email protected]>

show more ...


Revision tags: v6.11-rc4
# 49203a6b 18-Aug-2024 Kent Overstreet <[email protected]>

bcachefs: Fix failure to relock in btree_node_get()

discovered by new trans->locked asserts

Signed-off-by: Kent Overstreet <[email protected]>


Revision tags: v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3
# 11169d99 07-Jun-2024 Kent Overstreet <[email protected]>

bcachefs: bch2_btree_id_to_text()

Signed-off-by: Kent Overstreet <[email protected]>


1234567