summaryrefslogtreecommitdiff
path: root/drivers/md/dm-bufio.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-03-25 03:49:25 +0300
committerMike Snitzer <snitzer@kernel.org>2023-03-30 22:57:50 +0300
commitb75a80f4f5a956f3d335ebf29c7cee1b234ac3cf (patch)
tree30c800c39e8f740fb063a86820e75e684ce8fd4c /drivers/md/dm-bufio.c
parent0511228752eaa5264ada8b1f4baeded916c65945 (diff)
downloadlinux-b75a80f4f5a956f3d335ebf29c7cee1b234ac3cf.tar.xz
dm bufio: don't bug for clear developer oversight
Reasonable to relax to WARN_ON because these are easily avoided but do offer some assurance future coding mistakes won't occur (if changes tested properly). Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r--drivers/md/dm-bufio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index d63f94ab1d9f..64fb5fd39bd9 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -378,8 +378,10 @@ static void adjust_total_allocated(struct dm_buffer *b, bool unlink)
*/
static void __cache_size_refresh(void)
{
- BUG_ON(!mutex_is_locked(&dm_bufio_clients_lock));
- BUG_ON(dm_bufio_client_count < 0);
+ if (WARN_ON(!mutex_is_locked(&dm_bufio_clients_lock)))
+ return;
+ if (WARN_ON(dm_bufio_client_count < 0))
+ return;
dm_bufio_cache_size_latch = READ_ONCE(dm_bufio_cache_size);
@@ -1536,7 +1538,8 @@ static void drop_buffers(struct dm_bufio_client *c)
int i;
bool warned = false;
- BUG_ON(dm_bufio_in_request());
+ if (WARN_ON(dm_bufio_in_request()))
+ return; /* should never happen */
/*
* An optimization so that the buffers are not written one-by-one.
@@ -1556,7 +1559,7 @@ static void drop_buffers(struct dm_bufio_client *c)
(unsigned long long)b->block, b->hold_count, i);
#ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
stack_trace_print(b->stack_entries, b->stack_len, 1);
- /* mark unclaimed to avoid BUG_ON below */
+ /* mark unclaimed to avoid WARN_ON below */
b->hold_count = 0;
#endif
}
@@ -1567,7 +1570,7 @@ static void drop_buffers(struct dm_bufio_client *c)
#endif
for (i = 0; i < LIST_SIZE; i++)
- BUG_ON(!list_empty(&c->lru[i]));
+ WARN_ON(!list_empty(&c->lru[i]));
dm_bufio_unlock(c);
}