linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Make the code -Wunused clean
@ 2018-03-15 12:36 Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 1/8] btrfs: Remove unused op_key var from add_delayed_refs Nikolay Borisov
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

This series eliminates all -Wunused warnings in the code base. 

Nikolay Borisov (8):
  btrfs: Remove unused op_key var from add_delayed_refs
  btrfs: Remove unused length var from scrub_handle_errored_block
  btrfs: Remove unused tot_len var from lzo_decompress
  btrfs: Remove unused root var from relink_file_extents
  btrfs: remove max_active var from open_ctree
  btrfs: Remove unused parent_level var from btrfs_realloc_node
  btrfs: Remove unused extent_root var from caching_thread
  btrfs: Remove unused flush var in shrink_delalloc

 fs/btrfs/backref.c     | 5 +----
 fs/btrfs/ctree.c       | 3 ---
 fs/btrfs/disk-io.c     | 3 ---
 fs/btrfs/extent-tree.c | 7 -------
 fs/btrfs/inode.c       | 2 --
 fs/btrfs/lzo.c         | 2 --
 fs/btrfs/scrub.c       | 2 --
 7 files changed, 1 insertion(+), 23 deletions(-)

-- 
2.7.4


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

* [PATCH 1/8] btrfs: Remove unused op_key var from add_delayed_refs
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 2/8] btrfs: Remove unused length var from scrub_handle_errored_block Nikolay Borisov
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added as part of 86d5f9944252 ("btrfs: convert prelimary reference
tracking to use rbtrees") but never used. tmp_op_key essentially
subsumed that variable

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/backref.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 4e89598ca878..93f76a69dd44 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -773,15 +773,12 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
 	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
 	struct btrfs_key key;
 	struct btrfs_key tmp_op_key;
-	struct btrfs_key *op_key = NULL;
 	struct rb_node *n;
 	int count;
 	int ret = 0;
 
-	if (extent_op && extent_op->update_key) {
+	if (extent_op && extent_op->update_key)
 		btrfs_disk_key_to_cpu(&tmp_op_key, &extent_op->key);
-		op_key = &tmp_op_key;
-	}
 
 	spin_lock(&head->lock);
 	for (n = rb_first(&head->ref_tree); n; n = rb_next(n)) {
-- 
2.7.4


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

* [PATCH 2/8] btrfs: Remove unused length var from scrub_handle_errored_block
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 1/8] btrfs: Remove unused op_key var from add_delayed_refs Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 3/8] btrfs: Remove unused tot_len var from lzo_decompress Nikolay Borisov
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added in b5d67f64f9bc ("Btrfs: change scrub to support big blocks") but
rendered redundant by be50a8ddaae1 ("Btrfs: Simplify
scrub_setup_recheck_block()'s argument")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/scrub.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 629313732521..4ab4a68dbc06 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1111,7 +1111,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
 	struct scrub_ctx *sctx = sblock_to_check->sctx;
 	struct btrfs_device *dev;
 	struct btrfs_fs_info *fs_info;
-	u64 length;
 	u64 logical;
 	unsigned int failed_mirror_index;
 	unsigned int is_metadata;
@@ -1139,7 +1138,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
 		spin_unlock(&sctx->stat_lock);
 		return 0;
 	}
-	length = sblock_to_check->page_count * PAGE_SIZE;
 	logical = sblock_to_check->pagev[0]->logical;
 	BUG_ON(sblock_to_check->pagev[0]->mirror_num < 1);
 	failed_mirror_index = sblock_to_check->pagev[0]->mirror_num - 1;
-- 
2.7.4


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

