* [PATCH 1/3] dm vdo slab-depot: fix various small nits
2024-01-27 3:01 [PATCH 0/3] dm vdo: fix various formatting nits Matthew Sakai
@ 2024-01-27 3:01 ` Matthew Sakai
2024-01-27 3:01 ` [PATCH 2/3] dm vdo dedupe: " Matthew Sakai
2024-01-27 3:01 ` [PATCH 3/3] dm vdo index: " Matthew Sakai
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Sakai @ 2024-01-27 3:01 UTC (permalink / raw)
To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai
From: Mike Snitzer <snitzer@kernel.org>
Comment typo, whitespace issues, mark function inline.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Chung Chung <cchung@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
drivers/md/dm-vdo/slab-depot.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-vdo/slab-depot.c b/drivers/md/dm-vdo/slab-depot.c
index 56d975c98752..42126bd60242 100644
--- a/drivers/md/dm-vdo/slab-depot.c
+++ b/drivers/md/dm-vdo/slab-depot.c
@@ -1360,7 +1360,7 @@ static unsigned int calculate_slab_priority(struct vdo_slab *slab)
/*
* Slabs are essentially prioritized by an approximation of the number of free blocks in the slab
- * so slabs with lots of free blocks with be opened for allocation before slabs that have few free
+ * so slabs with lots of free blocks will be opened for allocation before slabs that have few free
* blocks.
*/
static void prioritize_slab(struct vdo_slab *slab)
@@ -1374,14 +1374,14 @@ static void prioritize_slab(struct vdo_slab *slab)
/**
* adjust_free_block_count() - Adjust the free block count and (if needed) reprioritize the slab.
- * @increment: should be true if the free block count went up.
+ * @incremented: true if the free block count went up.
*/
-static void adjust_free_block_count(struct vdo_slab *slab, bool increment)
+static void adjust_free_block_count(struct vdo_slab *slab, bool incremented)
{
struct block_allocator *allocator = slab->allocator;
WRITE_ONCE(allocator->allocated_blocks,
- allocator->allocated_blocks + (increment ? -1 : 1));
+ allocator->allocated_blocks + (incremented ? -1 : 1));
/* The open slab doesn't need to be reprioritized until it is closed. */
if (slab == allocator->open_slab)
@@ -1747,9 +1747,8 @@ static void add_entry_from_waiter(struct vdo_waiter *waiter, void *context)
static inline bool is_next_entry_a_block_map_increment(struct slab_journal *journal)
{
struct vdo_waiter *waiter = vdo_waitq_get_first_waiter(&journal->entry_waiters);
- struct reference_updater *updater = container_of(waiter,
- struct reference_updater,
- waiter);
+ struct reference_updater *updater =
+ container_of(waiter, struct reference_updater, waiter);
return (updater->operation == VDO_JOURNAL_BLOCK_MAP_REMAPPING);
}
@@ -2642,7 +2641,7 @@ static struct vdo_slab *get_next_slab(struct slab_scrubber *scrubber)
*
* Return: true if the scrubber has slabs to scrub.
*/
-static bool __must_check has_slabs_to_scrub(struct slab_scrubber *scrubber)
+static inline bool __must_check has_slabs_to_scrub(struct slab_scrubber *scrubber)
{
return (get_next_slab(scrubber) != NULL);
}
@@ -2817,8 +2816,8 @@ static int apply_block_entries(struct packed_slab_journal_block *block,
static void apply_journal_entries(struct vdo_completion *completion)
{
int result;
- struct slab_scrubber *scrubber
- = container_of(as_vio(completion), struct slab_scrubber, vio);
+ struct slab_scrubber *scrubber =
+ container_of(as_vio(completion), struct slab_scrubber, vio);
struct vdo_slab *slab = scrubber->slab;
struct slab_journal *journal = &slab->journal;
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] dm vdo dedupe: fix various small nits
2024-01-27 3:01 [PATCH 0/3] dm vdo: fix various formatting nits Matthew Sakai
2024-01-27 3:01 ` [PATCH 1/3] dm vdo slab-depot: fix various small nits Matthew Sakai
@ 2024-01-27 3:01 ` Matthew Sakai
2024-01-27 3:01 ` [PATCH 3/3] dm vdo index: " Matthew Sakai
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Sakai @ 2024-01-27 3:01 UTC (permalink / raw)
To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai
From: Mike Snitzer <snitzer@kernel.org>
Remove extra blank line, mark function inline, add missing
braces, and fix a typo in a comment.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Chung Chung <cchung@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
drivers/md/dm-vdo/dedupe.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c
index b3ffb85518c3..8533f1669a01 100644
--- a/drivers/md/dm-vdo/dedupe.c
+++ b/drivers/md/dm-vdo/dedupe.c
@@ -1061,7 +1061,7 @@ static void start_deduping(struct hash_lock *lock, struct data_vio *agent,
* increment_stat() - Increment a statistic counter in a non-atomic yet thread-safe manner.
* @stat: The statistic field to increment.
*/
-static void increment_stat(u64 *stat)
+static inline void increment_stat(u64 *stat)
{
/*
* Must only be mutated on the hash zone thread. Prevents any compiler shenanigans from
@@ -1130,7 +1130,6 @@ static bool blocks_equal(char *block1, char *block2)
{
int i;
-
for (i = 0; i < VDO_BLOCK_SIZE; i += sizeof(u64)) {
if (*((u64 *) &block1[i]) != *((u64 *) &block2[i]))
return false;
@@ -1456,13 +1455,13 @@ static void finish_writing(struct hash_lock *lock, struct data_vio *agent)
lock->duplicate = agent->new_mapped;
lock->verified = true;
- if (vdo_is_state_compressed(lock->duplicate.state) &&
- lock->registered)
+ if (vdo_is_state_compressed(lock->duplicate.state) && lock->registered) {
/*
* Compression means the location we gave in the UDS query is not the location
* we're using to deduplicate.
*/
lock->update_advice = true;
+ }
/* If there are any waiters, we need to start deduping them. */
if (vdo_waitq_has_waiters(&lock->waiters)) {
@@ -2366,7 +2365,7 @@ static void timeout_index_operations_callback(struct vdo_completion *completion)
DEDUPE_CONTEXT_TIMED_OUT)) {
/*
* This context completed between the time the timeout fired, and now. We
- * can treat it as a a successful query, its requestor is already enqueued
+ * can treat it as a successful query, its requestor is already enqueued
* to process it.
*/
continue;
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] dm vdo index: fix various small nits
2024-01-27 3:01 [PATCH 0/3] dm vdo: fix various formatting nits Matthew Sakai
2024-01-27 3:01 ` [PATCH 1/3] dm vdo slab-depot: fix various small nits Matthew Sakai
2024-01-27 3:01 ` [PATCH 2/3] dm vdo dedupe: " Matthew Sakai
@ 2024-01-27 3:01 ` Matthew Sakai
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Sakai @ 2024-01-27 3:01 UTC (permalink / raw)
To: dm-devel; +Cc: Mike Snitzer, Matthew Sakai
From: Mike Snitzer <snitzer@kernel.org>
Add braces around multi-line while loops and if statements. Also
remove excess newlines.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Chung Chung <cchung@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
drivers/md/dm-vdo/index-layout.c | 10 +++++-----
drivers/md/dm-vdo/index-page-map.c | 3 +--
drivers/md/dm-vdo/index-session.c | 12 ++++++++----
drivers/md/dm-vdo/index.c | 3 +--
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/md/dm-vdo/index-layout.c b/drivers/md/dm-vdo/index-layout.c
index 6446a1f58641..f0511988ea07 100644
--- a/drivers/md/dm-vdo/index-layout.c
+++ b/drivers/md/dm-vdo/index-layout.c
@@ -386,9 +386,10 @@ static void define_sub_index_nonce(struct index_layout *layout)
encode_u64_le(buffer, &offset, sil->sub_index.start_block);
encode_u16_le(buffer, &offset, 0);
sil->nonce = generate_secondary_nonce(primary_nonce, buffer, sizeof(buffer));
- if (sil->nonce == 0)
+ if (sil->nonce == 0) {
sil->nonce = generate_secondary_nonce(~primary_nonce + 1, buffer,
sizeof(buffer));
+ }
}
static void setup_sub_index(struct index_layout *layout, u64 start_block,
@@ -651,10 +652,11 @@ static int discard_index_state_data(struct index_layout *layout)
saved_result = result;
}
- if (saved_result != UDS_SUCCESS)
+ if (saved_result != UDS_SUCCESS) {
return uds_log_error_strerror(result,
"%s: cannot destroy all index saves",
__func__);
+ }
return UDS_SUCCESS;
}
@@ -1242,9 +1244,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader,
"unknown superblock magic label");
if ((super->version < SUPER_VERSION_MINIMUM) ||
- (super->version == 4) ||
- (super->version == 5) ||
- (super->version == 6) ||
+ (super->version == 4) || (super->version == 5) || (super->version == 6) ||
(super->version > SUPER_VERSION_MAXIMUM)) {
return uds_log_error_strerror(UDS_UNSUPPORTED_VERSION,
"unknown superblock version number %u",
diff --git a/drivers/md/dm-vdo/index-page-map.c b/drivers/md/dm-vdo/index-page-map.c
index 190d12848ba2..acfff74f37bc 100644
--- a/drivers/md/dm-vdo/index-page-map.c
+++ b/drivers/md/dm-vdo/index-page-map.c
@@ -100,8 +100,7 @@ void uds_get_list_number_bounds(const struct index_page_map *map, u32 chapter_nu
u32 slot = chapter_number * map->entries_per_chapter;
*lowest_list = ((index_page_number == 0) ?
- 0 :
- map->entries[slot + index_page_number - 1] + 1);
+ 0 : map->entries[slot + index_page_number - 1] + 1);
*highest_list = ((index_page_number < map->entries_per_chapter) ?
map->entries[slot + index_page_number] :
map->geometry->delta_lists_per_chapter - 1);
diff --git a/drivers/md/dm-vdo/index-session.c b/drivers/md/dm-vdo/index-session.c
index 73c2927f74ce..c261453b9871 100644
--- a/drivers/md/dm-vdo/index-session.c
+++ b/drivers/md/dm-vdo/index-session.c
@@ -392,9 +392,10 @@ int uds_open_index(enum uds_open_index_type open_type,
static void wait_for_no_requests_in_progress(struct uds_index_session *index_session)
{
uds_lock_mutex(&index_session->request_mutex);
- while (index_session->request_count > 0)
+ while (index_session->request_count > 0) {
uds_wait_cond(&index_session->request_cond,
&index_session->request_mutex);
+ }
uds_unlock_mutex(&index_session->request_mutex);
}
@@ -619,9 +620,10 @@ int uds_close_index(struct uds_index_session *index_session)
/* Wait for any current index state change to complete. */
uds_lock_mutex(&index_session->request_mutex);
while ((index_session->state & IS_FLAG_WAITING) ||
- (index_session->state & IS_FLAG_CLOSING))
+ (index_session->state & IS_FLAG_CLOSING)) {
uds_wait_cond(&index_session->request_cond,
&index_session->request_mutex);
+ }
if (index_session->state & IS_FLAG_SUSPENDED) {
uds_log_info("Index session is suspended");
@@ -660,9 +662,10 @@ int uds_destroy_index_session(struct uds_index_session *index_session)
/* Wait for any current index state change to complete. */
uds_lock_mutex(&index_session->request_mutex);
while ((index_session->state & IS_FLAG_WAITING) ||
- (index_session->state & IS_FLAG_CLOSING))
+ (index_session->state & IS_FLAG_CLOSING)) {
uds_wait_cond(&index_session->request_cond,
&index_session->request_mutex);
+ }
if (index_session->state & IS_FLAG_DESTROYING) {
uds_unlock_mutex(&index_session->request_mutex);
@@ -686,9 +689,10 @@ int uds_destroy_index_session(struct uds_index_session *index_session)
/* Wait until the load exits before proceeding. */
uds_lock_mutex(&index_session->request_mutex);
- while (index_session->state & IS_FLAG_LOADING)
+ while (index_session->state & IS_FLAG_LOADING) {
uds_wait_cond(&index_session->request_cond,
&index_session->request_mutex);
+ }
uds_unlock_mutex(&index_session->request_mutex);
}
diff --git a/drivers/md/dm-vdo/index.c b/drivers/md/dm-vdo/index.c
index 28ae54efaced..3d2a673b3f52 100644
--- a/drivers/md/dm-vdo/index.c
+++ b/drivers/md/dm-vdo/index.c
@@ -1330,8 +1330,7 @@ int uds_save_index(struct uds_index *index)
uds_wait_for_idle_index(index);
index->prev_save = index->last_save;
index->last_save = ((index->newest_virtual_chapter == 0) ?
- NO_LAST_SAVE :
- index->newest_virtual_chapter - 1);
+ NO_LAST_SAVE : index->newest_virtual_chapter - 1);
uds_log_info("beginning save (vcn %llu)", (unsigned long long) index->last_save);
result = uds_save_index_state(index->layout, index);
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread