All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] dm vdo: fix sparse warnings
@ 2024-02-06  2:04 Matthew Sakai
  2024-02-06  2:04 ` [PATCH 1/7] dm vdo: fix sparse warnings about missing statics Matthew Sakai
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Matthew Sakai

Fix warnings from sparse.

Mike Snitzer (6):
  dm vdo: fix sparse warnings about missing statics
  dm vdo: fix sparse 'warning: Using plain integer as NULL pointer'
  dm vdo: fix various blk_opf_t sparse warnings
  dm vdo data-vio: silence sparse warnings about locking context
    imbalances
  dm vdo dedupe: silence sparse warnings about locking context
    imbalances
  dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning

Susan LeGendre-McGhee (1):
  dm vdo: move encoding constants to encodings.h

 drivers/md/dm-vdo/Makefile           |  1 -
 drivers/md/dm-vdo/block-map.c        |  4 +--
 drivers/md/dm-vdo/constants.c        | 15 -----------
 drivers/md/dm-vdo/constants.h        | 12 +++------
 drivers/md/dm-vdo/data-vio.c         | 39 ++++++++++++++++------------
 drivers/md/dm-vdo/dedupe.c           |  2 ++
 drivers/md/dm-vdo/encodings.c        |  2 +-
 drivers/md/dm-vdo/encodings.h        |  6 +++++
 drivers/md/dm-vdo/index.c            |  8 +++---
 drivers/md/dm-vdo/io-submitter.c     |  2 +-
 drivers/md/dm-vdo/io-submitter.h     |  4 +--
 drivers/md/dm-vdo/recovery-journal.c |  4 +--
 drivers/md/dm-vdo/vdo.c              |  3 ++-
 drivers/md/dm-vdo/vio.c              |  4 +--
 drivers/md/dm-vdo/vio.h              |  4 +--
 15 files changed, 52 insertions(+), 58 deletions(-)
 delete mode 100644 drivers/md/dm-vdo/constants.c

-- 
2.42.0


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

* [PATCH 1/7] dm vdo: fix sparse warnings about missing statics
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 2/7] dm vdo: fix sparse 'warning: Using plain integer as NULL pointer' Matthew Sakai
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Addresses various sparse warnings like:
warning: symbol 'SYMBOL' was not declared. Should it be static?

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/Makefile    |  1 -
 drivers/md/dm-vdo/block-map.c |  2 +-
 drivers/md/dm-vdo/constants.c | 15 ---------------
 drivers/md/dm-vdo/constants.h |  6 +++---
 drivers/md/dm-vdo/encodings.c |  2 +-
 5 files changed, 5 insertions(+), 21 deletions(-)
 delete mode 100644 drivers/md/dm-vdo/constants.c

diff --git a/drivers/md/dm-vdo/Makefile b/drivers/md/dm-vdo/Makefile
index 8f8d161a6dbe..8c06c3b969e3 100644
--- a/drivers/md/dm-vdo/Makefile
+++ b/drivers/md/dm-vdo/Makefile
@@ -9,7 +9,6 @@ dm-vdo-objs := \
 	chapter-index.o \
 	completion.o \
 	config.o \
-	constants.o \
 	data-vio.o \
 	dedupe.o \
 	delta-index.o \
diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c
index 54ad6939cab7..1278a5791160 100644
--- a/drivers/md/dm-vdo/block-map.c
+++ b/drivers/md/dm-vdo/block-map.c
@@ -67,7 +67,7 @@ struct block_map_tree_segment {
 
 struct block_map_tree {
 	struct block_map_tree_segment *segments;
-} block_map_tree;
+};
 
 struct forest {
 	struct block_map *map;
diff --git a/drivers/md/dm-vdo/constants.c b/drivers/md/dm-vdo/constants.c
deleted file mode 100644
index 14ac047101f8..000000000000
--- a/drivers/md/dm-vdo/constants.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright 2023 Red Hat
- */
-
-#include "types.h"
-
-/* The maximum logical space is 4 petabytes, which is 1 terablock. */
-const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024;
-
-/* The maximum physical space is 256 terabytes, which is 64 gigablocks. */
-const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64;
-
-/* unit test minimum */
-const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2;
diff --git a/drivers/md/dm-vdo/constants.h b/drivers/md/dm-vdo/constants.h
index 9ae3917d00de..3a997dd7d0b1 100644
--- a/drivers/md/dm-vdo/constants.h
+++ b/drivers/md/dm-vdo/constants.h
@@ -91,12 +91,12 @@ enum {
 };
 
 /** The maximum logical space is 4 petabytes, which is 1 terablock. */
-extern const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS;
+static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024;
 
 /** The maximum physical space is 256 terabytes, which is 64 gigablocks. */
-extern const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS;
+static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64;
 
 /** unit test minimum */
-extern const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS;
+static const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2;
 
 #endif /* VDO_CONSTANTS_H */
diff --git a/drivers/md/dm-vdo/encodings.c b/drivers/md/dm-vdo/encodings.c
index 2d9d8645f66b..6b3e9a5b3a91 100644
--- a/drivers/md/dm-vdo/encodings.c
+++ b/drivers/md/dm-vdo/encodings.c
@@ -85,7 +85,7 @@ const struct header VDO_SLAB_DEPOT_HEADER_2_0 = {
 	.size = sizeof(struct slab_depot_state_2_0),
 };
 
-const struct header VDO_LAYOUT_HEADER_3_0 = {
+static const struct header VDO_LAYOUT_HEADER_3_0 = {
 	.id = VDO_LAYOUT,
 	.version = {
 		.major_version = 3,
-- 
2.42.0


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

* [PATCH 2/7] dm vdo: fix sparse 'warning: Using plain integer as NULL pointer'
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
  2024-02-06  2:04 ` [PATCH 1/7] dm vdo: fix sparse warnings about missing statics Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 3/7] dm vdo: fix various blk_opf_t sparse warnings Matthew Sakai
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/index.c | 8 ++++----
 drivers/md/dm-vdo/vdo.c   | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-vdo/index.c b/drivers/md/dm-vdo/index.c
