Commit 96dea3d5 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Fix W=12 build errors

parent b5e85d4d
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -1200,15 +1200,15 @@ int bch2_check_alloc_hole_bucket_gens(struct btree_trans *trans,
		}

		if (need_update) {
			struct bkey_i *k = bch2_trans_kmalloc(trans, sizeof(g));
			struct bkey_i *u = bch2_trans_kmalloc(trans, sizeof(g));

			ret = PTR_ERR_OR_ZERO(k);
			ret = PTR_ERR_OR_ZERO(u);
			if (ret)
				goto err;

			memcpy(k, &g, sizeof(g));
			memcpy(u, &g, sizeof(g));

			ret = bch2_trans_update(trans, bucket_gens_iter, k, 0);
			ret = bch2_trans_update(trans, bucket_gens_iter, u, 0);
			if (ret)
				goto err;
		}
@@ -1354,15 +1354,14 @@ int bch2_check_bucket_gens_key(struct btree_trans *trans,
		}

	if (need_update) {
		struct bkey_i *k;
		struct bkey_i *u = bch2_trans_kmalloc(trans, sizeof(g));

		k = bch2_trans_kmalloc(trans, sizeof(g));
		ret = PTR_ERR_OR_ZERO(k);
		ret = PTR_ERR_OR_ZERO(u);
		if (ret)
			goto out;

		memcpy(k, &g, sizeof(g));
		ret = bch2_trans_update(trans, iter, k, 0);
		memcpy(u, &g, sizeof(g));
		ret = bch2_trans_update(trans, iter, u, 0);
	}
out:
fsck_err:
+10 −5
Original line number Diff line number Diff line
@@ -502,9 +502,14 @@ static struct open_bucket *bch2_bucket_alloc_freelist(struct btree_trans *trans,
}

/**
 * bch_bucket_alloc - allocate a single bucket from a specific device
 * bch2_bucket_alloc_trans - allocate a single bucket from a specific device
 * @trans:	transaction object
 * @ca:		device to allocate from
 * @watermark:	how important is this allocation?
 * @cl:		if not NULL, closure to be used to wait if buckets not available
 * @usage:	for secondarily also returning the current device usage
 *
 * Returns index of bucket on success, 0 on failure
 * Returns:	an open_bucket on success, or an ERR_PTR() on failure.
 */
static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
				      struct bch_dev *ca,
@@ -775,7 +780,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 +809,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);
@@ -1032,10 +1034,13 @@ static int open_bucket_add_buckets(struct btree_trans *trans,

/**
 * should_drop_bucket - check if this is open_bucket should go away
 * @ob:		open_bucket to predicate on
 * @c:		filesystem handle
 * @ca:		if set, we're killing buckets for a particular device
 * @ec:		if true, we're shutting down erasure coding and killing all ec
 *		open_buckets
 *		otherwise, return true
 * Returns: true if we should kill this open_bucket
 *
 * We're killing open_buckets because we're shutting down a device, erasure
 * coding, or the entire filesystem - check if this open_bucket matches:
+1 −4
Original line number Diff line number Diff line
@@ -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);
@@ -629,7 +626,7 @@ static int bch2_check_extents_to_backpointers_pass(struct btree_trans *trans,
	struct bch_fs *c = trans->c;
	struct btree_iter iter;
	enum btree_id btree_id;
	struct bpos_level last_flushed = { UINT_MAX };
	struct bpos_level last_flushed = { UINT_MAX, POS_MIN };
	int ret = 0;

	for (btree_id = 0; btree_id < btree_id_nr_alive(c); btree_id++) {
+1 −1
Original line number Diff line number Diff line
@@ -371,7 +371,7 @@ BCH_DEBUG_PARAMS()
#undef BCH_DEBUG_PARAM

#ifndef CONFIG_BCACHEFS_DEBUG
#define BCH_DEBUG_PARAM(name, description) static const bool bch2_##name;
#define BCH_DEBUG_PARAM(name, description) static const __maybe_unused bool bch2_##name;
BCH_DEBUG_PARAMS_DEBUG()
#undef BCH_DEBUG_PARAM
#endif
+8 −7
Original line number Diff line number Diff line
@@ -83,8 +83,8 @@ typedef uuid_t __uuid_t;
#endif

#define BITMASK(name, type, field, offset, end)				\
static const unsigned	name##_OFFSET = offset;				\
static const unsigned	name##_BITS = (end - offset);			\
static const __maybe_unused unsigned	name##_OFFSET = offset;		\
static const __maybe_unused unsigned	name##_BITS = (end - offset);	\
									\
static inline __u64 name(const type *k)					\
{									\
@@ -98,9 +98,9 @@ static inline void SET_##name(type *k, __u64 v) \
}

#define LE_BITMASK(_bits, name, type, field, offset, end)		\
static const unsigned	name##_OFFSET = offset;				\
static const unsigned	name##_BITS = (end - offset);			\
static const __u##_bits	name##_MAX = (1ULL << (end - offset)) - 1;	\
static const __maybe_unused unsigned	name##_OFFSET = offset;		\
static const __maybe_unused unsigned	name##_BITS = (end - offset);	\
static const __maybe_unused __u##_bits	name##_MAX = (1ULL << (end - offset)) - 1;\
									\
static inline __u64 name(const type *k)					\
{									\
@@ -1668,7 +1668,8 @@ enum bcachefs_metadata_version {
	bcachefs_metadata_version_max
};

static const unsigned bcachefs_metadata_required_upgrade_below = bcachefs_metadata_version_major_minor;
static const __maybe_unused
unsigned bcachefs_metadata_required_upgrade_below = bcachefs_metadata_version_major_minor;

#define bcachefs_metadata_version_current	(bcachefs_metadata_version_max - 1)

@@ -1975,7 +1976,7 @@ enum bch_csum_type {
	BCH_CSUM_NR
};

static const unsigned bch_crc_bytes[] = {
static const __maybe_unused unsigned bch_crc_bytes[] = {
	[BCH_CSUM_none]				= 0,
	[BCH_CSUM_crc32c_nonzero]		= 4,
	[BCH_CSUM_crc32c]			= 4,
Loading