Skip to content

Commit

Permalink
Merge tag 'for-6.13/dm-changes' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Nov 26, 2024
2 parents 0637a68 + a573e40 commit 7eef7e3
Show file tree
Hide file tree
Showing 33 changed files with 115 additions and 288 deletions.
35 changes: 0 additions & 35 deletions drivers/md/dm-bio-prison-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,6 @@ int dm_bio_detain(struct dm_bio_prison *prison,
}
EXPORT_SYMBOL_GPL(dm_bio_detain);

int dm_get_cell(struct dm_bio_prison *prison,
struct dm_cell_key *key,
struct dm_bio_prison_cell *cell_prealloc,
struct dm_bio_prison_cell **cell_result)
{
return bio_detain(prison, key, NULL, cell_prealloc, cell_result);
}
EXPORT_SYMBOL_GPL(dm_get_cell);

/*
* @inmates must have been initialised prior to this call
*/
Expand Down Expand Up @@ -288,32 +279,6 @@ void dm_cell_visit_release(struct dm_bio_prison *prison,
}
EXPORT_SYMBOL_GPL(dm_cell_visit_release);

static int __promote_or_release(struct rb_root *root,
struct dm_bio_prison_cell *cell)
{
if (bio_list_empty(&cell->bios)) {
rb_erase(&cell->node, root);
return 1;
}

cell->holder = bio_list_pop(&cell->bios);
return 0;
}

int dm_cell_promote_or_release(struct dm_bio_prison *prison,
struct dm_bio_prison_cell *cell)
{
int r;
unsigned l = lock_nr(&cell->key, prison->num_locks);

spin_lock_irq(&prison->regions[l].lock);
r = __promote_or_release(&prison->regions[l].cell, cell);
spin_unlock_irq(&prison->regions[l].lock);

return r;
}
EXPORT_SYMBOL_GPL(dm_cell_promote_or_release);

/*----------------------------------------------------------------*/