index e343a973881d..1596f6ba43a5 100644
--- a/drivers/md/dm-vdo/index.c
+++ b/drivers/md/dm-vdo/index.c
@@ -732,18 +732,18 @@ static void close_chapters(void *arg)
 
 static void stop_chapter_writer(struct chapter_writer *writer)
 {
-	struct thread *writer_thread = 0;
+	struct thread *writer_thread = NULL;
 
 	uds_lock_mutex(&writer->mutex);
-	if (writer->thread != 0) {
+	if (writer->thread != NULL) {
 		writer_thread = writer->thread;
-		writer->thread = 0;
+		writer->thread = NULL;
 		writer->stop = true;
 		uds_broadcast_cond(&writer->cond);
 	}
 	uds_unlock_mutex(&writer->mutex);
 
-	if (writer_thread != 0)
+	if (writer_thread != NULL)
 		uds_join_threads(writer_thread);
 }
 
diff --git a/drivers/md/dm-vdo/vdo.c b/drivers/md/dm-vdo/vdo.c
index 1ead769f0150..e0eddd4007b8 100644
--- a/drivers/md/dm-vdo/vdo.c
+++ b/drivers/md/dm-vdo/vdo.c
@@ -889,7 +889,8 @@ int vdo_synchronous_flush(struct vdo *vdo)
 	int result;
 	struct bio bio;
 
-	bio_init(&bio, vdo_get_backing_device(vdo), 0, 0, REQ_OP_WRITE | REQ_PREFLUSH);
+	bio_init(&bio, vdo_get_backing_device(vdo), NULL, 0,
+		 REQ_OP_WRITE | REQ_PREFLUSH);
 	submit_bio_wait(&bio);
 	result = blk_status_to_errno(bio.bi_status);
 
-- 
2.42.0


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

* [PATCH 3/7] dm vdo: fix various blk_opf_t sparse warnings
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
  2024-02-06  2:04 ` [PATCH 1/7] dm vdo: fix sparse warnings about missing statics Matthew Sakai
  2024-02-06  2:04 ` [PATCH 2/7] dm vdo: fix sparse 'warning: Using plain integer as NULL pointer' Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 4/7] dm vdo data-vio: silence sparse warnings about locking context imbalances Matthew Sakai
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Use proper blk_opf_t type rather than unsigned int.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/block-map.c    | 2 +-
 drivers/md/dm-vdo/data-vio.c     | 4 ++--
 drivers/md/dm-vdo/io-submitter.c | 2 +-
 drivers/md/dm-vdo/io-submitter.h | 4 ++--
 drivers/md/dm-vdo/vio.c          | 4 ++--
 drivers/md/dm-vdo/vio.h          | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c
