linux/fs/btrfs
Filipe Manana 131a4be1c0 btrfs: simplify last record detection at test_range_bit_exists()
Instead of keeping track of the minimum start offset of the next record
and detecting overflow every time we update that offset to be the sum of
current record's end offset plus one, we can simply exit when the current
record ends at or beyond our end offset and forget about updating the
start offset on every iteration and testing for it at the top of the loop.
This makes both the source code and assembly code simpler, more efficient
and shorter (reducing the object text size).

Also remove the pointless initialization to NULL of the state variable, as
we don't use it before the first assignment to it. This may help avoid
some warnings with clang tools such as the one reported/fixed by commit
966de47ff0 ("btrfs: remove redundant initialization of variables in
log_new_ancestors").

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-05-15 14:30:41 +02:00
..
tests btrfs: use clear_extent_bits() instead of clear_extent_bit() where possible 2025-05-15 14:30:41 +02:00
accessors.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
accessors.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
acl.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
acl.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
async-thread.c btrfs: async-thread: switch local variables need_order bool 2025-03-18 20:35:42 +01:00
async-thread.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
backref.c btrfs: unify ordering of btrfs_key initializations 2025-03-18 20:35:42 +01:00
backref.h btrfs: remove detached list from struct btrfs_backref_cache 2025-01-13 14:53:15 +01:00
bio.c btrfs: avoid unnecessary bio dereference at run_one_async_done() 2025-03-18 20:35:50 +01:00
bio.h btrfs: fix error propagation of split bios 2024-10-23 18:17:43 +02:00
block-group.c btrfs: remove EXTENT_UPTODATE io tree flag 2025-05-15 14:30:39 +02:00
block-group.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
block-rsv.c btrfs: drop fs_info argument from btrfs_update_space_info_*() 2025-01-13 14:53:14 +01:00
block-rsv.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
btrfs_inode.h btrfs: make btrfs_iget_path() return a btrfs inode instead 2025-03-18 20:35:50 +01:00
compression.c btrfs: fix the file offset calculation inside btrfs_decompress_buf2page() 2025-05-15 14:30:40 +02:00
compression.h btrfs: defrag: extend ioctl to accept compression levels 2025-03-18 20:35:50 +01:00
ctree.c btrfs: avoid redundant path slot assignment in btrfs_search_forward() 2025-03-18 20:35:52 +01:00
ctree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
defrag.c btrfs: use rb_entry_safe() where possible to simplify code 2025-05-15 14:30:40 +02:00
defrag.h btrfs: pass struct btrfs_inode to btrfs_defrag_file() 2025-03-18 20:35:43 +01:00
delalloc-space.c btrfs: refactor how we handle reserved space inside copy_one_range() 2025-05-15 14:30:40 +02:00
delalloc-space.h btrfs: refactor how we handle reserved space inside copy_one_range() 2025-05-15 14:30:40 +02:00
delayed-inode.c btrfs: use rb_entry_safe() where possible to simplify code 2025-05-15 14:30:40 +02:00
delayed-inode.h btrfs: pass struct btrfs_inode to btrfs_fill_inode() 2025-03-18 20:35:43 +01:00
delayed-ref.c btrfs: use rb_entry_safe() where possible to simplify code 2025-05-15 14:30:40 +02:00
delayed-ref.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
dev-replace.c btrfs: return a literal instead of a variable in btrfs_init_dev_replace() 2025-03-18 20:35:49 +01:00
dev-replace.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
dir-item.c btrfs: use BTRFS_PATH_AUTO_FREE in btrfs_check_dir_item_collision() 2025-03-18 20:35:47 +01:00
dir-item.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
direct-io.c btrfs: pass struct btrfs_inode to can_nocow_extent() 2025-03-18 20:35:43 +01:00
direct-io.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
discard.c btrfs: fix discard worker infinite loop after disabling discard 2025-05-12 21:38:56 +02:00
discard.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
disk-io.c btrfs: remove unused flag EXTENT_BUFFER_CORRUPT 2025-05-15 14:30:39 +02:00
disk-io.h btrfs: remove stray comment about SRCU 2025-01-13 14:53:21 +01:00
export.c btrfs: make btrfs_iget() return a btrfs inode instead 2025-03-18 20:35:50 +01:00
export.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
extent-io-tree.c btrfs: simplify last record detection at test_range_bit_exists() 2025-05-15 14:30:41 +02:00
extent-io-tree.h btrfs: pass a pointer to get_range_bits() to cache first search result 2025-05-15 14:30:40 +02:00
extent-tree.c btrfs: remove unused flag EXTENT_BUFFER_CORRUPT 2025-05-15 14:30:39 +02:00
extent-tree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
extent_io.c btrfs: use clear_extent_bit() at try_release_extent_state() 2025-05-15 14:30:40 +02:00
extent_io.h btrfs: remove unused flag EXTENT_BUFFER_IN_TREE 2025-05-15 14:30:39 +02:00
extent_map.c btrfs: use rb_entry_safe() where possible to simplify code 2025-05-15 14:30:40 +02:00
extent_map.h btrfs: make the extent map shrinker run asynchronously as a work queue job 2024-11-11 14:34:17 +01:00
fiemap.c btrfs: correct typos in multiple comments across various files 2024-11-11 14:34:14 +01:00
fiemap.h btrfs: move fiemap code into its own file 2024-07-11 15:33:20 +02:00
file-item.c btrfs: use BTRFS_PATH_AUTO_FREE in btrfs_lookup_bio_sums() 2025-03-18 20:35:48 +01:00
file-item.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
file.c btrfs: prepare btrfs_punch_hole_lock_range() for large data folios 2025-05-15 14:30:40 +02:00
file.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
free-space-cache.c btrfs: make btrfs_iget_path() return a btrfs inode instead 2025-03-18 20:35:50 +01:00
free-space-cache.h btrfs: add cancellation points to trim loops 2024-10-07 23:21:56 +02:00
free-space-tree.c btrfs: use BTRFS_PATH_AUTO_FREE in load_free_space_tree() 2025-03-18 20:35:48 +01:00
free-space-tree.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
fs.c btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
fs.h btrfs: add back warning for mount option commit values exceeding 300 2025-05-12 21:39:34 +02:00
inode-item.c btrfs: unify ordering of btrfs_key initializations 2025-03-18 20:35:42 +01:00
inode-item.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
inode.c btrfs: use clear_extent_bits() instead of clear_extent_bit() where possible 2025-05-15 14:30:41 +02:00
ioctl.c btrfs: ioctl: don't free iov when btrfs_encoded_read() returns -EAGAIN 2025-04-01 01:02:26 +02:00
ioctl.h btrfs: pass struct btrfs_inode to btrfs_sync_inode_flags_to_i_flags() 2025-03-18 20:35:49 +01:00
Kconfig lib/crc: remove CONFIG_LIBCRC32C 2025-04-04 11:31:42 -07:00
locking.c btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
locking.h btrfs: add assertions and comment about path expectations to btrfs_cross_ref_exist() 2025-01-13 14:53:16 +01:00
lru_cache.c
lru_cache.h btrfs: cleanup recursive include of the same header 2024-07-11 15:33:22 +02:00
lzo.c btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() 2024-11-11 14:34:16 +01:00
Makefile btrfs: selftests: add delayed ref self test cases 2025-01-13 14:53:13 +01:00
messages.c btrfs: disable rate limiting when debug enabled 2024-10-01 19:29:41 +02:00
messages.h
misc.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
ordered-data.c btrfs: introduce a read path dedicated extent lock helper 2025-03-18 20:35:48 +01:00
ordered-data.h btrfs: introduce a read path dedicated extent lock helper 2025-03-18 20:35:48 +01:00
orphan.c btrfs: BTRFS_PATH_AUTO_FREE in orphan.c 2024-09-10 16:51:22 +02:00
orphan.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
print-tree.c btrfs: avoid using fixed char array size for tree names 2024-08-02 22:44:27 +02:00
print-tree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
props.c btrfs: props: switch prop_handler::extract to struct btrfs_inode 2025-03-18 20:35:44 +01:00
props.h btrfs: pass struct btrfs_inode to btrfs_inode_inherit_props() 2025-03-18 20:35:44 +01:00
qgroup.c btrfs: unify ordering of btrfs_key initializations 2025-03-18 20:35:42 +01:00
qgroup.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
raid-stripe-tree.c btrfs: don't use btrfs_set_item_key_safe on RAID stripe-extents 2025-01-14 15:52:22 +01:00
raid-stripe-tree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
raid56.c btrfs: make assert_rbio() to only check CONFIG_BTRFS_ASSERT 2024-11-11 14:34:12 +01:00
raid56.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
rcu-string.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
ref-verify.c btrfs: ref-verify: fix use-after-free after invalid ref action 2024-11-29 16:52:29 +01:00
ref-verify.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
reflink.c btrfs: use clear_extent_bits() instead of clear_extent_bit() where possible 2025-05-15 14:30:41 +02:00
reflink.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
relocation.c btrfs: remove leftover EXTENT_UPTODATE clear from an inode's io_tree 2025-05-15 14:30:39 +02:00
relocation.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
root-tree.c btrfs: root-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
root-tree.h btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume operations 2024-04-02 19:18:23 +02:00
scrub.c btrfs: avoid NULL pointer dereference if no valid csum tree 2025-05-02 13:20:11 +02:00
scrub.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
send.c btrfs: make btrfs_iget() return a btrfs inode instead 2025-03-18 20:35:50 +01:00
send.h btrfs: pass btrfs_root pointers to send ioctl parameters 2025-03-18 20:35:49 +01:00
space-info.c btrfs: fix typo in space info explanation 2025-05-15 14:30:39 +02:00
space-info.h btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
subpage.c btrfs: fix the ASSERT() inside GET_SUBPAGE_BITMAP() 2025-04-17 11:55:56 +02:00
subpage.h btrfs: replace PAGE_SIZE with folio_size for subpage.[ch] 2025-03-18 20:35:52 +01:00
super.c btrfs: add back warning for mount option commit values exceeding 300 2025-05-12 21:39:34 +02:00
super.h btrfs: change BTRFS_MOUNT_* flags to 64bit type 2024-07-19 17:20:23 +02:00
sysfs.c btrfs: allow debug builds to accept 2K block size 2025-03-18 20:35:49 +01:00
sysfs.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
transaction.c btrfs: explicitly ref count block_group on new_bgs list 2025-03-18 20:35:51 +01:00
transaction.h btrfs: move abort_should_print_stack() to transaction.h 2025-01-13 14:53:17 +01:00
tree-checker.c btrfs: tree-checker: adjust error code for header level check 2025-04-17 11:56:53 +02:00
tree-checker.h btrfs: validate system chunk array at btrfs_validate_super() 2025-01-13 14:53:18 +01:00
tree-log.c btrfs: fix fsync of files with no hard links not persisting deletion 2025-05-15 14:30:39 +02:00
tree-log.h btrfs: avoid transaction commit on any fsync after subvolume creation 2024-07-11 15:33:24 +02:00
tree-mod-log.c btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() 2024-11-11 14:34:15 +01:00
tree-mod-log.h btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() 2024-11-11 14:34:15 +01:00
ulist.c btrfs: preallocate ulist memory for qgroup rsv 2024-07-11 15:33:26 +02:00
ulist.h btrfs: preallocate ulist memory for qgroup rsv 2024-07-11 15:33:26 +02:00
uuid-tree.c btrfs: uuid-tree: remove unnecessary call to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
uuid-tree.h btrfs: move uuid tree related code to uuid-tree.[ch] 2024-09-10 16:51:12 +02:00
verity.c btrfs: pass struct btrfs_inode to btrfs_sync_inode_flags_to_i_flags() 2025-03-18 20:35:49 +01:00
verity.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
volumes.c btrfs: use clear_extent_bits() at chunk_map_device_clear_bits() 2025-05-15 14:30:40 +02:00
volumes.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
xattr.c btrfs: xattr: remove unnecessary call to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
xattr.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
zlib.c btrfs: zstd: enable negative compression levels mount option 2025-03-18 20:35:41 +01:00
zoned.c btrfs: zoned: skip reporting zone for new block group 2025-04-17 11:57:25 +02:00
zoned.h btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
zstd.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00