#define DEFERRED_SET_SIZE 64
Expand Down
24 changes: 0 additions & 24 deletions drivers/md/dm-bio-prison-v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ struct dm_bio_prison_cell *dm_bio_prison_alloc_cell(struct dm_bio_prison *prison
void dm_bio_prison_free_cell(struct dm_bio_prison *prison,
struct dm_bio_prison_cell *cell);

/*
* Creates, or retrieves a cell that overlaps the given key.
*
* Returns 1 if pre-existing cell returned, zero if new cell created using
* @cell_prealloc.
*/
int dm_get_cell(struct dm_bio_prison *prison,
struct dm_cell_key *key,
struct dm_bio_prison_cell *cell_prealloc,
struct dm_bio_prison_cell **cell_result);

/*
* Returns false if key is beyond BIO_PRISON_MAX_RANGE or spans a boundary.
*/
Expand Down Expand Up @@ -117,19 +106,6 @@ void dm_cell_visit_release(struct dm_bio_prison *prison,
void (*visit_fn)(void *, struct dm_bio_prison_cell *),
void *context, struct dm_bio_prison_cell *cell);

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

/*----------------------------------------------------------------*/

/*
Expand Down
25 changes: 20 additions & 5 deletions drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,10 @@ static struct lru_entry *lru_evict(struct lru *lru, le_predicate pred, void *con
*/
enum data_mode {
DATA_MODE_SLAB = 0,
DATA_MODE_GET_FREE_PAGES = 1,
DATA_MODE_VMALLOC = 2,
DATA_MODE_LIMIT = 3
DATA_MODE_KMALLOC = 1,
DATA_MODE_GET_FREE_PAGES = 2,
DATA_MODE_VMALLOC = 3,
DATA_MODE_LIMIT = 4
};

struct dm_buffer {
Expand Down Expand Up @@ -1062,6 +1063,7 @@ static unsigned long dm_bufio_retain_bytes = DM_BUFIO_DEFAULT_RETAIN_BYTES;

static unsigned long dm_bufio_peak_allocated;
static unsigned long dm_bufio_allocated_kmem_cache;
static unsigned long dm_bufio_allocated_kmalloc;
static unsigned long dm_bufio_allocated_get_free_pages;
static unsigned long dm_bufio_allocated_vmalloc;
static unsigned long dm_bufio_current_allocated;
Expand Down Expand Up @@ -1104,6 +1106,7 @@ static void adjust_total_allocated(struct dm_buffer *b, bool unlink)

static unsigned long * const class_ptr[DATA_MODE_LIMIT] = {
&dm_bufio_allocated_kmem_cache,
&dm_bufio_allocated_kmalloc,
&dm_bufio_allocated_get_free_pages,
&dm_bufio_allocated_vmalloc,
};
Expand Down Expand Up @@ -1181,6 +1184,11 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
return kmem_cache_alloc(c->slab_cache, gfp_mask);
}

if (unlikely(c->block_size < PAGE_SIZE)) {
*data_mode = DATA_MODE_KMALLOC;
return kmalloc(c->block_size, gfp_mask | __GFP_RECLAIMABLE);
}

if (c->block_size <= KMALLOC_MAX_SIZE &&
gfp_mask & __GFP_NORETRY) {
*data_mode = DATA_MODE_GET_FREE_PAGES;
Expand All @@ -1204,6 +1212,10 @@ static void free_buffer_data(struct dm_bufio_client *c,
kmem_cache_free(c->slab_cache, data);
break;

case DATA_MODE_KMALLOC:
kfree(data);
break;

case DATA_MODE_GET_FREE_PAGES:
free_pages((unsigned long)data,
c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT));
Expand Down Expand Up @@ -2519,8 +2531,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
goto bad_dm_io;
}

if (block_size <= KMALLOC_MAX_SIZE &&
(block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
if (block_size <= KMALLOC_MAX_SIZE && !is_power_of_2(block_size)) {
unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);

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

dm_bufio_allocated_kmem_cache = 0;
dm_bufio_allocated_kmalloc = 0;
dm_bufio_allocated_get_free_pages = 0;
dm_bufio_allocated_vmalloc = 0;
dm_bufio_current_allocated = 0;
Expand Down Expand Up @@ -2990,6 +3002,9 @@ MODULE_PARM_DESC(peak_allocated_bytes, "Tracks the maximum allocated memory");
module_param_named(allocated_kmem_cache_bytes, dm_bufio_allocated_kmem_cache, ulong, 0444);
MODULE_PARM_DESC(allocated_kmem_cache_bytes, "Memory allocated with kmem_cache_alloc");

module_param_named(allocated_kmalloc_bytes, dm_bufio_allocated_kmalloc, ulong, 0444);
MODULE_PARM_DESC(allocated_kmalloc_bytes, "Memory allocated with kmalloc_alloc");

module_param_named(allocated_get_free_pages_bytes, dm_bufio_allocated_get_free_pages, ulong, 0444);
MODULE_PARM_DESC(allocated_get_free_pages_bytes, "Memory allocated with get_free_pages");

Expand Down
6 changes: 0 additions & 6 deletions drivers/md/dm-cache-background-tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ static void update_stats(struct background_tracker *b, struct policy_work *w, in
}
}

unsigned int btracker_nr_writebacks_queued(struct background_tracker *b)
{
return atomic_read(&b->pending_writebacks);
}
EXPORT_SYMBOL_GPL(btracker_nr_writebacks_queued);

unsigned int btracker_nr_demotions_queued(struct background_tracker *b)
{
return atomic_read(&b->pending_demotes);
Expand Down
1 change: 0 additions & 1 deletion drivers/md/dm-cache-background-tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct background_tracker *btracker_create(unsigned int max_work);
*/
void btracker_destroy(struct background_tracker *b);

unsigned int btracker_nr_writebacks_queued(struct background_tracker *b);
unsigned int btracker_nr_demotions_queued(struct background_tracker *b);

/*
Expand Down
33 changes: 0 additions & 33 deletions drivers/md/dm-cache-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,15 +1218,6 @@ int dm_cache_load_discards(struct dm_cache_metadata *cmd,
return r;
}

int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result)
{
READ_LOCK(cmd);
*result = cmd->cache_blocks;
READ_UNLOCK(cmd);

return 0;
}

static int __remove(struct dm_cache_metadata *cmd, dm_cblock_t cblock)
{
int r;
Expand Down Expand Up @@ -1507,30 +1498,6 @@ int dm_cache_load_mappings(struct dm_cache_metadata *cmd,
return r;
}

static int __dump_mapping(void *context, uint64_t cblock, void *leaf)
{
__le64 value;
dm_oblock_t oblock;
unsigned int flags;

memcpy(&value, leaf, sizeof(value));
unpack_value(value, &oblock, &flags);

return 0;
}

static int __dump_mappings(struct dm_cache_metadata *cmd)
{
return dm_array_walk(&cmd->info, cmd->root, __dump_mapping, NULL);
}

void dm_cache_dump(struct dm_cache_metadata *cmd)
{
READ_LOCK_VOID(cmd);
__dump_mappings(cmd);
READ_UNLOCK(cmd);
}

int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd)
{
int r;
Expand Down
3 changes: 0 additions & 3 deletions drivers/md/dm-cache-metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ void dm_cache_metadata_close(struct dm_cache_metadata *cmd);
* origin blocks to map to.
*/
int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size);
int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result);

int dm_cache_discard_bitset_resize(struct dm_cache_metadata *cmd,
sector_t discard_block_size,
Expand Down Expand Up @@ -123,8 +122,6 @@ int dm_cache_get_free_metadata_block_count(struct dm_cache_metadata *cmd,
int dm_cache_get_metadata_dev_size(struct dm_cache_metadata *cmd,
dm_block_t *result);

void dm_cache_dump(struct dm_cache_metadata *cmd);

/*
* The policy is invited to save a 32bit hint value for every cblock (eg,
* for a hit count). These are stored against the policy name. If
Expand Down
4 changes: 2 additions & 2 deletions drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ static int check_version(unsigned int cmd, struct dm_ioctl __user *user,

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

if (unlikely(param_kernel->data_size < minimum_data_size) ||
unlikely(param_kernel->data_size > DM_MAX_TARGETS * DM_MAX_TARGET_PARAMS)) {
DMERR("Invalid data size in the ioctl structure: %u",
DMERR_LIMIT("Invalid data size in the ioctl structure: %u",
param_kernel->data_size);
return -EINVAL;
}
Expand Down
5 changes: 0 additions & 5 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,6 @@ struct dm_target *dm_table_get_wildcard_target(struct dm_table *t)
return NULL;
}

bool dm_table_bio_based(struct dm_table *t)
{
return __table_type_bio_based(dm_table_get_type(t));
}

bool dm_table_request_based(struct dm_table *t)
{
return __table_type_request_based(dm_table_get_type(t));
Expand Down
1 change: 1 addition & 0 deletions drivers/md/dm-thin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,7 @@ static void pool_work_wait(struct pool_work *pw, struct pool *pool,
init_completion(&pw->complete);
queue_work(pool->wq, &pw->worker);
wait_for_completion(&pw->complete);
destroy_work_on_stack(&pw->worker);
}

/*----------------------------------------------------------------*/
Expand Down
2 changes: 0 additions & 2 deletions drivers/md/dm-vdo/block-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ static int initialize_info(struct vdo_page_cache *cache)
/**
* allocate_cache_components() - Allocate components of the cache which require their own
* allocation.
* @maximum_age: The number of journal blocks before a dirtied page is considered old and must be
* written out.
*
* The caller is responsible for all clean up on errors.
*
Expand Down
36 changes: 4 additions & 32 deletions drivers/md/dm-vdo/data-vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ static u32 __must_check pack_status(struct data_vio_compression_status status)

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

data_vio_count_t get_data_vio_pool_active_discards(struct data_vio_pool *pool)
{
return READ_ONCE(pool->discard_limiter.busy);
}

data_vio_count_t get_data_vio_pool_discard_limit(struct data_vio_pool *pool)
{
return READ_ONCE(pool->discard_limiter.limit);
}

data_vio_count_t get_data_vio_pool_maximum_discards(struct data_vio_pool *pool)
{
return READ_ONCE(pool->discard_limiter.max_busy);
}

int set_data_vio_pool_discard_limit(struct data_vio_pool *pool, data_vio_count_t limit)
{
if (get_data_vio_pool_request_limit(pool) < limit) {
// The discard limit may not be higher than the data_vio limit.
return -EINVAL;
}

spin_lock(&pool->lock);
pool->discard_limiter.limit = limit;
spin_unlock(&pool->lock);

return VDO_SUCCESS;
}

data_vio_count_t get_data_vio_pool_active_requests(struct data_vio_pool *pool)
{
return READ_ONCE(pool->limiter.busy);
Expand Down
5 changes: 0 additions & 5 deletions drivers/md/dm-vdo/data-vio.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,6 @@ void drain_data_vio_pool(struct data_vio_pool *pool, struct vdo_completion *comp
void resume_data_vio_pool(struct data_vio_pool *pool, struct vdo_completion *completion);

void dump_data_vio_pool(struct data_vio_pool *pool, bool dump_vios);
data_vio_count_t get_data_vio_pool_active_discards(struct data_vio_pool *pool);
data_vio_count_t get_data_vio_pool_discard_limit(struct data_vio_pool *pool);
data_vio_count_t get_data_vio_pool_maximum_discards(struct data_vio_pool *pool);
int __must_check set_data_vio_pool_discard_limit(struct data_vio_pool *pool,
data_vio_count_t limit);
data_vio_count_t get_data_vio_pool_active_requests(struct data_vio_pool *pool);
data_vio_count_t get_data_vio_pool_request_limit(struct data_vio_pool *pool);
data_vio_count_t get_data_vio_pool_maximum_requests(struct data_vio_pool *pool);
Expand Down
Loading

0 comments on commit 7eef7e3

Please sign in to comment.