index 1278a5791160..cc87e1ac72b6 100644
--- a/drivers/md/dm-vdo/block-map.c
+++ b/drivers/md/dm-vdo/block-map.c
@@ -1620,7 +1620,7 @@ static void write_initialized_page(struct vdo_completion *completion)
 	struct block_map_zone *zone = pooled->context;
 	struct tree_page *tree_page = completion->parent;
 	struct block_map_page *page = (struct block_map_page *) vio->data;
-	unsigned int operation = REQ_OP_WRITE | REQ_PRIO;
+	blk_opf_t operation = REQ_OP_WRITE | REQ_PRIO;
 
 	/*
 	 * Now that we know the page has been written at least once, mark the copy we are writing
diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c
index 328b645dee16..e0f1574ae112 100644
--- a/drivers/md/dm-vdo/data-vio.c
+++ b/drivers/md/dm-vdo/data-vio.c
@@ -69,7 +69,7 @@
  *   ASAP to service heavy load, which is the only place where REQ_BACKGROUND might aid in load
  *   prioritization.
  */
-static unsigned int PASSTHROUGH_FLAGS = (REQ_PRIO | REQ_META | REQ_SYNC | REQ_RAHEAD);
+static blk_opf_t PASSTHROUGH_FLAGS = (REQ_PRIO | REQ_META | REQ_SYNC | REQ_RAHEAD);
 
 /**
  * DOC:
@@ -1570,7 +1570,7 @@ static void read_block(struct vdo_completion *completion)
 		result = vio_reset_bio(vio, (char *) data_vio->compression.block,
 				       read_endio, REQ_OP_READ, data_vio->mapped.pbn);
 	} else {
-		int opf = ((data_vio->user_bio->bi_opf & PASSTHROUGH_FLAGS) | REQ_OP_READ);
+		blk_opf_t opf = ((data_vio->user_bio->bi_opf & PASSTHROUGH_FLAGS) | REQ_OP_READ);
 
 		if (data_vio->is_partial) {
 			result = vio_reset_bio(vio, vio->data, read_endio, opf,
diff --git a/drivers/md/dm-vdo/io-submitter.c b/drivers/md/dm-vdo/io-submitter.c
index 74f33a3ddce5..6c050f2b3b44 100644
--- a/drivers/md/dm-vdo/io-submitter.c
+++ b/drivers/md/dm-vdo/io-submitter.c
@@ -338,7 +338,7 @@ void vdo_submit_data_vio(struct data_vio *data_vio)
  */
 void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
 			   bio_end_io_t callback, vdo_action_fn error_handler,
-			   unsigned int operation, char *data)
+			   blk_opf_t operation, char *data)
 {
 	int result;
 	struct vdo_completion *completion = &vio->completion;
diff --git a/drivers/md/dm-vdo/io-submitter.h b/drivers/md/dm-vdo/io-submitter.h
index ddd5f4b391b6..80748699496f 100644
--- a/drivers/md/dm-vdo/io-submitter.h
+++ b/drivers/md/dm-vdo/io-submitter.h
@@ -26,11 +26,11 @@ void vdo_submit_data_vio(struct data_vio *data_vio);
 
 void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
 			   bio_end_io_t callback, vdo_action_fn error_handler,
-			   unsigned int operation, char *data);
+			   blk_opf_t operation, char *data);
 
 static inline void vdo_submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
 					   bio_end_io_t callback, vdo_action_fn error_handler,
