aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-21bcachefs: bch2_opts_to_text()Kent Overstreet3-21/+35
Factor out bch2_show_options() into a generic helper, for debugging option passing issues. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: improve "no device to read from" messageKent Overstreet1-1/+7
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Fix compilation error for bch2_sb_member_allocHongbo Li1-6/+10
Fix the following compilation error: ``` fs/bcachefs/sb-members.c: In function ‘bch2_sb_member_alloc’: fs/bcachefs/sb-members.c:508:2: error: a label can only be part of a statement and a declaration is not a statement 508 | unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices); ``` Fixes: a7d364a133c7 ("bcachefs: bch2_sb_member_alloc()") Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: bch2_sb_member_alloc()Kent Overstreet3-46/+53
refactoring Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: bch2_dev_remove_alloc() -> alloc_background.cKent Overstreet3-27/+30
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Move tabstop setup to bch2_dev_usage_to_text()Kent Overstreet2-7/+9
No reason for it not to be where it's needed. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Options for recovery_passes, recovery_passes_excludeKent Overstreet8-20/+33
This adds mount options for specifying recovery passes to run, or exclude; the immediate need for this is that backpointers fsck is having trouble completing, so we need a way to skip it. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Use mm_account_reclaimed_pages() when freeing btree nodesKent Overstreet1-0/+11
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]>
2024-09-21bcachefs: Use __GFP_ACCOUNT for reclaimable memoryKent Overstreet2-0/+4
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Hook up RENAME_WHITEOUT in rename.Sasha Finkelstein4-14/+52
This is needed for overlayfs, which is used by container managers. Signed-off-by: Sasha Finkelstein <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: rebalance writes use BCH_WRITE_ONLY_SPECIFIED_DEVSKent Overstreet2-2/+3
this was an oversight: rebalance is moving data to a specific device, so we don't want it falling back to the full filesystem Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: BCH_WRITE_ALLOC_NOWAIT no longer applies to open bucket allocationKent Overstreet3-12/+16
rebalance writes must be BCH_WRITE_ALLOC_NOWAIT because they don't allocate from the full filesystem - but we don't want spurious allocation failures due to open buckets. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: fix prototype to bch2_alloc_sectors_start_trans()Kent Overstreet4-17/+18
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: kill redundant is_vmalloc_addr()Kent Overstreet1-8/+4
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: convert __bch2_encrypt_bio() to darrayKent Overstreet1-19/+22
like the previous patch, kill use of bare arrays; the encryption code likes to work in big batches, so this is a small performance improvement. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: do_encrypt() now handles allocation failuresKent Overstreet1-18/+30
convert to darray, and add a fallback when allocation fails Signed-off-by: Kent Overstreet <[email protected]>
2024-09-21bcachefs: Add pinned to btree cache not freed countersKent Overstreet2-21/+36
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Annotate bch_replicas_entry_{v0,v1} with __counted_by()Thorsten Blum4-7/+13
Add the __counted_by compiler attribute to the flexible array members devs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Increment nr_devs before adding a new device to the devs array and adjust the array indexes accordingly. Add a helper macro for adding a new device. In bch2_journal_read(), explicitly set nr_devs to 0. Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: support idmap mountsHongbo Li1-16/+34
We enable idmapped mounts for bcachefs. Here, we just pass down the user_namespace argument from the VFS methods to the relevant helpers. The idmap test in bcachefs is as following: ``` 1. losetup /dev/loop1 bcachefs.img 2. ./bcachefs format /dev/loop1 3. mount -t bcachefs /dev/loop1 /mnt/bcachefs/ 4. ./mount-idmapped --map-mount b:0:1000:1 /mnt/bcachefs /mnt/idmapped1/ ll /mnt/bcachefs total 2 drwx------. 2 root root 0 Jun 14 14:10 lost+found -rw-r--r--. 1 root root 1945 Jun 14 14:12 profile ll /mnt/idmapped1/ total 2 drwx------. 2 1000 1000 0 Jun 14 14:10 lost+found -rw-r--r--. 1 1000 1000 1945 Jun 14 14:12 profile Signed-off-by: Hongbo Li <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Annotate struct bch_xattr with __counted_by()Thorsten Blum1-1/+1
Add the __counted_by compiler attribute to the flexible array member x_name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Switch gc bucket array to a genradixKent Overstreet4-37/+6
A user with a 30 tb device is overflowing the INT_MAX limit on vmalloc allocations... Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: darray: convert to alloc_hooks()Kent Overstreet2-18/+12
better memory allocation profiling support Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Convert to use jiffies macrosChen Yufan3-3/+5
Use jiffies macros instead of using jiffies directly to handle wraparound. Signed-off-by: Chen Yufan <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Refactor bch2_bset_fix_lookup_tableAlan Huang1-60/+68
bch2_bset_fix_lookup_table is too complicated to be easily understood, the comment "l now > where" there is also incorrect when where == t->end_offset. This patch therefore refactor the function, the idea is that when where >= rw_aux_tree(b, t)[t->size - 1].offset, we don't need to adjust the rw aux tree. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Assert that we don't lock nodes when !trans->lockedKent Overstreet3-16/+17
We rely on the trans->locked to know if a trans has nodes locked for assertions about deadlocks; there can't be more than one trans in the same process that is locked. Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Do not check folio_has_private()Matthew Wilcox (Oracle)1-3/+1
folio_has_private() is an attractive nuisance; filesystem authors generally don't realise that it actually checks two flags (one of which is never set by bcachefs). There's no need to check the private flag at all; for folios owned by bcachefs, we know that folio->private is NULL when the private flag is clear and non-NULL when the private flag is set. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: bch2_time_stats_reset()Kent Overstreet3-2/+24
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Drop memalloc_nofs_save() in bch2_btree_node_mem_alloc()Kent Overstreet1-5/+0
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]>
2024-09-09bcachefs: Simplify bch2_xattr_emit() implementationYouling Tang1-6/+16
Use helper functions to make code more readable. Similar to commit a5488f29835c ("fs: simplify ->listxattr() implementation") Signed-off-by: Youling Tang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: drop unused posix acl handlersYouling Tang1-4/+0
Remove struct nop_posix_acl_{access,default} for bcachefs filesystem that don't depend on the xattr handler in their inode->i_op->listxattr() method in any way. There's nothing more to do than to simply remove the handler. It's been effectively unused ever since we introduced the new posix acl api. See [1] for details. Link [1]: https://patchwork.kernel.org/project/linux-fsdevel/cover/20230125-fs-acl-remove-generic-xattr-handlers-v3-0-f760cc58967d@kernel.org/ Signed-off-by: Youling Tang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Remove unused parameterAlan Huang3-4/+3
iter here is unused, remove it. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Remove the prev array stuffAlan Huang1-30/+4
After reducing the search range when building the aux tree, the prev array stuff is no longer useful, so remove it. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Minimize the search range used to calculate the mantissaAlan Huang1-1/+1
When the search key's mantissa is larger than the node i's, we know that the search key is larger than the first key of the cacheline corresponding to node i, so that when we are calculating the mantissa of right side nodes of node i, the left side of the search range can be the first key of node i. Once the search range is minimized, the mantissa we are calculating can have more useful bits, thus reduce the slow path comparison. Besides, we can now remove all the prev array stuff. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Convert open-coded extra computation to helperAlan Huang1-1/+1
This patch replaces open-coded extra computation to eytzinger1_extra. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Remove dead code in __build_ro_aux_treeAlan Huang1-3/+0
This logic is no longer useful since commit 3ce8b463e3e0 ("bcachefs: kill bset_tree->max_key"), so remove it. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Remove unused parameter of bkey_mantissa_bits_droppedAlan Huang1-3/+2
The idx parameter of bkey_mantissa_bits_dropped is unused, remove it. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Remove unused parameter of bkey_mantissaAlan Huang1-4/+3
The idx parameter of bkey_mantissa became unused since commit b904a7991802 ("bcachefs: Go back to 16 bit mantissa bkey floats"), so remove it. Signed-off-by: Alan Huang <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: bch2_sb_nr_devices()Kent Overstreet3-7/+13
factoring out a helper Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: trivial open_bucket_add_buckets() cleanupKent Overstreet1-4/+1
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Fix a spelling error in docsXiaxi Shen1-1/+1
Signed-off-by: Xiaxi Shen <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: promote_whole_extents is now a normal optionKent Overstreet7-9/+11
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: Move rebalance_status out of sysfs/internalKent Overstreet1-1/+1
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: remove the unused parameter in macro bkey_crc_nextJulian Sun1-2/+2
In the macro definition of bkey_crc_next, five parameters were accepted, but only four of them were used. Let's remove the unused one. The patch has only passed compilation tests, but it should be fine. Signed-off-by: Julian Sun <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: fix macro definition allocate_dropping_locksJulian Sun1-1/+1
The macro allocate_dropping_locks accepts a parameter _trans, but it was not used, rather the variable trans was directly used, which may be a local variable inside a function that calls the macros. Signed-off-by: Julian Sun <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: fix macro definition allocate_dropping_locks_errcodeJulian Sun1-1/+1
The macro allocate_dropping_locks_errocode accepts a parameter _trans, but it was not used, rather the variable trans was directly used, which may be a local variable inside a function that calls the macros. Signed-off-by: Julian Sun <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: remove the unused macro definitionJulian Sun1-9/+0
macro bch2_kthread_wait_event_ioclock_timeout is no longer used, let's remove it. The patch has passed compilation test. Signed-off-by: Julian Sun <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: quota_reserve_range() -> for_each_btree_key_in_subvolume_uptoKent Overstreet1-32/+14
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: bch2_folio_set() -> for_each_btree_key_in_subvolume_uptoKent Overstreet1-55/+35
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: range_has_data() -> for_each_btree_key_in_subvolume_uptoKent Overstreet1-24/+5
Signed-off-by: Kent Overstreet <[email protected]>
2024-09-09bcachefs: bch2_seek_hole() -> for_each_btree_key_in_subvolume_uptoKent Overstreet1-36/+20
Signed-off-by: Kent Overstreet <[email protected]>