All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: remove some unused and pointless code
@ 2024-04-03 12:05 fdmanana
  2024-04-03 12:05 ` [PATCH 1/3] btrfs: remove pointless return value assignment at btrfs_finish_one_ordered() fdmanana
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fdmanana @ 2024-04-03 12:05 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] btrfs: remove pointless return value assignment at btrfs_finish_one_ordered()
  2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
@ 2024-04-03 12:05 ` fdmanana
  2024-04-03 12:05 ` [PATCH 2/3] btrfs: remove list emptyness check at warn_about_uncommitted_trans() fdmanana
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fdmanana @ 2024-04-03 12:05 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

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.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c6f2b5d1dee1..94ac20e62e13 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] btrfs: remove list emptyness check at warn_about_uncommitted_trans()
  2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
  2024-04-03 12:05 ` [PATCH 1/3] btrfs: remove pointless return value assignment at btrfs_finish_one_ordered() fdmanana
@ 2024-04-03 12:05 ` fdmanana
  2024-04-03 12:05 ` [PATCH 3/3] btrfs: remove no longer used btrfs_clone_chunk_map() fdmanana
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fdmanana @ 2024-04-03 12:05 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

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.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5a35c2c0bbc9..0474e9b6d302 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] btrfs: remove no longer used btrfs_clone_chunk_map()
  2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
  2024-04-03 12:05 ` [PATCH 1/3] btrfs: remove pointless return value assignment at btrfs_finish_one_ordered() fdmanana
  2024-04-03 12:05 ` [PATCH 2/3] btrfs: remove list emptyness check at warn_about_uncommitted_trans() fdmanana
@ 2024-04-03 12:05 ` fdmanana
  2024-04-03 13:39 ` [PATCH 0/3] btrfs: remove some unused and pointless code David Sterba
  2024-04-03 22:23 ` Qu Wenruo
  4 siblings, 0 replies; 6+ messages in thread
From: fdmanana @ 2024-04-03 12:05 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

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().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/volumes.c | 15 ---------------
 fs/btrfs/volumes.h |  1 -
 2 files changed, 16 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index f15591f3e54f..a3dc88e420d1 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -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)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 93854609a4d5..cf555f5b47ce 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -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,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] btrfs: remove some unused and pointless code
  2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
                   ` (2 preceding siblings ...)
  2024-04-03 12:05 ` [PATCH 3/3] btrfs: remove no longer used btrfs_clone_chunk_map() fdmanana
@ 2024-04-03 13:39 ` David Sterba
  2024-04-03 22:23 ` Qu Wenruo
  4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2024-04-03 13:39 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Wed, Apr 03, 2024 at 01:05:45PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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()

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] btrfs: remove some unused and pointless code
  2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
                   ` (3 preceding siblings ...)
  2024-04-03 13:39 ` [PATCH 0/3] btrfs: remove some unused and pointless code David Sterba
@ 2024-04-03 22:23 ` Qu Wenruo
  4 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2024-04-03 22:23 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



在 2024/4/3 22:35, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> 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()

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
>
>   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(-)
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-03 22:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 12:05 [PATCH 0/3] btrfs: remove some unused and pointless code fdmanana
2024-04-03 12:05 ` [PATCH 1/3] btrfs: remove pointless return value assignment at btrfs_finish_one_ordered() fdmanana
2024-04-03 12:05 ` [PATCH 2/3] btrfs: remove list emptyness check at warn_about_uncommitted_trans() fdmanana
2024-04-03 12:05 ` [PATCH 3/3] btrfs: remove no longer used btrfs_clone_chunk_map() fdmanana
2024-04-03 13:39 ` [PATCH 0/3] btrfs: remove some unused and pointless code David Sterba
2024-04-03 22:23 ` Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.