-					   unsigned int operation)
+					   blk_opf_t operation)
 {
 	__submit_metadata_vio(vio, physical, callback, error_handler,
 			      operation, vio->data);
diff --git a/drivers/md/dm-vdo/vio.c b/drivers/md/dm-vdo/vio.c
index 6acaba149c75..f9c54ec56176 100644
--- a/drivers/md/dm-vdo/vio.c
+++ b/drivers/md/dm-vdo/vio.c
@@ -172,7 +172,7 @@ void free_vio(struct vio *vio)
 
 /* Set bio properties for a VDO read or write. */
 void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callback,
-			    unsigned int bi_opf, physical_block_number_t pbn)
+			    blk_opf_t bi_opf, physical_block_number_t pbn)
 {
 	struct vdo *vdo = vio->completion.vdo;
 	struct device_config *config = vdo->device_config;
@@ -193,7 +193,7 @@ void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callb
  * vio associated with the bio.
  */
 int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback,
-		  unsigned int bi_opf, physical_block_number_t pbn)
+		  blk_opf_t bi_opf, physical_block_number_t pbn)
 {
 	int bvec_count, offset, len, i;
 	struct bio *bio = vio->bio;
diff --git a/drivers/md/dm-vdo/vio.h b/drivers/md/dm-vdo/vio.h
index 71585424f85b..fbfee5e3415d 100644
--- a/drivers/md/dm-vdo/vio.h
+++ b/drivers/md/dm-vdo/vio.h
@@ -119,10 +119,10 @@ static inline void initialize_vio(struct vio *vio, struct bio *bio,
 }
 
 void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callback,
-			    unsigned int bi_opf, physical_block_number_t pbn);
+			    blk_opf_t bi_opf, physical_block_number_t pbn);
 
 int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback,
-		  unsigned int bi_opf, physical_block_number_t pbn);
+		  blk_opf_t bi_opf, physical_block_number_t pbn);
 
 void update_vio_error_stats(struct vio *vio, const char *format, ...)
 	__printf(2, 3);
-- 
2.42.0


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

* [PATCH 4/7] dm vdo data-vio: silence sparse warnings about locking context imbalances
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
                   ` (2 preceding siblings ...)
  2024-02-06  2:04 ` [PATCH 3/7] dm vdo: fix various blk_opf_t sparse warnings Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 5/7] dm vdo dedupe: " Matthew Sakai
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Factor wait_permit() out from acquire_permit() so that the latter
always holds the spinlock and the former always releases it.

Otherwise sparse complains about locking context imbalances due to
conditional spin_unlock in acquire_permit:
 warning: context imbalance in 'acquire_permit' - different lock contexts for basic block
 warning: context imbalance in 'vdo_launch_bio' - unexpected unlock

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/data-vio.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c
index e0f1574ae112..d77adeb5006e 100644
--- a/drivers/md/dm-vdo/data-vio.c
+++ b/drivers/md/dm-vdo/data-vio.c
@@ -929,27 +929,30 @@ void free_data_vio_pool(struct data_vio_pool *pool)
 	uds_free(pool);
 }
 
-static bool acquire_permit(struct limiter *limiter, struct bio *bio)
+static bool acquire_permit(struct limiter *limiter)
 {
-	if (limiter->busy >= limiter->limit) {
-		DEFINE_WAIT(wait);
-
-		bio_list_add(&limiter->new_waiters, bio);
-		prepare_to_wait_exclusive(&limiter->blocked_threads, &wait,
-					  TASK_UNINTERRUPTIBLE);
-		spin_unlock(&limiter->pool->lock);
-		io_schedule();
-		finish_wait(&limiter->blocked_threads, &wait);
+	if (limiter->busy >= limiter->limit)
 		return false;
-	}
 
 	WRITE_ONCE(limiter->busy, limiter->busy + 1);
 	if (limiter->max_busy < limiter->busy)
 		WRITE_ONCE(limiter->max_busy, limiter->busy);
-
 	return true;
 }
 
