Skip to content

Commit 7eef7e3

Browse files
committed
Merge tag 'for-6.13/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper updates from Mikulas Patocka: - remove unused functions and variables - rate-limit error messages in syslog - fix typo - remove u64 alignment requirement for murmurhash - reset bi_ioprio to the default for dm-vdo - add support for get_unique_id - Add missing destroy_work_on_stack() to dm-thin - use kmalloc to allocate power-of-two sized buffers in bufio * tag 'for-6.13/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm-verity: remove the unused "data_start" variable dm-bufio: use kmalloc to allocate power-of-two sized buffers dm thin: Add missing destroy_work_on_stack() dm: add support for get_unique_id dm vdo: fix function doc comment formatting dm vdo int-map: remove unused parameters dm-vdo: reset bi_ioprio to the default value when the bio is reset dm-vdo murmurhash: remove u64 alignment requirement dm: Fix typo in error message dm ioctl: rate limit a couple of ioctl based error messages dm vdo: Remove unused uds_compute_index_size dm vdo: Remove unused functions dm: zoned: Remove unused functions dm: Remove unused dm_table_bio_based dm: Remove unused dm_set_md_type dm cache: Remove unused functions in bio-prison-v1 dm cache: Remove unused dm_cache_size dm cache: Remove unused dm_cache_dump dm cache: Remove unused btracker_nr_writebacks_queued
2 parents 0637a68 + a573e40 commit 7eef7e3

33 files changed

+115
-288
lines changed

drivers/md/dm-bio-prison-v1.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,6 @@ int dm_bio_detain(struct dm_bio_prison *prison,
198198
}
199199
EXPORT_SYMBOL_GPL(dm_bio_detain);
200200

201-
int dm_get_cell(struct dm_bio_prison *prison,
202-
struct dm_cell_key *key,
203-
struct dm_bio_prison_cell *cell_prealloc,
204-
struct dm_bio_prison_cell **cell_result)
205-
{
206-
return bio_detain(prison, key, NULL, cell_prealloc, cell_result);
207-
}
208-
EXPORT_SYMBOL_GPL(dm_get_cell);
209-
210201
/*
211202
* @inmates must have been initialised prior to this call
212203
*/
@@ -288,32 +279,6 @@ void dm_cell_visit_release(struct dm_bio_prison *prison,
288279
}
289280
EXPORT_SYMBOL_GPL(dm_cell_visit_release);
290281

291-
static int __promote_or_release(struct rb_root *root,
292-
struct dm_bio_prison_cell *cell)
293-
{
294-
if (bio_list_empty(&cell->bios)) {
295-
rb_erase(&cell->node, root);
296-
return 1;
297-
}
298-
299-
cell->holder = bio_list_pop(&cell->bios);
300-
return 0;
301-
}
302-
303-
int dm_cell_promote_or_release(struct dm_bio_prison *prison,
304-
struct dm_bio_prison_cell *cell)
305-
{
306-
int r;
307-
unsigned l = lock_nr(&cell->key, prison->num_locks);
308-
309-
spin_lock_irq(&prison->regions[l].lock);
310-
r = __promote_or_release(&prison->regions[l].cell, cell);
311-
spin_unlock_irq(&prison->regions[l].lock);
312-
313-
return r;
314-
}
315-
EXPORT_SYMBOL_GPL(dm_cell_promote_or_release);
316-
317282
/*----------------------------------------------------------------*/
318283

319284
#define DEFERRED_SET_SIZE 64

