2023-09-12 21:26:51

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 3/5] bcachefs: Delete set but not used variables

As the variables are never read back they can be removed.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
fs/bcachefs/alloc_foreground.c | 3 ---
fs/bcachefs/backpointers.c | 3 ---
fs/bcachefs/btree_io.c | 3 +--
fs/bcachefs/btree_trans_commit.c | 4 ----
fs/bcachefs/compress.c | 4 ----
fs/bcachefs/data_update.c | 4 ----
6 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index e02749ddc362..c1c0f92da52e 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -775,7 +775,6 @@ static int bucket_alloc_from_stripe(struct btree_trans *trans,
struct dev_alloc_list devs_sorted;
struct ec_stripe_head *h;
struct open_bucket *ob;
- struct bch_dev *ca;
unsigned i, ec_idx;
int ret = 0;

@@ -805,8 +804,6 @@ static int bucket_alloc_from_stripe(struct btree_trans *trans,
}
goto out_put_head;
got_bucket:
- ca = bch_dev_bkey_exists(c, ob->dev);
-
ob->ec_idx = ec_idx;
ob->ec = h->s;
ec_stripe_new_get(h->s, STRIPE_REF_io);
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index 8747c5e19f99..a0457b75feb5 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -351,7 +351,6 @@ static int bch2_check_btree_backpointer(struct btree_trans *trans, struct btree_
{
struct bch_fs *c = trans->c;
struct btree_iter alloc_iter = { NULL };
- struct bch_dev *ca;
struct bkey_s_c alloc_k;
struct printbuf buf = PRINTBUF;
int ret = 0;
@@ -363,8 +362,6 @@ static int bch2_check_btree_backpointer(struct btree_trans *trans, struct btree_
goto out;
}

- ca = bch_dev_bkey_exists(c, k.k->p.inode);
-
alloc_k = bch2_bkey_get_iter(trans, &alloc_iter, BTREE_ID_alloc,
bp_pos_to_bucket(c, k.k->p), 0);
ret = bkey_err(alloc_k);
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 0edbb73a5ec8..8655a07456e6 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -908,7 +908,7 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
bool updated_range = b->key.k.type == KEY_TYPE_btree_ptr_v2 &&
BTREE_PTR_RANGE_UPDATED(&bkey_i_to_btree_ptr_v2(&b->key)->v);
unsigned u64s;
- unsigned blacklisted_written, nonblacklisted_written = 0;
+ unsigned nonblacklisted_written = 0;
unsigned ptr_written = btree_ptr_sectors_written(&b->key);
struct printbuf buf = PRINTBUF;
int ret = 0, retry_read = 0, write = READ;
@@ -1071,7 +1071,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
* important that we start writing new bsets after the most recent _non_
* blacklisted bset:
*/
- blacklisted_written = b->written;
b->written = nonblacklisted_written;
}

diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
index eafb0388ef82..b19a9400d477 100644
--- a/fs/bcachefs/btree_trans_commit.c
+++ b/fs/bcachefs/btree_trans_commit.c
@@ -555,7 +555,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
struct btree_write_buffered_key *wb;
struct btree_trans_commit_hook *h;
unsigned u64s = 0;
- bool marking = false;
int ret;

if (race_fault()) {
@@ -584,9 +583,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
*stopped_at = i;
return ret;
}
-
- if (btree_node_type_needs_gc(i->bkey_type))
- marking = true;
}

if (trans->nr_wb_updates &&
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index 6b17f7cc5860..4342995b0900 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -571,7 +571,6 @@ void bch2_fs_compress_exit(struct bch_fs *c)
static int __bch2_fs_compress_init(struct bch_fs *c, u64 features)
{
size_t decompress_workspace_size = 0;
- bool decompress_workspace_needed;
ZSTD_parameters params = zstd_get_params(zstd_max_clevel(),
c->opts.encoded_extent_max);
struct {
@@ -620,9 +619,6 @@ static int __bch2_fs_compress_init(struct bch_fs *c, u64 features)
if (!(features & (1 << i->feature)))
continue;

- if (i->decompress_workspace)
- decompress_workspace_needed = true;
-
if (mempool_initialized(&c->compress_workspace[i->type]))
continue;

diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c
index 81518f20d37d..09c757fdc448 100644
--- a/fs/bcachefs/data_update.c
+++ b/fs/bcachefs/data_update.c
@@ -49,10 +49,6 @@ static void trace_move_extent_fail2(struct data_update *m,
if (insert) {
i = 0;
bkey_for_each_ptr_decode(old.k, bch2_bkey_ptrs_c(old), p, entry) {
- struct bkey_s new_s;
- new_s.k = (void *) new.k;
- new_s.v = (void *) new.v;
-
if (((1U << i) & m->data_opts.rewrite_ptrs) &&
(ptr = bch2_extent_has_ptr(old, p, bkey_i_to_s(insert))) &&
!ptr->cached)

--
2.42.0