+static void wait_permit(struct limiter *limiter, struct bio *bio)
+	__releases(&limiter->pool->lock)
+{
+	DEFINE_WAIT(wait);
+
+	bio_list_add(&limiter->new_waiters, bio);
+	prepare_to_wait_exclusive(&limiter->blocked_threads, &wait,
+				  TASK_UNINTERRUPTIBLE);
+	spin_unlock(&limiter->pool->lock);
+	io_schedule();
+	finish_wait(&limiter->blocked_threads, &wait);
+}
+
 /**
  * vdo_launch_bio() - Acquire a data_vio from the pool, assign the bio to it, and launch it.
  *
@@ -965,11 +968,15 @@ void vdo_launch_bio(struct data_vio_pool *pool, struct bio *bio)
 	bio->bi_private = (void *) jiffies;
 	spin_lock(&pool->lock);
 	if ((bio_op(bio) == REQ_OP_DISCARD) &&
-	    !acquire_permit(&pool->discard_limiter, bio))
+	    !acquire_permit(&pool->discard_limiter)) {
+		wait_permit(&pool->discard_limiter, bio);
 		return;
+	}
 
-	if (!acquire_permit(&pool->limiter, bio))
+	if (!acquire_permit(&pool->limiter)) {
+		wait_permit(&pool->limiter, bio);
 		return;
+	}
 
 	data_vio = get_available_data_vio(pool);
 	spin_unlock(&pool->lock);
-- 
2.42.0


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

* [PATCH 5/7] dm vdo dedupe: silence sparse warnings about locking context imbalances
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
                   ` (3 preceding siblings ...)
  2024-02-06  2:04 ` [PATCH 4/7] dm vdo data-vio: silence sparse warnings about locking context imbalances Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 6/7] dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning Matthew Sakai
  2024-02-06  2:04 ` [PATCH 7/7] dm vdo: move encoding constants to encodings.h Matthew Sakai
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Annotate both open_index() and close_index() with
__must_hold(&zones->lock) to silence these sparse warnings:
 warning: context imbalance in 'close_index' - unexpected unlock
 warning: context imbalance in 'open_index' - unexpected unlock

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/dedupe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c
index 8533f1669a01..4b00135511dd 100644
--- a/drivers/md/dm-vdo/dedupe.c
+++ b/drivers/md/dm-vdo/dedupe.c
@@ -2092,6 +2092,7 @@ static void finish_uds_queue(void *ptr __always_unused)
 }
 
 static void close_index(struct hash_zones *zones)
+	__must_hold(&zones->lock)
 {
 	int result;
 
@@ -2113,6 +2114,7 @@ static void close_index(struct hash_zones *zones)
 }
 
 static void open_index(struct hash_zones *zones)
+	__must_hold(&zones->lock)
 {
 	/* ASSERTION: We enter in IS_CLOSED state. */
 	int result;
-- 
2.42.0


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

* [PATCH 6/7] dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
                   ` (4 preceding siblings ...)
  2024-02-06  2:04 ` [PATCH 5/7] dm vdo dedupe: " Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  2024-02-06  2:04 ` [PATCH 7/7] dm vdo: move encoding constants to encodings.h Matthew Sakai
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai

From: Mike Snitzer <snitzer@kernel.org>

Only one user of WRITE_FLAGS so no need to factor it out in an enum
(which causes sparse's 'mixed bitwiseness' warning).  Just use the
flags in the only consumer.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/recovery-journal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-vdo/recovery-journal.c b/drivers/md/dm-vdo/recovery-journal.c
index a6981e5dd017..1e15bfe42cfc 100644
--- a/drivers/md/dm-vdo/recovery-journal.c
+++ b/drivers/md/dm-vdo/recovery-journal.c
@@ -34,7 +34,6 @@ enum {
 	 */
 	RECOVERY_JOURNAL_RESERVED_BLOCKS =
 		(MAXIMUM_VDO_USER_VIOS / RECOVERY_JOURNAL_ENTRIES_PER_BLOCK) + 2,
-	WRITE_FLAGS = REQ_OP_WRITE | REQ_PRIO | REQ_PREFLUSH | REQ_SYNC | REQ_FUA,
 };
 
 /**
@@ -1398,7 +1397,8 @@ static void write_block(struct vdo_waiter *waiter, void *context __always_unused
 	 * block itself is stable before allowing overwrites of the lbn's previous data.
 	 */
 	vdo_submit_metadata_vio(&block->vio, journal->origin + block->block_number,
-				complete_write_endio, handle_write_error, WRITE_FLAGS);
+				complete_write_endio, handle_write_error,
+				REQ_OP_WRITE | REQ_PRIO | REQ_PREFLUSH | REQ_SYNC | REQ_FUA);
 }
 
 