drivers/md/dm-bio-prison-v1.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,6 @@ struct dm_bio_prison_cell *dm_bio_prison_alloc_cell(struct dm_bio_prison *prison
7272
void dm_bio_prison_free_cell(struct dm_bio_prison *prison,
7373
struct dm_bio_prison_cell *cell);
7474

75-
/*
76-
* Creates, or retrieves a cell that overlaps the given key.
77-
*
78-
* Returns 1 if pre-existing cell returned, zero if new cell created using
79-
* @cell_prealloc.
80-
*/
81-
int dm_get_cell(struct dm_bio_prison *prison,
82-
struct dm_cell_key *key,
83-
struct dm_bio_prison_cell *cell_prealloc,
84-
struct dm_bio_prison_cell **cell_result);
85-
8675
/*
8776
* Returns false if key is beyond BIO_PRISON_MAX_RANGE or spans a boundary.
8877
*/
@@ -117,19 +106,6 @@ void dm_cell_visit_release(struct dm_bio_prison *prison,
117106
void (*visit_fn)(void *, struct dm_bio_prison_cell *),
118107
void *context, struct dm_bio_prison_cell *cell);
119108

120-
/*
121-
* Rather than always releasing the prisoners in a cell, the client may
122-
* want to promote one of them to be the new holder. There is a race here
123-
* though between releasing an empty cell, and other threads adding new
124-
* inmates. So this function makes the decision with its lock held.
125-
*
126-
* This function can have two outcomes:
127-
* i) An inmate is promoted to be the holder of the cell (return value of 0).
128-
* ii) The cell has no inmate for promotion and is released (return value of 1).
129-
*/
130-
int dm_cell_promote_or_release(struct dm_bio_prison *prison,
131-
struct dm_bio_prison_cell *cell);
132-
133109
/*----------------------------------------------------------------*/
134110

135111
/*

drivers/md/dm-bufio.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,10 @@ static struct lru_entry *lru_evict(struct lru *lru, le_predicate pred, void *con
318318
*/
319319
enum data_mode {
320320
DATA_MODE_SLAB = 0,
321-
DATA_MODE_GET_FREE_PAGES = 1,
322-
DATA_MODE_VMALLOC = 2,
323-
DATA_MODE_LIMIT = 3
321+
DATA_MODE_KMALLOC = 1,
322+
DATA_MODE_GET_FREE_PAGES = 2,
323+
DATA_MODE_VMALLOC = 3,
324+
DATA_MODE_LIMIT = 4
324325
};
325326

326327
struct dm_buffer {
@@ -1062,6 +1063,7 @@ static unsigned long dm_bufio_retain_bytes = DM_BUFIO_DEFAULT_RETAIN_BYTES;
10621063

10631064
static unsigned long dm_bufio_peak_allocated;
10641065
static unsigned long dm_bufio_allocated_kmem_cache;
1066+
static unsigned long dm_bufio_allocated_kmalloc;
10651067
static unsigned long dm_bufio_allocated_get_free_pages;
10661068
static unsigned long dm_bufio_allocated_vmalloc;
10671069
static unsigned long dm_bufio_current_allocated;
@@ -1104,6 +1106,7 @@ static void adjust_total_allocated(struct dm_buffer *b, bool unlink)
11041106

11051107
static unsigned long * const class_ptr[DATA_MODE_LIMIT] = {
11061108
&dm_bufio_allocated_kmem_cache,
1109+
&dm_bufio_allocated_kmalloc,
11071110
&dm_bufio_allocated_get_free_pages,
11081111
&dm_bufio_allocated_vmalloc,
11091112
};
@@ -1181,6 +1184,11 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
11811184
return kmem_cache_alloc(c->slab_cache, gfp_mask);
11821185
}
11831186

1187+
if (unlikely(c->block_size < PAGE_SIZE)) {
1188+
*data_mode = DATA_MODE_KMALLOC;
1189+
return kmalloc(c->block_size, gfp_mask | __GFP_RECLAIMABLE);
1190+
}
1191+
11841192
if (c->block_size <= KMALLOC_MAX_SIZE &&
11851193
gfp_mask & __GFP_NORETRY) {
11861194
*data_mode = DATA_MODE_GET_FREE_PAGES;
@@ -1204,6 +1212,10 @@ static void free_buffer_data(struct dm_bufio_client *c,
12041212
kmem_cache_free(c->slab_cache, data);
12051213
break;
12061214

1215+
case DATA_MODE_KMALLOC:
1216+
kfree(data);
1217+
break;
1218+
12071219
case DATA_MODE_GET_FREE_PAGES:
12081220
free_pages((unsigned long)data,
12091221
c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
@@ -2519,8 +2531,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
25192531
goto bad_dm_io;
25202532
}
25212533

2522-
if (block_size <= KMALLOC_MAX_SIZE &&
2523-
(block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
2534+
if (block_size <= KMALLOC_MAX_SIZE && !is_power_of_2(block_size)) {
25242535
unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
25252536

25262537
snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u-%u",
@@ -2902,6 +2913,7 @@ static int __init dm_bufio_init(void)
29022913
__u64 mem;
29032914

29042915
dm_bufio_allocated_kmem_cache = 0;
2916+
dm_bufio_allocated_kmalloc = 0;
29052917
dm_bufio_allocated_get_free_pages = 0;
29062918
dm_bufio_allocated_vmalloc = 0;
29072919
dm_bufio_current_allocated = 0;
@@ -2990,6 +3002,9 @@ MODULE_PARM_DESC(peak_allocated_bytes, "Tracks the maximum allocated memory");
29903002
module_param_named(allocated_kmem_cache_bytes, dm_bufio_allocated_kmem_cache, ulong, 0444);
29913003
MODULE_PARM_DESC(allocated_kmem_cache_bytes, "Memory allocated with kmem_cache_alloc");
29923004

3005+
module_param_named(allocated_kmalloc_bytes, dm_bufio_allocated_kmalloc, ulong, 0444);
3006+
MODULE_PARM_DESC(allocated_kmalloc_bytes, "Memory allocated with kmalloc_alloc");
3007+
29933008
module_param_named(allocated_get_free_pages_bytes, dm_bufio_allocated_get_free_pages, ulong, 0444);
29943009
MODULE_PARM_DESC(allocated_get_free_pages_bytes, "Memory allocated with get_free_pages");
29953010

drivers/md/dm-cache-background-tracker.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ static void update_stats(struct background_tracker *b, struct policy_work *w, in
143143
}
144144
}
145145

146-
unsigned int btracker_nr_writebacks_queued(struct background_tracker *b)
147-
{
148-
return atomic_read(&b->pending_writebacks);
149-
}
150-
EXPORT_SYMBOL_GPL(btracker_nr_writebacks_queued);
151-
152146
unsigned int btracker_nr_demotions_queued(struct background_tracker *b)
153147
{
154148
return atomic_read(&b->pending_demotes);

drivers/md/dm-cache-background-tracker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ struct background_tracker *btracker_create(unsigned int max_work);
5050
*/
5151
void btracker_destroy(struct background_tracker *b);
5252

53-
unsigned int btracker_nr_writebacks_queued(struct background_tracker *b);
5453
unsigned int btracker_nr_demotions_queued(struct background_tracker *b);
5554

5655
/*

drivers/md/dm-cache-metadata.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,15 +1218,6 @@ int dm_cache_load_discards(struct dm_cache_metadata *cmd,
12181218
return r;
12191219
}
12201220

1221-
int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result)
1222-
{
1223-
READ_LOCK(cmd);
1224-
*result = cmd->cache_blocks;
1225-
READ_UNLOCK(cmd);
1226-
1227-
return 0;
1228-
}
1229-
12301221
static int __remove(struct dm_cache_metadata *cmd, dm_cblock_t cblock)
12311222
{
12321223
int r;
@@ -1507,30 +1498,6 @@ int dm_cache_load_mappings(struct dm_cache_metadata *cmd,
15071498
return r;
15081499
}
15091500

1510-
static int __dump_mapping(void *context, uint64_t cblock, void *leaf)
1511-
{
1512-
__le64 value;
1513-
dm_oblock_t oblock;
1514-
unsigned int flags;
1515-
1516-
memcpy(&value, leaf, sizeof(value));
1517-
unpack_value(value, &oblock, &flags);
1518-
1519-
return 0;
1520-
}
1521-
1522-
static int __dump_mappings(struct dm_cache_metadata *cmd)
1523-
{
1524-
return dm_array_walk(&cmd->info, cmd->root, __dump_mapping, NULL);
1525-
}
1526-
1527-
void dm_cache_dump(struct dm_cache_metadata *cmd)
1528-
{
1529-
READ_LOCK_VOID(cmd);
1530-
__dump_mappings(cmd);
1531-
READ_UNLOCK(cmd);
1532-
}
1533-
15341501
int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd)
15351502
{
15361503
int r;

drivers/md/dm-cache-metadata.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ void dm_cache_metadata_close(struct dm_cache_metadata *cmd);
7171
* origin blocks to map to.
7272
*/
7373
int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size);
74-
int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result);
7574

7675
int dm_cache_discard_bitset_resize(struct dm_cache_metadata *cmd,
7776
sector_t discard_block_size,
@@ -123,8 +122,6 @@ int dm_cache_get_free_metadata_block_count(struct dm_cache_metadata *cmd,
123122
int dm_cache_get_metadata_dev_size(struct dm_cache_metadata *cmd,
124123
dm_block_t *result);
125124

126-
void dm_cache_dump(struct dm_cache_metadata *cmd);
127-
128125
/*
129126
* The policy is invited to save a 32bit hint value for every cblock (eg,
130127
* for a hit count). These are stored against the policy name. If

drivers/md/dm-ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,7 @@ static int check_version(unsigned int cmd, struct dm_ioctl __user *user,
19121912

19131913
if ((kernel_params->version[0] != DM_VERSION_MAJOR) ||
19141914
(kernel_params->version[1] > DM_VERSION_MINOR)) {
1915-
DMERR("ioctl interface mismatch: kernel(%u.%u.%u), user(%u.%u.%u), cmd(%d)",
1915+
DMERR_LIMIT("ioctl interface mismatch: kernel(%u.%u.%u), user(%u.%u.%u), cmd(%d)",
19161916
DM_VERSION_MAJOR, DM_VERSION_MINOR,
19171917
DM_VERSION_PATCHLEVEL,
19181918
kernel_params->version[0],
@@ -1961,7 +1961,7 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern
19611961

19621962
if (unlikely(param_kernel->data_size < minimum_data_size) ||
19631963
unlikely(param_kernel->data_size > DM_MAX_TARGETS * DM_MAX_TARGET_PARAMS)) {
1964-
DMERR("Invalid data size in the ioctl structure: %u",
1964+
DMERR_LIMIT("Invalid data size in the ioctl structure: %u",
19651965
param_kernel->data_size);
19661966
return -EINVAL;
19671967
}

drivers/md/dm-table.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,11 +1033,6 @@ struct dm_target *dm_table_get_wildcard_target(struct dm_table *t)
10331033
return NULL;
10341034
}
10351035

1036-
bool dm_table_bio_based(struct dm_table *t)
1037-
{
1038-
return __table_type_bio_based(dm_table_get_type(t));
1039-
}
1040-
10411036
bool dm_table_request_based(struct dm_table *t)
10421037
{
10431038
return __table_type_request_based(dm_table_get_type(t));

drivers/md/dm-thin.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,6 +2484,7 @@ static void pool_work_wait(struct pool_work *pw, struct pool *pool,
24842484
init_completion(&pw->complete);
24852485
queue_work(pool->wq, &pw->worker);
24862486
wait_for_completion(&pw->complete);
2487+
destroy_work_on_stack(&pw->worker);
24872488
}
24882489

24892490
/*----------------------------------------------------------------*/

drivers/md/dm-vdo/block-map.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ static int initialize_info(struct vdo_page_cache *cache)
209209
/**
210210
* allocate_cache_components() - Allocate components of the cache which require their own
211211
* allocation.
212-
* @maximum_age: The number of journal blocks before a dirtied page is considered old and must be
213-
* written out.
214212
*
215213
* The caller is responsible for all clean up on errors.
216214
*

drivers/md/dm-vdo/data-vio.c

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,9 @@ static u32 __must_check pack_status(struct data_vio_compression_status status)
327327

328328
/**
329329
* set_data_vio_compression_status() - Set the compression status of a data_vio.
330-
* @state: The expected current status of the data_vio.
331-
* @new_state: The status to set.
330+
* @data_vio: The data_vio to change.
331+
* @status: The expected current status of the data_vio.
332+
* @new_status: The status to set.
332333
*
333334
* Return: true if the new status was set, false if the data_vio's compression status did not
334335
* match the expected state, and so was left unchanged.
@@ -836,7 +837,7 @@ static void destroy_data_vio(struct data_vio *data_vio)
836837
* @vdo: The vdo to which the pool will belong.
837838
* @pool_size: The number of data_vios in the pool.
838839
* @discard_limit: The maximum number of data_vios which may be used for discards.
839-
* @pool: A pointer to hold the newly allocated pool.
840+
* @pool_ptr: A pointer to hold the newly allocated pool.
840841
*/
841842
int make_data_vio_pool(struct vdo *vdo, data_vio_count_t pool_size,
842843
data_vio_count_t discard_limit, struct data_vio_pool **pool_ptr)
@@ -1074,35 +1075,6 @@ void dump_data_vio_pool(struct data_vio_pool *pool, bool dump_vios)
10741075
spin_unlock(&pool->lock);
10751076
}
10761077

1077-
data_vio_count_t get_data_vio_pool_active_discards(struct data_vio_pool *pool)
1078-
{
1079-
return READ_ONCE(pool->discard_limiter.busy);
1080-
}
1081-
1082-
data_vio_count_t get_data_vio_pool_discard_limit(struct data_vio_pool *pool)
1083-
{
1084-
return READ_ONCE(pool->discard_limiter.limit);
1085-
}
1086-
1087-
data_vio_count_t get_data_vio_pool_maximum_discards(struct data_vio_pool *pool)
1088-
{
1089-
return READ_ONCE(pool->discard_limiter.max_busy);
1090-
}
1091-
1092-
int set_data_vio_pool_discard_limit(struct data_vio_pool *pool, data_vio_count_t limit)
1093-
{
1094-
if (get_data_vio_pool_request_limit(pool) < limit) {
1095-
// The discard limit may not be higher than the data_vio limit.
1096-
return -EINVAL;
1097-
}
1098-
1099-
spin_lock(&pool->lock);
1100-
pool->discard_limiter.limit = limit;
1101-
spin_unlock(&pool->lock);
1102-
1103-
return VDO_SUCCESS;
1104-
}
1105-
11061078
data_vio_count_t get_data_vio_pool_active_requests(struct data_vio_pool *pool)
11071079
{
11081080
return READ_ONCE(pool->limiter.busy);

drivers/md/dm-vdo/data-vio.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,6 @@ void drain_data_vio_pool(struct data_vio_pool *pool, struct vdo_completion *comp
336336
void resume_data_vio_pool(struct data_vio_pool *pool, struct vdo_completion *completion);
337337

338338
void dump_data_vio_pool(struct data_vio_pool *pool, bool dump_vios);
339-
data_vio_count_t get_data_vio_pool_active_discards(struct data_vio_pool *pool);
340-
data_vio_count_t get_data_vio_pool_discard_limit(struct data_vio_pool *pool);
341-
data_vio_count_t get_data_vio_pool_maximum_discards(struct data_vio_pool *pool);
342-
int __must_check set_data_vio_pool_discard_limit(struct data_vio_pool *pool,
343-
data_vio_count_t limit);
344339
data_vio_count_t get_data_vio_pool_active_requests(struct data_vio_pool *pool);
345340
data_vio_count_t get_data_vio_pool_request_limit(struct data_vio_pool *pool);
346341
data_vio_count_t get_data_vio_pool_maximum_requests(struct data_vio_pool *pool);

0 commit comments

Comments
 (0)