Commit graph

10 commits

Author SHA1 Message Date
Kent Overstreet 806ebf2aa0 bcachefs: Convert split_devs() to darray
Bit of cleanup & modernization: also moving this code to util.c, it'll
be used by userspace as well.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-01 11:47:43 -05:00
Kent Overstreet defd9e39b5 bcachefs: darray_for_each() now declares loop iter
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-01 11:47:42 -05:00
Kent Overstreet 099dc5c29d bcachefs: DARRAY_PREALLOCATED()
Add support to darray for preallocating some number of elements.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-01 11:46:52 -05:00
Kent Overstreet a58a6a58f5 bcachefs: Switch darray to kvmalloc()
We sometimes use darrays for quite large buffers - the btree write
buffer in particular needs large buffers, since it must be sized to hold
all the write buffer keys outstanding in the journal.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-01 11:46:52 -05:00
Kent Overstreet 73ab9e0386 bcachefs: Factor out darray resize slowpath
Move the slowpath (actually growing the darray) to an out-of-line
function; also, add some helpers for the upcoming btree write buffer
rewrite.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-01 11:46:52 -05:00
Kent Overstreet d4c8bb69d0 bcachefs: Convert bch2_fs_open() to darray
Open coded dynamic arrays are deprecated.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-05 13:12:17 -05:00
Kent Overstreet bf5a261c7a bcachefs: Assorted fixes for clang
clang had a few more warnings about enum conversion, and also didn't
like the opts.c initializer.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:10:09 -04:00
Kent Overstreet c42b57c451 bcachefs: bch2_buffered_write large folio conversion
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:09:59 -04:00
Kent Overstreet 9edbcc72f6 bcachefs: Fix bch2_evict_subvolume_inodes()
This fixes a bug in bch2_evict_subvolume_inodes(): d_mark_dontcache()
doesn't handle the case where i_count is already 0, we need to grab and
put the inode in order for it to be dropped.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:09:57 -04:00
Kent Overstreet 91d961badf bcachefs: darrays
Inspired by CCAN darray - simple, stupid resizable (dynamic) arrays.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-10-22 17:09:28 -04:00