-- 
2.42.0


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

* [PATCH 7/7] dm vdo: move encoding constants to encodings.h
  2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
                   ` (5 preceding siblings ...)
  2024-02-06  2:04 ` [PATCH 6/7] dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning Matthew Sakai
@ 2024-02-06  2:04 ` Matthew Sakai
  6 siblings, 0 replies; 8+ messages in thread
From: Matthew Sakai @ 2024-02-06  2:04 UTC (permalink / raw)
  To: dm-devel; +Cc: Susan LeGendre-McGhee, Matthew Sakai

From: Susan LeGendre-McGhee <slegendr@redhat.com>

Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/constants.h | 12 +++---------
 drivers/md/dm-vdo/encodings.h |  6 ++++++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/md/dm-vdo/constants.h b/drivers/md/dm-vdo/constants.h
index 3a997dd7d0b1..24237bc29f87 100644
--- a/drivers/md/dm-vdo/constants.h
+++ b/drivers/md/dm-vdo/constants.h
@@ -44,6 +44,9 @@ enum {
 	/** The default size of each slab journal, in blocks */
 	DEFAULT_VDO_SLAB_JOURNAL_SIZE = 224,
 
+	/** Unit test minimum */
+	MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2,
+
 	/*
 	 * The initial size of lbn_operations and pbn_operations, which is based upon the expected
 	 * maximum number of outstanding VIOs. This value was chosen to make it highly unlikely
@@ -90,13 +93,4 @@ enum {
 	VDO_ZERO_BLOCK = 0,
 };
 
-/** The maximum logical space is 4 petabytes, which is 1 terablock. */
-static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024;
-
-/** The maximum physical space is 256 terabytes, which is 64 gigablocks. */
-static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64;
-
-/** unit test minimum */
-static const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2;
-
 #endif /* VDO_CONSTANTS_H */
diff --git a/drivers/md/dm-vdo/encodings.h b/drivers/md/dm-vdo/encodings.h
index 260822a3958a..bfc397a72f9f 100644
--- a/drivers/md/dm-vdo/encodings.h
+++ b/drivers/md/dm-vdo/encodings.h
@@ -609,6 +609,12 @@ struct vdo_config {
 	block_count_t slab_journal_blocks; /* number of slab journal blocks */
 };
 
+/** The maximum logical space is 4 petabytes, which is 1 terablock. */
+static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024;
+
+/** The maximum physical space is 256 terabytes, which is 64 gigablocks. */
+static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64;
+
 /* This is the structure that captures the vdo fields saved as a super block component. */
 struct vdo_component {
 	enum vdo_state state;
-- 
2.42.0


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

end of thread, other threads:[~2024-02-06  2:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06  2:04 [PATCH 0/7] dm vdo: fix sparse warnings Matthew Sakai
2024-02-06  2:04 ` [PATCH 1/7] dm vdo: fix sparse warnings about missing statics Matthew Sakai
2024-02-06  2:04 ` [PATCH 2/7] dm vdo: fix sparse 'warning: Using plain integer as NULL pointer' Matthew Sakai
2024-02-06  2:04 ` [PATCH 3/7] dm vdo: fix various blk_opf_t sparse warnings Matthew Sakai
2024-02-06  2:04 ` [PATCH 4/7] dm vdo data-vio: silence sparse warnings about locking context imbalances Matthew Sakai
2024-02-06  2:04 ` [PATCH 5/7] dm vdo dedupe: " Matthew Sakai
2024-02-06  2:04 ` [PATCH 6/7] dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning Matthew Sakai
2024-02-06  2:04 ` [PATCH 7/7] dm vdo: move encoding constants to encodings.h Matthew Sakai

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.