Skip to content

Commit 78109c5

Browse files
committed
Merge tag 'for-6.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mikulas Patocka: - always update the array size in realloc_argv on success - dm-integrity: fix a warning on invalid table line - dm-bufio: don't schedule in atomic context - Fix W=1 build with clang * tag 'for-6.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: always update the array size in realloc_argv on success dm-integrity: fix a warning on invalid table line dm-bufio: don't schedule in atomic context dm table: Fix W=1 build warning when mempool_needs_integrity is unused
2 parents f15d97d + 5a2a6c4 commit 78109c5

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

drivers/md/dm-bufio.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
#define LIST_DIRTY 1
6969
#define LIST_SIZE 2
7070

71+
#define SCAN_RESCHED_CYCLE 16
72+
7173
/*--------------------------------------------------------------*/
7274

7375
/*
@@ -2424,7 +2426,12 @@ static void __scan(struct dm_bufio_client *c)
24242426

24252427
atomic_long_dec(&c->need_shrink);
24262428
freed++;
2427-
cond_resched();
2429+
2430+
if (unlikely(freed % SCAN_RESCHED_CYCLE == 0)) {
2431+
dm_bufio_unlock(c);
2432+
cond_resched();
2433+
dm_bufio_lock(c);
2434+
}
24282435
}
24292436
}
24302437
}

drivers/md/dm-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5164,7 +5164,7 @@ static void dm_integrity_dtr(struct dm_target *ti)
51645164
BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
51655165
BUG_ON(!list_empty(&ic->wait_list));
51665166

5167-
if (ic->mode == 'B')
5167+
if (ic->mode == 'B' && ic->bitmap_flush_work.work.func)
51685168
cancel_delayed_work_sync(&ic->bitmap_flush_work);
51695169
if (ic->metadata_wq)
51705170
destroy_workqueue(ic->metadata_wq);

drivers/md/dm-table.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,10 @@ static char **realloc_argv(unsigned int *size, char **old_argv)
523523
gfp = GFP_NOIO;
524524
}
525525
argv = kmalloc_array(new_size, sizeof(*argv), gfp);
526-
if (argv && old_argv) {
527-
memcpy(argv, old_argv, *size * sizeof(*argv));
526+
if (argv) {
528527
*size = new_size;
528+
if (old_argv)
529+
memcpy(argv, old_argv, *size * sizeof(*argv));
529530
}
530531

531532
kfree(old_argv);
@@ -1049,7 +1050,6 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
10491050
unsigned int min_pool_size = 0, pool_size;
10501051
struct dm_md_mempools *pools;
10511052
unsigned int bioset_flags = 0;
1052-
bool mempool_needs_integrity = t->integrity_supported;
10531053

10541054
if (unlikely(type == DM_TYPE_NONE)) {
10551055
DMERR("no table type is set, can't allocate mempools");
@@ -1074,8 +1074,6 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
10741074

10751075
per_io_data_size = max(per_io_data_size, ti->per_io_data_size);
10761076
min_pool_size = max(min_pool_size, ti->num_flush_bios);
1077-
1078-
mempool_needs_integrity |= ti->mempool_needs_integrity;
10791077
}
10801078
pool_size = max(dm_get_reserved_bio_based_ios(), min_pool_size);
10811079
front_pad = roundup(per_io_data_size,

0 commit comments

Comments
 (0)