Commit Graph

154 Commits

Author SHA1 Message Date
Kent Overstreet
d2bcf425d1 update min_heap
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-12-31 11:33:54 -05:00
Kent Overstreet
de51418b60 Update bcachefs sources to bc01863fb6ef bcachefs: bcachefs_metadata_version_disk_accounting_big_endian
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-11-29 21:27:09 -05:00
Kent Overstreet
1d68a6da59 Update bcachefs sources to 3b80552e7057 bcachefs: __wait_for_freeing_inode: Switch to wait_bit_queue_entry
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-09 19:49:17 -04:00
Kent Overstreet
b422b19f63 Update bcachefs sources to 22fa8fc32e6a bcachefs: rcu_pending now works in userspace 2024-08-23 19:34:30 -04:00
Kent Overstreet
e2e1493111 Update bcachefs sources to e7015d0df31c bcachefs: Simplify bch2_xattr_emit() implementation
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-08-17 16:09:41 -04:00
Kent Overstreet
4be409afea provide atomic64_try_cmpxchg() for 32bit
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-12 14:24:38 -04:00
Kent Overstreet
8b06995115 Update bcachefs sources to 2be6fc9b111c bcachefs: bch2_gc_btree() should not use btree_root_lock
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-05 09:16:45 -04:00
Kent Overstreet
34b5654d9e Update bcachefs sources to 9404a01d3dc5 bcachefs: Make read_only a mount option again, but hidden
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-28 18:26:04 -04:00
Kent Overstreet
f3ab07db73 fix missing include
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:08:47 -04:00
Kent Overstreet
477670f481 Update bcachefs sources to 07f9a27f1969 bcachefs: add no_invalid_checks flag 2024-05-09 16:26:14 -04:00
Kent Overstreet
5639fb38ca Update bcachefs sources to 09d4c2acbf4c bcachefs: reconstruct_inode()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-03 17:34:02 -04:00
Kent Overstreet
8e02744a90 Update bcachefs sources to 794723fc10c4 bcachefs: Topology repair now uses nodes found by scanning to fill holes
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-03-30 22:05:40 -04:00
Kent Overstreet
abfdc593a5 Update bcachefs sources to 83338f5b2cb8 bcachefs: fix for building in userspace 2024-03-16 19:40:33 -04:00
Kent Overstreet
03272a1e55 Update bcachefs sources to a623b3063d5d bcachefs: Fix check_snapshot() memcpy 2024-02-24 01:26:40 -05:00
Kent Overstreet
7a716b76b5 Update bcachefs sources to bee7b5a4fa21 bcachefs: Pin btree cache in ram for random access in fsck
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-09 21:32:46 -05:00
Kent Overstreet
f3f005c76e Update bcachefs sources to 50847e296b34 bcachefs: Check subvol <-> inode pointers in check_inode()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-06 01:07:16 -05:00
Kent Overstreet
38b8d01c4c Update bcachefs sources to 481b5f343248 bcachefs: Better error messages for missing inodes in fsck
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-24 17:36:11 -05:00
Kent Overstreet
b5fd066153 Move c_src dirs back to toplevel
We just wanted c sourcefiles out of the top level, not c source
directories.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 17:17:23 -05:00
Thomas Bertschinger
f5baaf48e3 move Rust sources to top level, C sources into c_src
This moves the Rust sources out of rust_src/ and into the top level.
Running the bcachefs executable out of the development tree is now:

$ ./target/release/bcachefs command
or
$ cargo run --profile release -- command

instead of "./bcachefs command".

Building and installing is still:

$ make && make install

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 01:47:05 -05:00
Kent Overstreet
f6bdf31843 kill bd_buffered_fd
this gets us back down to a single fd for opening block devices, which
means we can use O_EXCL.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-10 22:27:22 -05:00
Kent Overstreet
226bade565 kill bd_sync_fd
not needed with pwritev2(.., RWF_SYNC), and perhaps we can get down to
one fd and then use O_EXCL for block devices.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-10 22:27:22 -05:00
Kent Overstreet
fe37b584d3 fix shrinker_free()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-19 19:29:25 -05:00
Chris Webb
b44629a3db bcachefs-tools: Fix typo in 872cd43
6% of physical RAM is info.totalram >> 4 not info.totalram << 4.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-10 12:14:23 -05:00
Chris Webb
872cd437e7 bcachefs-tools: Avoid glibc-specific mallinfo() in shrinker
Before 326d7c1, the shrinker used freeram and totalram from a struct
sysinfo (constructed from /proc/meminfo) to target 25% free physical
memory. As well as the slowness of repeatedly reading /proc/meminfo,
this was a problem as freeram rises when the system starts to swap.
We don't want swapping to reduce our estimate of memory pressure.

To work around this, in 326d7c1 the shrinker started to use the total
allocated heap from a glibc-specific interface mallinfo2(), aiming to
shrink such that our heap is less than 80% of physical memory, unless
overall free memory is less than 6% so that becomes the determining factor.

Unfortunately, a sign error in the calculation means this heuristic
never worked. It would shrink aggressively when the process was small,
and not at all when the process grew beyond 80% of physical RAM. Only the
fallback test ensuring the free physical RAM doesn't fall below 6% would
actually kick in under memory pressure. It also breaks portability to
anything other than recent glibc.

Later, in 2440469 the mallinfo2() was replaced with the older mallinfo()
to improve compatibility with older glibc. This is even more problematic:
it's still not portable but also struct mallinfo has (signed) int fields
which overflow for large processes on 32-bit machines with a 3G/1G split.

Rather than trying to use libc-specific debug interfaces and our own heap
to inform the shrinker, use the information about free and total swap
we already have from sysinfo(2) to explicitly compensate for swapping
in our estimate of free physical memory. Target free memory of 6% of
physical RAM adjusted for zero swap use when calculating the pressure
on the shrinker, based on the effective behaviour of 326d7c1 in practice
given the sign error.

As well as fixing portability to non-glibc systems, this loosens the
assumption that we are the only process using significant memory when
setting the shrinker target. It wouldn't be unreasonable to run two
fsck jobs against independent devices on a large RAM machine and want to
balance physical RAM between them.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-09 23:28:01 -05:00
Chris Webb
ddc7161531 bcachefs-tools: Use sysinfo(2) directly to implement si_meminfo()
Use a single sysinfo(2) call to fill out struct sysinfo instead of
multiple libc sysconf(3) requests, which will only make sysinfo(2) calls
internally anyway. This also enables us to access other struct sysinfo
fields, not just the three filled-out previously.

As we provide our own definition of struct sysinfo in include/linux/mm.h
to match the kernel, which is not guaranteed to align with the definition
libc provides in <sys/sysinfo.h>, use syscall(SYS_sysinfo, ...) directly
instead of the libc wrapper.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-09 23:26:29 -05:00
Alexander Fougner
244046945a fix build for glibc prior to 2.33
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-12-07 21:36:47 +01:00
Kent Overstreet
cf78a3f65c Disable shrinker thread shutdown
We seem to be hitting a rare crash in the exit path of fsck - when
shutting down the shrinker thread. Disable exiting the shrinker thread
as a workaround.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-05 23:53:29 -05:00
Kent Overstreet
f27b135285 Update bcachefs sources to 71a5b27e017d bcachefs: Make backpointer fsck wb flush check more rigorous
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-30 02:20:51 -05:00
Daniel Hill
326d7c1b3b improve kmalloc performance
Reading from /proc/meminfo is really slow

We don't want to start swapping to disk.

Deceptively, memory available goes up when we start to swap to disk making
performance even worse.

To mitigate this:
1. replace reading from meminfo with proper system calls.
2. attempt to lock allocations in physical memory space.
3. check our own allocated memory instead of available memory.
4. still check available memory in the off chance we're trying to play
nice with other apps.

Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-24 19:54:11 -05:00
Kent Overstreet
06611a71a3 Update bcachefs sources to 783085c3cc44 kbuild: Allow gcov to be enabled on the command line
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-22 16:55:06 -05:00
Kent Overstreet
0a08ddf78c Update bcachefs sources to b9bd69421f73 bcachefs: x-macro-ify inode flags enum 2023-11-02 14:39:01 -04:00
Kent Overstreet
9799b119c3 Update bcachefs sources to 0d63ed13ea3d closures: Fix race in closure_sync()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-25 13:59:16 -04:00
Kent Overstreet
6b175a0224 Handle -EAGAIN from io_submit()
If io_submit() returns -EAGAIN, that just means the io context is full
and we need to wait for completions - no need to die.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-29 01:27:59 -04:00
Kent Overstreet
a053ebfb8c Update bcachefs sources to f9c612bbf82d bcachefs: Fixes for building in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-23 20:03:23 -04:00
Torge Matthies
e0e3032926
Fix one second delay when exiting
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2023-09-01 17:51:31 +02:00
Kent Overstreet
505c326cbe Update bcachefs sources to a8115093df bcachefs: Fix divide by zero in rebalance_work() 2023-08-17 17:11:27 -04:00
Kent Overstreet
71ed9f183b Run shrinkers when pthread_create fails
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-07-20 21:28:03 -04:00
Kent Overstreet
c8bec83e30 Update bcachefs sources to e14d7c7195 bcachefs: Compression levels
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-07-15 17:36:15 -04:00
Kent Overstreet
cfa816bf3f Update bcachefs sources to 84f132d569 bcachefs: fsck: Break walk_inode() up into multiple functions
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-06-27 19:38:18 -04:00
Kent Overstreet
4d185cfa51 Update bcachefs sources to 99175e5712 bcachefs: Fix bch2_check_discard_freespace_key() 2023-06-18 14:34:05 -04:00
Kent Overstreet
17d1c4f4fe Update bcachefs sources to ed6b7f81a7 six locks: Disable percpu read lock mode in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-06-10 22:15:00 -04:00
Kent Overstreet
8642d4ae10 Update bcachefs sources to 7c0fe6f104 bcachefs: Fix bch2_fsck_ask_yn()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-06-04 18:10:29 -04:00
Kent Overstreet
1f78fed469 Update bcachefs sources to 31c09369cd six locks: Fix an unitialized var
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-05-25 22:25:34 -04:00
Kent Overstreet
7f102ee83d Update bcachefs sources to 8fd009dd76 bcachefs: Rip out code for storing backpointers in alloc keys
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-31 18:02:57 -04:00
Kent Overstreet
fa35853772 Update bcachefs sources to 72405e7ff8 bcachefs: Fix bch2_check_extents_to_backpointers() 2023-03-14 12:56:38 -04:00
Kent Overstreet
d1def9a4b1 linux shim: Fix dropped O_DIRECT flag
A recent libbcachefs update accidentally committed a change that dropped
the O_DIRECT flag - we definitely didn't want to do that.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-08 10:30:16 -05:00
Kent Overstreet
b0c9ad15f4 Update bcachefs sources to 171da96d76 bcachefs: Drop some anonymous structs, unions 2023-03-04 23:33:25 -05:00
Kent Overstreet
30cca2e94d Update bcachefs sources to ca97ee3577 bcachefs: bch2_btree_iter_peek_and_restart_outlined()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-27 21:36:36 -05:00
Kent Overstreet
46a6b9210c Update bcachefs sources to 1b14994029 bcachefs: Fragmentation LRU 2023-02-17 17:51:22 -05:00
Kent Overstreet
a104f0407b Update bcachefs sources to ea93c26e98 fixup! bcachefs: We can handle missing btree roots for all alloc btrees
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-09 18:36:24 -05:00