* [PATCH 3/8] btrfs: Remove unused tot_len var from lzo_decompress
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 1/8] btrfs: Remove unused op_key var from add_delayed_refs Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 2/8] btrfs: Remove unused length var from scrub_handle_errored_block Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 4/8] btrfs: Remove unused root var from relink_file_extents Nikolay Borisov
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added already unused in a6fa6fae40ec ("btrfs: Add lzo compression
support")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/lzo.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index 6c7f18cd3b61..1c7f7f70caf4 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -382,14 +382,12 @@ static int lzo_decompress(struct list_head *ws, unsigned char *data_in,
 	struct workspace *workspace = list_entry(ws, struct workspace, list);
 	size_t in_len;
 	size_t out_len;
-	size_t tot_len;
 	int ret = 0;
 	char *kaddr;
 	unsigned long bytes;
 
 	BUG_ON(srclen < LZO_LEN);
 
-	tot_len = read_compress_length(data_in);
 	data_in += LZO_LEN;
 
 	in_len = read_compress_length(data_in);
-- 
2.7.4


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

* [PATCH 4/8] btrfs: Remove unused root var from relink_file_extents
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (2 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 3/8] btrfs: Remove unused tot_len var from lzo_decompress Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 5/8] btrfs: remove max_active var from open_ctree Nikolay Borisov
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added in 38c227d87c49 ("Btrfs: snapshot-aware defrag") but subsequently
made redundant by 0b246afa62b0 ("btrfs: root->fs_info cleanup, add
fs_info convenience variables")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6c08c03fc03c..1e9cceeaf4c4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2772,12 +2772,10 @@ static void relink_file_extents(struct new_sa_defrag_extent *new)
 	struct sa_defrag_extent_backref *backref;
 	struct sa_defrag_extent_backref *prev = NULL;
 	struct inode *inode;
-	struct btrfs_root *root;
 	struct rb_node *node;
 	int ret;
 
 	inode = new->inode;
-	root = BTRFS_I(inode)->root;
 
 	path = btrfs_alloc_path();
 	if (!path)
-- 
2.7.4


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

* [PATCH 5/8] btrfs: remove max_active var from open_ctree
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (3 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 4/8] btrfs: Remove unused root var from relink_file_extents Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 6/8] btrfs: Remove unused parent_level var from btrfs_realloc_node Nikolay Borisov
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Introduced by 5cdc7ad337fb ("btrfs: Replace fs_info->workers with
btrfs_workqueue.") but obsoleted by 2a4581983f90 ("btrfs: factor
btrfs_init_workqueues() out of open_ctree()")

Signed-off-by: Nikolay Borisov <nborisov@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 156116655a32..3809d6d66f6a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2390,7 +2390,6 @@ int open_ctree(struct super_block *sb,
 	int err = -EINVAL;
 	int num_backups_tried = 0;
 	int backup_index = 0;
-	u32 max_active;
 	int clear_free_space_tree = 0;
 
 	tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL);
@@ -2699,8 +2698,6 @@ int open_ctree(struct super_block *sb,
 		goto fail_alloc;
 	}
 
-	max_active = fs_info->thread_pool_size;
-
 	ret = btrfs_init_workqueues(fs_info, fs_devices);
 	if (ret) {
 		err = ret;
-- 
2.7.4


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

* [PATCH 6/8] btrfs: Remove unused parent_level var from btrfs_realloc_node
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (4 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 5/8] btrfs: remove max_active var from open_ctree Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 7/8] btrfs: Remove unused extent_root var from caching_thread Nikolay Borisov
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added by f2183bde1a91 ("Btrfs: Add BH_Defrag to mark buffers that are
in need of defragging") but obsoleted by 3f157a2fd2ad ("Btrfs: Online
btree defragmentation fixes")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ctree.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 1ef6b67f893a..88a8891ef2ec 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1571,14 +1571,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
 	int end_slot;
 	int i;
 	int err = 0;
-	int parent_level;
 	int uptodate;
 	u32 blocksize;
 	int progress_passed = 0;
 	struct btrfs_disk_key disk_key;
 
-	parent_level = btrfs_header_level(parent);
-
 	WARN_ON(trans->transaction != fs_info->running_transaction);
 	WARN_ON(trans->transid != fs_info->generation);
 
-- 
2.7.4


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

* [PATCH 7/8] btrfs: Remove unused extent_root var from caching_thread
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (5 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 6/8] btrfs: Remove unused parent_level var from btrfs_realloc_node Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-15 12:36 ` [PATCH 8/8] btrfs: Remove unused flush var in shrink_delalloc Nikolay Borisov
  2018-03-16 15:38 ` [PATCH 0/8] Make the code -Wunused clean David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added by b4570aa994b8 ("btrfs: fix compiling with CONFIG_BTRFS_DEBUG
enabled.") and obsoleted by 2ff7e61e0d30 ("btrfs: take an fs_info
directly when the root is not used otherwise")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent-tree.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1469117a8e37..e15ef42a5d4d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -535,13 +535,11 @@ static noinline void caching_thread(struct btrfs_work *work)
 	struct btrfs_block_group_cache *block_group;
 	struct btrfs_fs_info *fs_info;
 	struct btrfs_caching_control *caching_ctl;
-	struct btrfs_root *extent_root;
 	int ret;
 
 	caching_ctl = container_of(work, struct btrfs_caching_control, work);
 	block_group = caching_ctl->block_group;
 	fs_info = block_group->fs_info;
-	extent_root = fs_info->extent_root;
 
 	mutex_lock(&caching_ctl->mutex);
 	down_read(&fs_info->commit_root_sem);
-- 
2.7.4


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

* [PATCH 8/8] btrfs: Remove unused flush var in shrink_delalloc
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (6 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 7/8] btrfs: Remove unused extent_root var from caching_thread Nikolay Borisov
@ 2018-03-15 12:36 ` Nikolay Borisov
  2018-03-16 15:38 ` [PATCH 0/8] Make the code -Wunused clean David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: Nikolay Borisov @ 2018-03-15 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Added by 08e007d2e577 ("Btrfs: improve the noflush reservation") and
made redundant by 17024ad0a0fd ("Btrfs: fix early ENOSPC due to
delalloc")

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent-tree.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e15ef42a5d4d..bb1861033071 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4829,7 +4829,6 @@ static void shrink_delalloc(struct btrfs_fs_info *fs_info, u64 to_reclaim,
 	long time_left;
 	unsigned long nr_pages;
 	int loops;
-	enum btrfs_reserve_flush_enum flush;
 
 	/* Calc the number of the pages we need flush for space reservation */
 	items = calc_reclaim_items_nr(fs_info, to_reclaim);
@@ -4870,10 +4869,6 @@ static void shrink_delalloc(struct btrfs_fs_info *fs_info, u64 to_reclaim,
 			   atomic_read(&fs_info->async_delalloc_pages) <=
 			   (int)max_reclaim);
 skip_async:
-		if (!trans)
-			flush = BTRFS_RESERVE_FLUSH_ALL;
-		else
-			flush = BTRFS_RESERVE_NO_FLUSH;
 		spin_lock(&space_info->lock);
 		if (list_empty(&space_info->tickets) &&
 		    list_empty(&space_info->priority_tickets)) {
-- 
2.7.4


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

* Re: [PATCH 0/8] Make the code -Wunused clean
  2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
                   ` (7 preceding siblings ...)
  2018-03-15 12:36 ` [PATCH 8/8] btrfs: Remove unused flush var in shrink_delalloc Nikolay Borisov
@ 2018-03-16 15:38 ` David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2018-03-16 15:38 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Thu, Mar 15, 2018 at 02:36:21PM +0200, Nikolay Borisov wrote:
> This series eliminates all -Wunused warnings in the code base. 

Thanks, 1-8 applied.

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

end of thread, other threads:[~2018-03-16 15:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-15 12:36 [PATCH 0/8] Make the code -Wunused clean Nikolay Borisov
2018-03-15 12:36 ` [PATCH 1/8] btrfs: Remove unused op_key var from add_delayed_refs Nikolay Borisov
2018-03-15 12:36 ` [PATCH 2/8] btrfs: Remove unused length var from scrub_handle_errored_block Nikolay Borisov
2018-03-15 12:36 ` [PATCH 3/8] btrfs: Remove unused tot_len var from lzo_decompress Nikolay Borisov
2018-03-15 12:36 ` [PATCH 4/8] btrfs: Remove unused root var from relink_file_extents Nikolay Borisov
2018-03-15 12:36 ` [PATCH 5/8] btrfs: remove max_active var from open_ctree Nikolay Borisov
2018-03-15 12:36 ` [PATCH 6/8] btrfs: Remove unused parent_level var from btrfs_realloc_node Nikolay Borisov
2018-03-15 12:36 ` [PATCH 7/8] btrfs: Remove unused extent_root var from caching_thread Nikolay Borisov
2018-03-15 12:36 ` [PATCH 8/8] btrfs: Remove unused flush var in shrink_delalloc Nikolay Borisov
2018-03-16 15:38 ` [PATCH 0/8] Make the code -Wunused clean David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).