btrfs: remove some unused and pointless code
cover btrfs: remove some unused and pointless code
From: Filipe Manana <[email protected]>
Details in the change logs. Trivial changes.
Filipe Manana (3):
btrfs: remove pointless return value assignment at btrfs_finish_one_ordered()
btrfs: remove list emptyness check at warn_about_uncommitted_trans()
btrfs: remove no longer used btrfs_clone_chunk_map()
fs/btrfs/disk-io.c | 3 --- fs/btrfs/inode.c | 1 - fs/btrfs/volumes.c | 15 --------------- fs/btrfs/volumes.h | 1 - 4 files changed, 20 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 btrfs: remove pointless return value assignment at btrfs_finish_one_ordered()
From: Filipe Manana <[email protected]>
At btrfs_finish_one_ordered() it's pointless to assign 0 to the 'ret' variable because if it has a non-zero value (error), we have already jumped to the 'out' label. So remove that redundant assignment.
--- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/inode.c +0 -1
@@ -3185,7 +3185,6 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)btrfs_abort_transaction (trans, ret); goto out; } - ret =0 ; out:clear_extent_bit (&inode->io_tree, start, end, clear_bits, &cached_state);
Signature · 1 line
2.43.0
PATCH 2/3 btrfs: remove list emptyness check at warn_about_uncommitted_trans()
In reply to [email protected]From: Filipe Manana <[email protected]>
At warn_about_uncommitted_trans(), there's no need to check if the list is empty and return, because list_for_each_entry_safe() is safe to call for an empty list, it simply does nothing. So remove the check.
--- fs/btrfs/disk-io.c | 3 --- 1 file changed, 3 deletions(-)
fs/btrfs/disk-io.c +0 -3
@@ -4182,9 +4182,6 @@ static void warn_about_uncommitted_trans(struct btrfs_fs_info *fs_info)struct btrfs_transaction *tmp;bool found = false; -if (list_empty (&fs_info->trans_list)) -return ; -/* * This function is only called at the very end of close_ctree(), * thus no other running transaction, no need to take trans_lock.
Signature · 1 line
2.43.0
PATCH 3/3 btrfs: remove no longer used btrfs_clone_chunk_map()
In reply to [email protected]From: Filipe Manana <[email protected]>
There are no more users of btrfs_clone_chunk_map(), the last one (and only one ever) was removed in commit 1ec17ef59168 ("btrfs: zoned: fix use-after-free in do_zone_finish()"). So remove btrfs_clone_chunk_map().
--- fs/btrfs/volumes.c | 15 --------------- fs/btrfs/volumes.h | 1 - 2 files changed, 16 deletions(-)
fs/btrfs/volumes.c +0 -15
@@ -5614,21 +5614,6 @@ struct btrfs_chunk_map *btrfs_alloc_chunk_map(int num_stripes, gfp_t gfp)return map; } -struct btrfs_chunk_map *btrfs_clone_chunk_map (struct btrfs_chunk_map *map,gfp_t gfp) -{ -const int size =btrfs_chunk_map_size (map->num_stripes); -struct btrfs_chunk_map *clone; - - clone =kmemdup (map, size, gfp); -if (!clone) -return NULL ; - -refcount_set (&clone->refs,1 ); -RB_CLEAR_NODE (&clone->rb_node); - -return clone; -} -static struct btrfs_block_group *create_chunk (struct btrfs_trans_handle *trans,struct alloc_chunk_ctl *ctl,struct btrfs_device_info *devices_info)
fs/btrfs/volumes.h +0 -1
@@ -743,7 +743,6 @@ struct btrfs_chunk_map *btrfs_alloc_chunk_map(int num_stripes, gfp_t gfp);int btrfs_add_chunk_map (struct btrfs_fs_info *fs_info,struct btrfs_chunk_map *map);#endif -struct btrfs_chunk_map *btrfs_clone_chunk_map (struct btrfs_chunk_map *map,gfp_t gfp);struct btrfs_chunk_map *btrfs_find_chunk_map (struct btrfs_fs_info *fs_info,u64 logical,u64 length); struct btrfs_chunk_map *btrfs_find_chunk_map_nolock(struct btrfs_fs_info *fs_info,
Signature · 1 line
2.43.0
Quoted 8 lines · On Wed, Apr 03, 2024 at 01:05:45PM +0100, [email protected] wrote:
From: Filipe Manana <[email protected]>
Details in the change logs. Trivial changes.
Filipe Manana (3):
btrfs: remove pointless return value assignment atbtrfs_finish_one_ordered()
btrfs: remove list emptyness check atwarn_about_uncommitted_trans()
btrfs: remove no longer usedbtrfs_clone_chunk_map()
Quoted 8 lines · 在 2024/4/3 22:35, [email protected] 写道:
From: Filipe Manana <[email protected]>
Details in the change logs. Trivial changes.
Filipe Manana (3):
btrfs: remove pointless return value assignment atbtrfs_finish_one_ordered()
btrfs: remove list emptyness check atwarn_about_uncommitted_trans()
btrfs: remove no longer usedbtrfs_clone_chunk_map()
Thanks,
Qu
Quoted 7 lines
fs/btrfs/disk-io.c | 3 --- fs/btrfs/inode.c | 1 - fs/btrfs/volumes.c | 15 --------------- fs/btrfs/volumes.h | 1 - 4 files changed, 20 deletions(-)