aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-03-13bcachefs: Fix path where dirent -> subvol missing and we don't fixKent Overstreet1-4/+9
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: bch_subvolume::parent -> creation_parentKent Overstreet2-13/+13
bit of renaming, prep for adding a fs path parent Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: Repair subvol dirents that point to non subvolsKent Overstreet1-0/+6
when repair switches d_type to or from DT_SUBVOL, we need to update the target accordingly Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: check dirent->d_parent_subvolKent Overstreet1-4/+57
Check that d_parent_subvol makes sense - the dirent's snapshot must be visible in d_parent_subvol (i.e. an ancestor of d_parent_subvol's snapshot) in order to be visible. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: check inode->bi_parent_subvol against direntKent Overstreet2-23/+14
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: delete duplicated checks in check_dirent_to_subvol()Kent Overstreet1-23/+4
these were already checked in check_subvol() Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: simplify check_dirent_inode_dirent()Kent Overstreet1-58/+56
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: check bi_parent_subvol in check_inode()Kent Overstreet1-0/+10
check for inodes with a nonzero bi_parent_subvol field that aren't actually subvolume roots Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: better log message in lookup_inode_for_snapshot()Kent Overstreet1-21/+24
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: check_inode_dirent_inode()Kent Overstreet1-36/+89
check that if an inode has a backpointer, the dirent it points to points back to it. We do this in check_dirent_inode_dirent(), but only for inodes that have dirents that point to them - we also have to do the check starting from the inode to catch inodes that don't have dirents that point to them. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: Check subvol <-> inode pointers in check_inode()Kent Overstreet1-0/+25
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: Check subvol <-> inode pointers in check_subvol()Kent Overstreet3-1/+34
Subvolumes and subvolume root inodes point to each other: this verifies the subvolume -> inode -> subvolme path. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: Kill more -EIO error codesKent Overstreet11-20/+27
This converts -EIOs related to btree node errors to private error codes, which will help with some ongoing debugging by giving us better error messages. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: add f_ops.flushKent Overstreet3-7/+32
Add a flush op, to return the exit code via close(). Also update bcachefs usage to use this to return fsck exit codes. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: Fix missing va_end()Kent Overstreet1-0/+2
Fixes: https://lore.kernel.org/linux-bcachefs/202402131603.E953E2CF@keescook/T/#u Reported-by: coverity scan Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: allow ioctls against these filesDarrick J. Wong2-0/+13
Make it so that a thread_with_stdio user can handle ioctls against the file descriptor. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: create ops structure for thread_with_stdioDarrick J. Wong3-22/+28
Create an ops structure so we can add more file-based functionality in the next few patches. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: fix various printf problemsDarrick J. Wong2-20/+37
Experimentally fix some problems with stdio_redirect_vprintf by creating a MOO variant with which we can experiment. We can't do a GFP_KERNEL allocation while holding the spinlock, and I don't like how the printf function can silently truncate the output if memory allocation fails. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_file: allow creation of readonly filesDarrick J. Wong2-0/+39
Create a new run_thread_with_stdout function that opens a file in O_RDONLY mode so that the kernel can write things to userspace but userspace cannot write to the kernel. This will be used to convey xfs health event information to userspace. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_stdio: suppress hung task warningKent Overstreet1-2/+15
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13kernel/hung_task.c: export sysctl_hung_task_timeout_secsKent Overstreet1-0/+1
needed for thread_with_file; also rare but not unheard of to need this in module code, when blocking on user input. one workaround used by some code is wait_event_interruptible() - but that can be buggy if the outer context isn't expecting unwinding. Signed-off-by: Kent Overstreet <[email protected]> Cc: Andrew Morton <[email protected]> Cc: fuyuanli <[email protected]>
2024-03-13bcachefs: thread_with_stdio: Mark completed in ->release()Kent Overstreet1-4/+10
This fixes stdio_redirect_read() getting stuck, not noticing that the pipe has been closed. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: Thread with file documentationKent Overstreet2-7/+40
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_stdio: fix bch2_stdio_redirect_readline()Kent Overstreet1-11/+22
This fixes a bug where we'd return data without waiting for a newline, if data was present but a newline was not. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_stdio: kill thread_with_stdio_done()Kent Overstreet3-22/+23
Move the cleanup code to a wrapper function, where we can call it after the thread_with_stdio fn exits. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_stdio: convert to darrayKent Overstreet4-100/+160
- eliminate the dependency on printbufs, so that we can lift thread_with_file for use in xfs - add a nonblocking parameter to stdio_redirect_printf(), and either block if the buffer is full or drop it on the floor - don't buffer infinitely Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: thread_with_stdio: eliminate double bufferingKent Overstreet2-41/+18
The output buffer lock has to be a spinlock so that we can write to it from interrupt context, so we can't use a direct copy_to_user; this switches thread_with_file_read() to use fault_in_writeable() and copy_to_user_nofault(), similar to how thread_with_file_write() works. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13bcachefs: kill kvpmalloc()Kent Overstreet14-115/+49
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-13mempool: kvmalloc poolKent Overstreet2-0/+26
Add mempool_init_kvmalloc_pool() and mempool_create_kvmalloc_pool(), which wrap kvmalloc() instead of kmalloc() - kmalloc() with a vmalloc() fallback. This is part of a bcachefs cleanup - dropping an internal kvpmalloc() helper (which predates kvmalloc()) along with mempool helpers; this replaces the bcachefs-private kvpmalloc_pool. Signed-off-by: Kent Overstreet <[email protected]> Cc: [email protected]
2024-03-10bcachefs: bch2_lookup() gives better error message on inode not foundKent Overstreet1-9/+64
When a dirent points to a missing inode, we really should print out the dirent. This requires quite a bit of refactoring, but there's some other benefits: we now do the entire looup (dirent and inode) in a single btree transaction, and copy to the VFS inode with btree locks still held, like the create path. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: bch2_inode_insert()Kent Overstreet1-62/+76
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10mm: introduce PF_MEMALLOC_NORECLAIM, PF_MEMALLOC_NOWARNKent Overstreet2-6/+15
Introduce PF_MEMALLOC_* equivalents of some GFP_ flags: PF_MEMALLOC_NORECLAIM -> GFP_NOWAIT PF_MEMALLOC_NOWARN -> __GFP_NOWARN Cc: Vlastimil Babka <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Darrick J. Wong <[email protected]> Cc: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10mm: introduce memalloc_flags_{save,restore}Kent Overstreet1-17/+26
Our proliferation of memalloc_*_{save,restore} APIs is getting a bit silly, this adds a generic version and converts the existing save/restore functions to wrappers. Signed-off-by: Kent Overstreet <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Darrick J. Wong <[email protected]> Cc: [email protected] Acked-by: Vlastimil Babka <[email protected]>
2024-03-10bcachefs: factor out check_inode_backpointer()Kent Overstreet1-9/+29
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Factor out check_subvol_dirent()Kent Overstreet2-48/+58
Going to be adding more code here for checking subvol structure. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Kill some -EINVALsKent Overstreet2-5/+5
Repurposing standard error codes in bcachefs code is banned in new code, and we need to get rid of the remaining ones - private error codes give us much better error messages. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: bump max_active on btree_interior_update_workerKent Overstreet1-1/+1
WQ_UNBOUND with max_active 1 means ordered workqueue, but we don't actually need or want ordered semantics - and probably want a higher concurrency limit anyways. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: move fsck_write_inode() to inode.cKent Overstreet3-40/+44
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Initialize super_block->s_uuidKent Overstreet1-0/+1
Need to fix this oversight for the new FS_IOC_(GET|SET)UUID ioctls. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Switch to uuid_to_fsid()Kent Overstreet1-5/+1
switch the statfs code from something horrible and open coded to the more standard uuid_to_fsid() Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Subvolumes may now be renamedKent Overstreet2-26/+55
Files within a subvolume cannot be renamed into another subvolume, but subvolumes themselves were intended to be. This implements subvolume renaming - we need to ensure that there's only a single dirent that points to a subvolume key (not multiple versions in different snapshots), and we need to ensure that dirent.d_parent_subol and inode.bi_parent_subvol are updated. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: btree node prefetching in check_topologyKent Overstreet4-3/+42
btree_and_journal_iter is old code that we want to get rid of, but we're not ready to yet. lack of btree node prefetching is, it turns out, a real performance issue for fsck on spinning rust, so - add it. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: btree_and_journal_iter.transKent Overstreet4-17/+21
we now always have a btree_trans when using a btree_and_journal_iter; prep work for adding prefetching to btree_and_journal_iter Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: better journal pipeliningKent Overstreet4-59/+98
Recently a severe performance regression was discovered, which bisected to a6548c8b5eb5 bcachefs: Avoid flushing the journal in the discard path It turns out the old behaviour, which issued excessive journal flushes, worked around a performance issue where queueing delays would cause the journal to not be able to write quickly enough and stall. The journal flushes masked the issue because they periodically flushed the device write cache, reducing write latency for non flushes. This patch reworks the journalling code to allow more than one (non-flush) write to be in flight at a time. With this patch, doing 4k random writes and an iodepth of 128, we are now able to hit 560k iops to a Samsung 970 EVO Plus - previously, we were stuck in the ~200k range. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: closure per journal bufKent Overstreet3-23/+41
Prep work for having multiple journal writes in flight. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: bio per journal bufKent Overstreet3-29/+34
Prep work for having multiple journal writes in flight. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: jset_entry_datetimeKent Overstreet4-17/+67
This gives us a way to record the date and time every journal entry was written - useful for debugging. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: improve journal entry read fsck error messagesKent Overstreet1-41/+55
Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: convert journal replay ptrs to darrayKent Overstreet3-58/+36
Eliminates some error paths - no longer have a hardcoded BCH_REPLICAS_MAX limit. Signed-off-by: Kent Overstreet <[email protected]>
2024-03-10bcachefs: Cleanup bch2_dirent_lookup_trans()Kent Overstreet3-26/+14
Drop an unnecessary bch2_subvolume_get_snapshot() call, and drop the __ from the name - this is a normal interface. Signed-off-by: Kent Overstreet <[email protected]>