summaryrefslogtreecommitdiff
path: root/fs/bcachefs/util.h
AgeCommit message (Collapse)Author
2022-05-20bcachefs: Convert to lib/printbuf.cprintbuf_v2Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Gap buffer for journal keysKent Overstreet
Btree updates before we go RW work by inserting into the array of keys that journal replay will insert - but inserting into a flat array is O(n), meaning if btree_gc needs to update many alloc keys, we're O(n^2). Fortunately, the updates btree_gc does happens in sequential order, which means a gap buffer works nicely here - this patch implements a gap buffer for journal keys. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Fix pr_buf() callsKent Overstreet
In a few places we were passing a variable to pr_buf() for the format string - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Heap code fixKent Overstreet
When deleting an entry from a heap that was at entry h->used - 1, we'd end up calling heap_sift() on an entry outside the heap - the entry we just removed - which would end up re-adding it to the heap and deleting something we didn't want to delete. Oops... Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Add printf format attribute to bch2_pr_buf()Kent Overstreet
This tells the compiler to check printf format strings, and catches a few bugs. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Revert UUID format-specifier changeKent Overstreet
"bcachefs: Log & error message improvements" accidentally changed the format specifier we use for converting UUIDs to strings, which broke mounting of encrypted filesystems - this patch reverts that change. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Fix pr_tab_rjust()Kent Overstreet
pr_tab_rjust() was broken and leaving a null somewhere in the output string - this patch fixes it and simplifies it a bit. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Heap allocate printbufsKent Overstreet
This patch changes printbufs dynamically allocate and reallocate a buffer as needed. Stack usage has become a bit of a problem, and a major cause of that has been static size string buffers on the stack. The most involved part of this refactoring is that printbufs must now be exited with printbuf_exit(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Convert bch2_pd_controller_print_debug() to a printbufKent Overstreet
Fewer random on-stack char arrays. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Add tabstops to printbufsKent Overstreet
Now, when outputting to printbufs, we can set tabstops and left or right justify text to them - this is to be used by the userspace 'bcachefs fs usage' command. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Add .to_text() methods for all superblock sectionsKent Overstreet
This patch improves the superblock .to_text() methods and adds methods for all types that were missing them. It also improves printbufs by allowing them to specfiy what units we want to be printing in, and adds new wrapper methods for unifying our kernel and userspace environments. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Kill bch_scnmemcpy()Kent Overstreet
bch_scnmemcpy was for printing length-limited strings that might not have a terminating null - turns out sprintf & pr_buf can do this with %.*s. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Improve journal_entry_btree_keys_to_text()Kent Overstreet
This improves the formatting of journal_entry_btree_keys_to_text() by putting each key on its own line. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Log & error message improvementsKent Overstreet
- Add a shim uuid_unparse_lower() in the kernel, since %pU doesn't work in userspace - We don't need to print the bcachefs: or the filesystem name prefix in userspace - Improve a few error messages Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Kill PAGE_SECTOR_SHIFTKent Overstreet
Replace it with the new, standard PAGE_SECTORS_SHIFT Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Don't disable preemption unnecessarilyKent Overstreet
Small improvements to some percpu utility code. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Check for duplicate device ptrs in bch2_bkey_ptrs_invalid()Kent Overstreet
This is something we clearly should be checking for, but weren't - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Delete memcpy() macroKent Overstreet
This checks for overlapping src and dst in debug mode (i.e. should have used memmove) - kasan should be checking for this now. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Convert various code to printbufKent Overstreet
printbufs know how big the buffer is that was allocated, so we can get rid of the random PAGE_SIZEs all over the place. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Make memcpy_to_bio() param constKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-17bcachefs: Initial commitKent Overstreet
Forked from drivers/md/bcache, now a full blown COW multi device filesystem with a long list of features - https://bcachefs.org Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>