mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
dm: change "unsigned" to "unsigned int"
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
committed by
Mike Snitzer
parent
238d991f05
commit
86a3238c7b
@@ -286,14 +286,14 @@ EXPORT_SYMBOL_GPL(dm_cell_promote_or_release);
|
||||
|
||||
struct dm_deferred_entry {
|
||||
struct dm_deferred_set *ds;
|
||||
unsigned count;
|
||||
unsigned int count;
|
||||
struct list_head work_items;
|
||||
};
|
||||
|
||||
struct dm_deferred_set {
|
||||
spinlock_t lock;
|
||||
unsigned current_entry;
|
||||
unsigned sweeper;
|
||||
unsigned int current_entry;
|
||||
unsigned int sweeper;
|
||||
struct dm_deferred_entry entries[DEFERRED_SET_SIZE];
|
||||
};
|
||||
|
||||
@@ -339,7 +339,7 @@ struct dm_deferred_entry *dm_deferred_entry_inc(struct dm_deferred_set *ds)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_deferred_entry_inc);
|
||||
|
||||
static unsigned ds_next(unsigned index)
|
||||
static unsigned int ds_next(unsigned int index)
|
||||
{
|
||||
return (index + 1) % DEFERRED_SET_SIZE;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ EXPORT_SYMBOL_GPL(dm_deferred_entry_dec);
|
||||
int dm_deferred_set_add_work(struct dm_deferred_set *ds, struct list_head *work)
|
||||
{
|
||||
int r = 1;
|
||||
unsigned next_entry;
|
||||
unsigned int next_entry;
|
||||
|
||||
spin_lock_irq(&ds->lock);
|
||||
if ((ds->sweeper == ds->current_entry) &&
|
||||
|
||||
@@ -149,7 +149,7 @@ static bool __find_or_insert(struct dm_bio_prison_v2 *prison,
|
||||
|
||||
static bool __get(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct bio *inmate,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell)
|
||||
@@ -172,7 +172,7 @@ static bool __get(struct dm_bio_prison_v2 *prison,
|
||||
|
||||
bool dm_cell_get_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct bio *inmate,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell_result)
|
||||
@@ -225,7 +225,7 @@ EXPORT_SYMBOL_GPL(dm_cell_put_v2);
|
||||
|
||||
static int __lock(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell_result)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ static int __lock(struct dm_bio_prison_v2 *prison,
|
||||
|
||||
int dm_cell_lock_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell_result)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ EXPORT_SYMBOL_GPL(dm_cell_quiesce_v2);
|
||||
|
||||
static int __promote(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_bio_prison_cell_v2 *cell,
|
||||
unsigned new_lock_level)
|
||||
unsigned int new_lock_level)
|
||||
{
|
||||
if (!cell->exclusive_lock)
|
||||
return -EINVAL;
|
||||
@@ -303,7 +303,7 @@ static int __promote(struct dm_bio_prison_v2 *prison,
|
||||
|
||||
int dm_cell_lock_promote_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_bio_prison_cell_v2 *cell,
|
||||
unsigned new_lock_level)
|
||||
unsigned int new_lock_level)
|
||||
{
|
||||
int r;
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ struct dm_cell_key_v2 {
|
||||
struct dm_bio_prison_cell_v2 {
|
||||
// FIXME: pack these
|
||||
bool exclusive_lock;
|
||||
unsigned exclusive_level;
|
||||
unsigned shared_count;
|
||||
unsigned int exclusive_level;
|
||||
unsigned int shared_count;
|
||||
struct work_struct *quiesce_continuation;
|
||||
|
||||
struct rb_node node;
|
||||
@@ -87,7 +87,7 @@ void dm_bio_prison_free_cell_v2(struct dm_bio_prison_v2 *prison,
|
||||
*/
|
||||
bool dm_cell_get_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct bio *inmate,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell_result);
|
||||
@@ -115,7 +115,7 @@ bool dm_cell_put_v2(struct dm_bio_prison_v2 *prison,
|
||||
*/
|
||||
int dm_cell_lock_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_cell_key_v2 *key,
|
||||
unsigned lock_level,
|
||||
unsigned int lock_level,
|
||||
struct dm_bio_prison_cell_v2 *cell_prealloc,
|
||||
struct dm_bio_prison_cell_v2 **cell_result);
|
||||
|
||||
@@ -133,7 +133,7 @@ void dm_cell_quiesce_v2(struct dm_bio_prison_v2 *prison,
|
||||
*/
|
||||
int dm_cell_lock_promote_v2(struct dm_bio_prison_v2 *prison,
|
||||
struct dm_bio_prison_cell_v2 *cell,
|
||||
unsigned new_lock_level);
|
||||
unsigned int new_lock_level);
|
||||
|
||||
/*
|
||||
* Adds any held bios to the bio list.
|
||||
|
||||
+29
-29
@@ -90,7 +90,7 @@ struct dm_bufio_client {
|
||||
unsigned long n_buffers[LIST_SIZE];
|
||||
|
||||
struct block_device *bdev;
|
||||
unsigned block_size;
|
||||
unsigned int block_size;
|
||||
s8 sectors_per_block_bits;
|
||||
void (*alloc_callback)(struct dm_buffer *);
|
||||
void (*write_callback)(struct dm_buffer *);
|
||||
@@ -99,9 +99,9 @@ struct dm_bufio_client {
|
||||
struct dm_io_client *dm_io;
|
||||
|
||||
struct list_head reserved_buffers;
|
||||
unsigned need_reserved_buffers;
|
||||
unsigned int need_reserved_buffers;
|
||||
|
||||
unsigned minimum_buffers;
|
||||
unsigned int minimum_buffers;
|
||||
|
||||
struct rb_root buffer_tree;
|
||||
wait_queue_head_t free_buffer_wait;
|
||||
@@ -146,14 +146,14 @@ struct dm_buffer {
|
||||
unsigned char list_mode; /* LIST_* */
|
||||
blk_status_t read_error;
|
||||
blk_status_t write_error;
|
||||
unsigned accessed;
|
||||
unsigned hold_count;
|
||||
unsigned int accessed;
|
||||
unsigned int hold_count;
|
||||
unsigned long state;
|
||||
unsigned long last_accessed;
|
||||
unsigned dirty_start;
|
||||
unsigned dirty_end;
|
||||
unsigned write_start;
|
||||
unsigned write_end;
|
||||
unsigned int dirty_start;
|
||||
unsigned int dirty_end;
|
||||
unsigned int write_start;
|
||||
unsigned int write_end;
|
||||
struct dm_bufio_client *c;
|
||||
struct list_head write_list;
|
||||
void (*end_io)(struct dm_buffer *, blk_status_t);
|
||||
@@ -221,7 +221,7 @@ static unsigned long global_num = 0;
|
||||
/*
|
||||
* Buffers are freed after this timeout
|
||||
*/
|
||||
static unsigned dm_bufio_max_age = DM_BUFIO_DEFAULT_AGE_SECS;
|
||||
static unsigned int dm_bufio_max_age = DM_BUFIO_DEFAULT_AGE_SECS;
|
||||
static unsigned long dm_bufio_retain_bytes = DM_BUFIO_DEFAULT_RETAIN_BYTES;
|
||||
|
||||
static unsigned long dm_bufio_peak_allocated;
|
||||
@@ -439,7 +439,7 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
|
||||
* as if GFP_NOIO was specified.
|
||||
*/
|
||||
if (gfp_mask & __GFP_NORETRY) {
|
||||
unsigned noio_flag = memalloc_noio_save();
|
||||
unsigned int noio_flag = memalloc_noio_save();
|
||||
void *ptr = __vmalloc(c->block_size, gfp_mask);
|
||||
|
||||
memalloc_noio_restore(noio_flag);
|
||||
@@ -592,7 +592,7 @@ static void dmio_complete(unsigned long error, void *context)
|
||||
}
|
||||
|
||||
static void use_dmio(struct dm_buffer *b, enum req_op op, sector_t sector,
|
||||
unsigned n_sectors, unsigned offset)
|
||||
unsigned int n_sectors, unsigned int offset)
|
||||
{
|
||||
int r;
|
||||
struct dm_io_request io_req = {
|
||||
@@ -630,11 +630,11 @@ static void bio_complete(struct bio *bio)
|
||||
}
|
||||
|
||||
static void use_bio(struct dm_buffer *b, enum req_op op, sector_t sector,
|
||||
unsigned n_sectors, unsigned offset)
|
||||
unsigned int n_sectors, unsigned int offset)
|
||||
{
|
||||
struct bio *bio;
|
||||
char *ptr;
|
||||
unsigned vec_size, len;
|
||||
unsigned int vec_size, len;
|
||||
|
||||
vec_size = b->c->block_size >> PAGE_SHIFT;
|
||||
if (unlikely(b->c->sectors_per_block_bits < PAGE_SHIFT - SECTOR_SHIFT))
|
||||
@@ -655,7 +655,7 @@ dmio:
|
||||
len = n_sectors << SECTOR_SHIFT;
|
||||
|
||||
do {
|
||||
unsigned this_step = min((unsigned)(PAGE_SIZE - offset_in_page(ptr)), len);
|
||||
unsigned int this_step = min((unsigned int)(PAGE_SIZE - offset_in_page(ptr)), len);
|
||||
if (!bio_add_page(bio, virt_to_page(ptr), this_step,
|
||||
offset_in_page(ptr))) {
|
||||
bio_put(bio);
|
||||
@@ -685,9 +685,9 @@ static inline sector_t block_to_sector(struct dm_bufio_client *c, sector_t block
|
||||
static void submit_io(struct dm_buffer *b, enum req_op op,
|
||||
void (*end_io)(struct dm_buffer *, blk_status_t))
|
||||
{
|
||||
unsigned n_sectors;
|
||||
unsigned int n_sectors;
|
||||
sector_t sector;
|
||||
unsigned offset, end;
|
||||
unsigned int offset, end;
|
||||
|
||||
b->end_io = end_io;
|
||||
|
||||
@@ -1157,7 +1157,7 @@ void *dm_bufio_new(struct dm_bufio_client *c, sector_t block,
|
||||
EXPORT_SYMBOL_GPL(dm_bufio_new);
|
||||
|
||||
void dm_bufio_prefetch(struct dm_bufio_client *c,
|
||||
sector_t block, unsigned n_blocks)
|
||||
sector_t block, unsigned int n_blocks)
|
||||
{
|
||||
struct blk_plug plug;
|
||||
|
||||
@@ -1233,7 +1233,7 @@ void dm_bufio_release(struct dm_buffer *b)
|
||||
EXPORT_SYMBOL_GPL(dm_bufio_release);
|
||||
|
||||
void dm_bufio_mark_partial_buffer_dirty(struct dm_buffer *b,
|
||||
unsigned start, unsigned end)
|
||||
unsigned int start, unsigned int end)
|
||||
{
|
||||
struct dm_bufio_client *c = b->c;
|
||||
|
||||
@@ -1530,13 +1530,13 @@ void dm_bufio_forget_buffers(struct dm_bufio_client *c, sector_t block, sector_t
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_bufio_forget_buffers);
|
||||
|
||||
void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned n)
|
||||
void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned int n)
|
||||
{
|
||||
c->minimum_buffers = n;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_bufio_set_minimum_buffers);
|
||||
|
||||
unsigned dm_bufio_get_block_size(struct dm_bufio_client *c)
|
||||
unsigned int dm_bufio_get_block_size(struct dm_bufio_client *c)
|
||||
{
|
||||
return c->block_size;
|
||||
}
|
||||
@@ -1735,15 +1735,15 @@ static unsigned long dm_bufio_shrink_count(struct shrinker *shrink, struct shrin
|
||||
/*
|
||||
* Create the buffering interface
|
||||
*/
|
||||
struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsigned block_size,
|
||||
unsigned reserved_buffers, unsigned aux_size,
|
||||
struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsigned int block_size,
|
||||
unsigned int reserved_buffers, unsigned int aux_size,
|
||||
void (*alloc_callback)(struct dm_buffer *),
|
||||
void (*write_callback)(struct dm_buffer *),
|
||||
unsigned int flags)
|
||||
{
|
||||
int r;
|
||||
struct dm_bufio_client *c;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
char slab_name[27];
|
||||
|
||||
if (!block_size || block_size & ((1 << SECTOR_SHIFT) - 1)) {
|
||||
@@ -1797,7 +1797,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
|
||||
|
||||
if (block_size <= KMALLOC_MAX_SIZE &&
|
||||
(block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
|
||||
unsigned align = min(1U << __ffs(block_size), (unsigned)PAGE_SIZE);
|
||||
unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
|
||||
snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size);
|
||||
c->slab_cache = kmem_cache_create(slab_name, block_size, align,
|
||||
SLAB_RECLAIM_ACCOUNT, NULL);
|
||||
@@ -1873,7 +1873,7 @@ EXPORT_SYMBOL_GPL(dm_bufio_client_create);
|
||||
*/
|
||||
void dm_bufio_client_destroy(struct dm_bufio_client *c)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
drop_buffers(c);
|
||||
|
||||
@@ -1921,9 +1921,9 @@ void dm_bufio_set_sector_offset(struct dm_bufio_client *c, sector_t start)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_bufio_set_sector_offset);
|
||||
|
||||
static unsigned get_max_age_hz(void)
|
||||
static unsigned int get_max_age_hz(void)
|
||||
{
|
||||
unsigned max_age = READ_ONCE(dm_bufio_max_age);
|
||||
unsigned int max_age = READ_ONCE(dm_bufio_max_age);
|
||||
|
||||
if (max_age > UINT_MAX / HZ)
|
||||
max_age = UINT_MAX / HZ;
|
||||
@@ -1974,7 +1974,7 @@ static void do_global_cleanup(struct work_struct *w)
|
||||
struct dm_bufio_client *locked_client = NULL;
|
||||
struct dm_bufio_client *current_client;
|
||||
struct dm_buffer *b;
|
||||
unsigned spinlock_hold_count;
|
||||
unsigned int spinlock_hold_count;
|
||||
unsigned long threshold = dm_bufio_cache_size -
|
||||
dm_bufio_cache_size / DM_BUFIO_LOW_WATERMARK_RATIO;
|
||||
unsigned long loops = global_num * 2;
|
||||
|
||||
@@ -18,7 +18,7 @@ struct bt_work {
|
||||
};
|
||||
|
||||
struct background_tracker {
|
||||
unsigned max_work;
|
||||
unsigned int max_work;
|
||||
atomic_t pending_promotes;
|
||||
atomic_t pending_writebacks;
|
||||
atomic_t pending_demotes;
|
||||
@@ -30,7 +30,7 @@ struct background_tracker {
|
||||
struct kmem_cache *work_cache;
|
||||
};
|
||||
|
||||
struct background_tracker *btracker_create(unsigned max_work)
|
||||
struct background_tracker *btracker_create(unsigned int max_work)
|
||||
{
|
||||
struct background_tracker *b = kmalloc(sizeof(*b), GFP_KERNEL);
|
||||
|
||||
@@ -156,13 +156,13 @@ static void update_stats(struct background_tracker *b, struct policy_work *w, in
|
||||
}
|
||||
}
|
||||
|
||||
unsigned btracker_nr_writebacks_queued(struct background_tracker *b)
|
||||
unsigned int btracker_nr_writebacks_queued(struct background_tracker *b)
|
||||
{
|
||||
return atomic_read(&b->pending_writebacks);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(btracker_nr_writebacks_queued);
|
||||
|
||||
unsigned btracker_nr_demotions_queued(struct background_tracker *b)
|
||||
unsigned int btracker_nr_demotions_queued(struct background_tracker *b)
|
||||
{
|
||||
return atomic_read(&b->pending_demotes);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ struct background_tracker;
|
||||
* Create a new tracker, it will not be able to queue more than
|
||||
* 'max_work' entries.
|
||||
*/
|
||||
struct background_tracker *btracker_create(unsigned max_work);
|
||||
struct background_tracker *btracker_create(unsigned int max_work);
|
||||
|
||||
/*
|
||||
* Destroy the tracker. No issued, but not complete, work should
|
||||
@@ -42,8 +42,8 @@ struct background_tracker *btracker_create(unsigned max_work);
|
||||
*/
|
||||
void btracker_destroy(struct background_tracker *b);
|
||||
|
||||
unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
|
||||
unsigned btracker_nr_demotions_queued(struct background_tracker *b);
|
||||
unsigned int btracker_nr_writebacks_queued(struct background_tracker *b);
|
||||
unsigned int btracker_nr_demotions_queued(struct background_tracker *b);
|
||||
|
||||
/*
|
||||
* Queue some work within the tracker. 'work' should point to the work
|
||||
|
||||
@@ -105,7 +105,7 @@ struct dm_cache_metadata {
|
||||
refcount_t ref_count;
|
||||
struct list_head list;
|
||||
|
||||
unsigned version;
|
||||
unsigned int version;
|
||||
struct block_device *bdev;
|
||||
struct dm_block_manager *bm;
|
||||
struct dm_space_map *metadata_sm;
|
||||
@@ -130,7 +130,7 @@ struct dm_cache_metadata {
|
||||
bool clean_when_opened:1;
|
||||
|
||||
char policy_name[CACHE_POLICY_NAME_SIZE];
|
||||
unsigned policy_version[CACHE_POLICY_VERSION_SIZE];
|
||||
unsigned int policy_version[CACHE_POLICY_VERSION_SIZE];
|
||||
size_t policy_hint_size;
|
||||
struct dm_cache_statistics stats;
|
||||
|
||||
@@ -261,10 +261,10 @@ static int superblock_lock(struct dm_cache_metadata *cmd,
|
||||
static int __superblock_all_zeroes(struct dm_block_manager *bm, bool *result)
|
||||
{
|
||||
int r;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
struct dm_block *b;
|
||||
__le64 *data_le, zero = cpu_to_le64(0);
|
||||
unsigned sb_block_size = dm_bm_block_size(bm) / sizeof(__le64);
|
||||
unsigned int sb_block_size = dm_bm_block_size(bm) / sizeof(__le64);
|
||||
|
||||
/*
|
||||
* We can't use a validator here - it may be all zeroes.
|
||||
@@ -728,7 +728,7 @@ static int __commit_transaction(struct dm_cache_metadata *cmd,
|
||||
*/
|
||||
#define FLAGS_MASK ((1 << 16) - 1)
|
||||
|
||||
static __le64 pack_value(dm_oblock_t block, unsigned flags)
|
||||
static __le64 pack_value(dm_oblock_t block, unsigned int flags)
|
||||
{
|
||||
uint64_t value = from_oblock(block);
|
||||
value <<= 16;
|
||||
@@ -736,7 +736,7 @@ static __le64 pack_value(dm_oblock_t block, unsigned flags)
|
||||
return cpu_to_le64(value);
|
||||
}
|
||||
|
||||
static void unpack_value(__le64 value_le, dm_oblock_t *block, unsigned *flags)
|
||||
static void unpack_value(__le64 value_le, dm_oblock_t *block, unsigned int *flags)
|
||||
{
|
||||
uint64_t value = le64_to_cpu(value_le);
|
||||
uint64_t b = value >> 16;
|
||||
@@ -750,7 +750,7 @@ static struct dm_cache_metadata *metadata_open(struct block_device *bdev,
|
||||
sector_t data_block_size,
|
||||
bool may_format_device,
|
||||
size_t policy_hint_size,
|
||||
unsigned metadata_version)
|
||||
unsigned int metadata_version)
|
||||
{
|
||||
int r;
|
||||
struct dm_cache_metadata *cmd;
|
||||
@@ -811,7 +811,7 @@ static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev,
|
||||
sector_t data_block_size,
|
||||
bool may_format_device,
|
||||
size_t policy_hint_size,
|
||||
unsigned metadata_version)
|
||||
unsigned int metadata_version)
|
||||
{
|
||||
struct dm_cache_metadata *cmd, *cmd2;
|
||||
|
||||
@@ -856,7 +856,7 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
|
||||
sector_t data_block_size,
|
||||
bool may_format_device,
|
||||
size_t policy_hint_size,
|
||||
unsigned metadata_version)
|
||||
unsigned int metadata_version)
|
||||
{
|
||||
struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size, may_format_device,
|
||||
policy_hint_size, metadata_version);
|
||||
@@ -891,7 +891,7 @@ static int block_clean_combined_dirty(struct dm_cache_metadata *cmd, dm_cblock_t
|
||||
int r;
|
||||
__le64 value;
|
||||
dm_oblock_t ob;
|
||||
unsigned flags;
|
||||
unsigned int flags;
|
||||
|
||||
r = dm_array_get_value(&cmd->info, cmd->root, from_cblock(b), &value);
|
||||
if (r)
|
||||
@@ -1289,7 +1289,7 @@ static bool policy_unchanged(struct dm_cache_metadata *cmd,
|
||||
struct dm_cache_policy *policy)
|
||||
{
|
||||
const char *policy_name = dm_cache_policy_get_name(policy);
|
||||
const unsigned *policy_version = dm_cache_policy_get_version(policy);
|
||||
const unsigned int *policy_version = dm_cache_policy_get_version(policy);
|
||||
size_t policy_hint_size = dm_cache_policy_get_hint_size(policy);
|
||||
|
||||
/*
|
||||
@@ -1340,7 +1340,7 @@ static int __load_mapping_v1(struct dm_cache_metadata *cmd,
|
||||
__le32 *hint_value_le;
|
||||
|
||||
dm_oblock_t oblock;
|
||||
unsigned flags;
|
||||
unsigned int flags;
|
||||
bool dirty = true;
|
||||
|
||||
dm_array_cursor_get_value(mapping_cursor, (void **) &mapping_value_le);
|
||||
@@ -1382,7 +1382,7 @@ static int __load_mapping_v2(struct dm_cache_metadata *cmd,
|
||||
__le32 *hint_value_le;
|
||||
|
||||
dm_oblock_t oblock;
|
||||
unsigned flags;
|
||||
unsigned int flags;
|
||||
bool dirty = true;
|
||||
|
||||
dm_array_cursor_get_value(mapping_cursor, (void **) &mapping_value_le);
|
||||
@@ -1514,7 +1514,7 @@ static int __dump_mapping(void *context, uint64_t cblock, void *leaf)
|
||||
{
|
||||
__le64 value;
|
||||
dm_oblock_t oblock;
|
||||
unsigned flags;
|
||||
unsigned int flags;
|
||||
|
||||
memcpy(&value, leaf, sizeof(value));
|
||||
unpack_value(value, &oblock, &flags);
|
||||
@@ -1548,7 +1548,7 @@ int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd)
|
||||
static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty)
|
||||
{
|
||||
int r;
|
||||
unsigned flags;
|
||||
unsigned int flags;
|
||||
dm_oblock_t oblock;
|
||||
__le64 value;
|
||||
|
||||
@@ -1575,10 +1575,10 @@ static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty
|
||||
|
||||
}
|
||||
|
||||
static int __set_dirty_bits_v1(struct dm_cache_metadata *cmd, unsigned nr_bits, unsigned long *bits)
|
||||
static int __set_dirty_bits_v1(struct dm_cache_metadata *cmd, unsigned int nr_bits, unsigned long *bits)
|
||||
{
|
||||
int r;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < nr_bits; i++) {
|
||||
r = __dirty(cmd, to_cblock(i), test_bit(i, bits));
|
||||
if (r)
|
||||
@@ -1595,7 +1595,7 @@ static int is_dirty_callback(uint32_t index, bool *value, void *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __set_dirty_bits_v2(struct dm_cache_metadata *cmd, unsigned nr_bits, unsigned long *bits)
|
||||
static int __set_dirty_bits_v2(struct dm_cache_metadata *cmd, unsigned int nr_bits, unsigned long *bits)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
@@ -1614,7 +1614,7 @@ static int __set_dirty_bits_v2(struct dm_cache_metadata *cmd, unsigned nr_bits,
|
||||
}
|
||||
|
||||
int dm_cache_set_dirty_bits(struct dm_cache_metadata *cmd,
|
||||
unsigned nr_bits,
|
||||
unsigned int nr_bits,
|
||||
unsigned long *bits)
|
||||
{
|
||||
int r;
|
||||
@@ -1713,7 +1713,7 @@ static int write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *po
|
||||
int r;
|
||||
size_t hint_size;
|
||||
const char *policy_name = dm_cache_policy_get_name(policy);
|
||||
const unsigned *policy_version = dm_cache_policy_get_version(policy);
|
||||
const unsigned int *policy_version = dm_cache_policy_get_version(policy);
|
||||
|
||||
if (!policy_name[0] ||
|
||||
(strlen(policy_name) > sizeof(cmd->policy_name) - 1))
|
||||
|
||||
@@ -61,7 +61,7 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
|
||||
sector_t data_block_size,
|
||||
bool may_format_device,
|
||||
size_t policy_hint_size,
|
||||
unsigned metadata_version);
|
||||
unsigned int metadata_version);
|
||||
|
||||
void dm_cache_metadata_close(struct dm_cache_metadata *cmd);
|
||||
|
||||
@@ -97,7 +97,7 @@ int dm_cache_load_mappings(struct dm_cache_metadata *cmd,
|
||||
void *context);
|
||||
|
||||
int dm_cache_set_dirty_bits(struct dm_cache_metadata *cmd,
|
||||
unsigned nr_bits, unsigned long *bits);
|
||||
unsigned int nr_bits, unsigned long *bits);
|
||||
|
||||
struct dm_cache_statistics {
|
||||
uint32_t read_hits;
|
||||
|
||||
@@ -86,7 +86,7 @@ static inline void policy_tick(struct dm_cache_policy *p, bool can_block)
|
||||
}
|
||||
|
||||
static inline int policy_emit_config_values(struct dm_cache_policy *p, char *result,
|
||||
unsigned maxlen, ssize_t *sz_ptr)
|
||||
unsigned int maxlen, ssize_t *sz_ptr)
|
||||
{
|
||||
ssize_t sz = *sz_ptr;
|
||||
if (p->emit_config_values)
|
||||
@@ -113,18 +113,18 @@ static inline void policy_allow_migrations(struct dm_cache_policy *p, bool allow
|
||||
/*
|
||||
* Some utility functions commonly used by policies and the core target.
|
||||
*/
|
||||
static inline size_t bitset_size_in_bytes(unsigned nr_entries)
|
||||
static inline size_t bitset_size_in_bytes(unsigned int nr_entries)
|
||||
{
|
||||
return sizeof(unsigned long) * dm_div_up(nr_entries, BITS_PER_LONG);
|
||||
}
|
||||
|
||||
static inline unsigned long *alloc_bitset(unsigned nr_entries)
|
||||
static inline unsigned long *alloc_bitset(unsigned int nr_entries)
|
||||
{
|
||||
size_t s = bitset_size_in_bytes(nr_entries);
|
||||
return vzalloc(s);
|
||||
}
|
||||
|
||||
static inline void clear_bitset(void *bitset, unsigned nr_entries)
|
||||
static inline void clear_bitset(void *bitset, unsigned int nr_entries)
|
||||
{
|
||||
size_t s = bitset_size_in_bytes(nr_entries);
|
||||
memset(bitset, 0, s);
|
||||
@@ -155,7 +155,7 @@ void dm_cache_policy_destroy(struct dm_cache_policy *p);
|
||||
*/
|
||||
const char *dm_cache_policy_get_name(struct dm_cache_policy *p);
|
||||
|
||||
const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p);
|
||||
const unsigned int *dm_cache_policy_get_version(struct dm_cache_policy *p);
|
||||
|
||||
size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p);
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
/*
|
||||
* Safe division functions that return zero on divide by zero.
|
||||
*/
|
||||
static unsigned safe_div(unsigned n, unsigned d)
|
||||
static unsigned int safe_div(unsigned int n, unsigned int d)
|
||||
{
|
||||
return d ? n / d : 0u;
|
||||
}
|
||||
|
||||
static unsigned safe_mod(unsigned n, unsigned d)
|
||||
static unsigned int safe_mod(unsigned int n, unsigned int d)
|
||||
{
|
||||
return d ? n % d : 0u;
|
||||
}
|
||||
@@ -37,10 +37,10 @@ static unsigned safe_mod(unsigned n, unsigned d)
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
struct entry {
|
||||
unsigned hash_next:28;
|
||||
unsigned prev:28;
|
||||
unsigned next:28;
|
||||
unsigned level:6;
|
||||
unsigned int hash_next:28;
|
||||
unsigned int prev:28;
|
||||
unsigned int next:28;
|
||||
unsigned int level:6;
|
||||
bool dirty:1;
|
||||
bool allocated:1;
|
||||
bool sentinel:1;
|
||||
@@ -63,7 +63,7 @@ struct entry_space {
|
||||
struct entry *end;
|
||||
};
|
||||
|
||||
static int space_init(struct entry_space *es, unsigned nr_entries)
|
||||
static int space_init(struct entry_space *es, unsigned int nr_entries)
|
||||
{
|
||||
if (!nr_entries) {
|
||||
es->begin = es->end = NULL;
|
||||
@@ -83,7 +83,7 @@ static void space_exit(struct entry_space *es)
|
||||
vfree(es->begin);
|
||||
}
|
||||
|
||||
static struct entry *__get_entry(struct entry_space *es, unsigned block)
|
||||
static struct entry *__get_entry(struct entry_space *es, unsigned int block)
|
||||
{
|
||||
struct entry *e;
|
||||
|
||||
@@ -93,13 +93,13 @@ static struct entry *__get_entry(struct entry_space *es, unsigned block)
|
||||
return e;
|
||||
}
|
||||
|
||||
static unsigned to_index(struct entry_space *es, struct entry *e)
|
||||
static unsigned int to_index(struct entry_space *es, struct entry *e)
|
||||
{
|
||||
BUG_ON(e < es->begin || e >= es->end);
|
||||
return e - es->begin;
|
||||
}
|
||||
|
||||
static struct entry *to_entry(struct entry_space *es, unsigned block)
|
||||
static struct entry *to_entry(struct entry_space *es, unsigned int block)
|
||||
{
|
||||
if (block == INDEXER_NULL)
|
||||
return NULL;
|
||||
@@ -110,8 +110,8 @@ static struct entry *to_entry(struct entry_space *es, unsigned block)
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
struct ilist {
|
||||
unsigned nr_elts; /* excluding sentinel entries */
|
||||
unsigned head, tail;
|
||||
unsigned int nr_elts; /* excluding sentinel entries */
|
||||
unsigned int head, tail;
|
||||
};
|
||||
|
||||
static void l_init(struct ilist *l)
|
||||
@@ -253,23 +253,23 @@ static struct entry *l_pop_tail(struct entry_space *es, struct ilist *l)
|
||||
struct queue {
|
||||
struct entry_space *es;
|
||||
|
||||
unsigned nr_elts;
|
||||
unsigned nr_levels;
|
||||
unsigned int nr_elts;
|
||||
unsigned int nr_levels;
|
||||
struct ilist qs[MAX_LEVELS];
|
||||
|
||||
/*
|
||||
* We maintain a count of the number of entries we would like in each
|
||||
* level.
|
||||
*/
|
||||
unsigned last_target_nr_elts;
|
||||
unsigned nr_top_levels;
|
||||
unsigned nr_in_top_levels;
|
||||
unsigned target_count[MAX_LEVELS];
|
||||
unsigned int last_target_nr_elts;
|
||||
unsigned int nr_top_levels;
|
||||
unsigned int nr_in_top_levels;
|
||||
unsigned int target_count[MAX_LEVELS];
|
||||
};
|
||||
|
||||
static void q_init(struct queue *q, struct entry_space *es, unsigned nr_levels)
|
||||
static void q_init(struct queue *q, struct entry_space *es, unsigned int nr_levels)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
q->es = es;
|
||||
q->nr_elts = 0;
|
||||
@@ -285,7 +285,7 @@ static void q_init(struct queue *q, struct entry_space *es, unsigned nr_levels)
|
||||
q->nr_in_top_levels = 0u;
|
||||
}
|
||||
|
||||
static unsigned q_size(struct queue *q)
|
||||
static unsigned int q_size(struct queue *q)
|
||||
{
|
||||
return q->nr_elts;
|
||||
}
|
||||
@@ -333,9 +333,9 @@ static void q_del(struct queue *q, struct entry *e)
|
||||
/*
|
||||
* Return the oldest entry of the lowest populated level.
|
||||
*/
|
||||
static struct entry *q_peek(struct queue *q, unsigned max_level, bool can_cross_sentinel)
|
||||
static struct entry *q_peek(struct queue *q, unsigned int max_level, bool can_cross_sentinel)
|
||||
{
|
||||
unsigned level;
|
||||
unsigned int level;
|
||||
struct entry *e;
|
||||
|
||||
max_level = min(max_level, q->nr_levels);
|
||||
@@ -370,7 +370,7 @@ static struct entry *q_pop(struct queue *q)
|
||||
* used by redistribute, so we know this is true. It also doesn't adjust
|
||||
* the q->nr_elts count.
|
||||
*/
|
||||
static struct entry *__redist_pop_from(struct queue *q, unsigned level)
|
||||
static struct entry *__redist_pop_from(struct queue *q, unsigned int level)
|
||||
{
|
||||
struct entry *e;
|
||||
|
||||
@@ -384,9 +384,10 @@ static struct entry *__redist_pop_from(struct queue *q, unsigned level)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void q_set_targets_subrange_(struct queue *q, unsigned nr_elts, unsigned lbegin, unsigned lend)
|
||||
static void q_set_targets_subrange_(struct queue *q, unsigned int nr_elts,
|
||||
unsigned int lbegin, unsigned int lend)
|
||||
{
|
||||
unsigned level, nr_levels, entries_per_level, remainder;
|
||||
unsigned int level, nr_levels, entries_per_level, remainder;
|
||||
|
||||
BUG_ON(lbegin > lend);
|
||||
BUG_ON(lend > q->nr_levels);
|
||||
@@ -427,7 +428,7 @@ static void q_set_targets(struct queue *q)
|
||||
|
||||
static void q_redistribute(struct queue *q)
|
||||
{
|
||||
unsigned target, level;
|
||||
unsigned int target, level;
|
||||
struct ilist *l, *l_above;
|
||||
struct entry *e;
|
||||
|
||||
@@ -468,12 +469,12 @@ static void q_redistribute(struct queue *q)
|
||||
}
|
||||
}
|
||||
|
||||
static void q_requeue(struct queue *q, struct entry *e, unsigned extra_levels,
|
||||
static void q_requeue(struct queue *q, struct entry *e, unsigned int extra_levels,
|
||||
struct entry *s1, struct entry *s2)
|
||||
{
|
||||
struct entry *de;
|
||||
unsigned sentinels_passed = 0;
|
||||
unsigned new_level = min(q->nr_levels - 1u, e->level + extra_levels);
|
||||
unsigned int sentinels_passed = 0;
|
||||
unsigned int new_level = min(q->nr_levels - 1u, e->level + extra_levels);
|
||||
|
||||
/* try and find an entry to swap with */
|
||||
if (extra_levels && (e->level < q->nr_levels - 1u)) {
|
||||
@@ -513,9 +514,9 @@ static void q_requeue(struct queue *q, struct entry *e, unsigned extra_levels,
|
||||
#define EIGHTH (1u << (FP_SHIFT - 3u))
|
||||
|
||||
struct stats {
|
||||
unsigned hit_threshold;
|
||||
unsigned hits;
|
||||
unsigned misses;
|
||||
unsigned int hit_threshold;
|
||||
unsigned int hits;
|
||||
unsigned int misses;
|
||||
};
|
||||
|
||||
enum performance {
|
||||
@@ -524,7 +525,7 @@ enum performance {
|
||||
Q_WELL
|
||||
};
|
||||
|
||||
static void stats_init(struct stats *s, unsigned nr_levels)
|
||||
static void stats_init(struct stats *s, unsigned int nr_levels)
|
||||
{
|
||||
s->hit_threshold = (nr_levels * 3u) / 4u;
|
||||
s->hits = 0u;
|
||||
@@ -536,7 +537,7 @@ static void stats_reset(struct stats *s)
|
||||
s->hits = s->misses = 0u;
|
||||
}
|
||||
|
||||
static void stats_level_accessed(struct stats *s, unsigned level)
|
||||
static void stats_level_accessed(struct stats *s, unsigned int level)
|
||||
{
|
||||
if (level >= s->hit_threshold)
|
||||
s->hits++;
|
||||
@@ -557,7 +558,7 @@ static void stats_miss(struct stats *s)
|
||||
*/
|
||||
static enum performance stats_assess(struct stats *s)
|
||||
{
|
||||
unsigned confidence = safe_div(s->hits << FP_SHIFT, s->hits + s->misses);
|
||||
unsigned int confidence = safe_div(s->hits << FP_SHIFT, s->hits + s->misses);
|
||||
|
||||
if (confidence < SIXTEENTH)
|
||||
return Q_POOR;
|
||||
@@ -574,16 +575,16 @@ static enum performance stats_assess(struct stats *s)
|
||||
struct smq_hash_table {
|
||||
struct entry_space *es;
|
||||
unsigned long long hash_bits;
|
||||
unsigned *buckets;
|
||||
unsigned int *buckets;
|
||||
};
|
||||
|
||||
/*
|
||||
* All cache entries are stored in a chained hash table. To save space we
|
||||
* use indexing again, and only store indexes to the next entry.
|
||||
*/
|
||||
static int h_init(struct smq_hash_table *ht, struct entry_space *es, unsigned nr_entries)
|
||||
static int h_init(struct smq_hash_table *ht, struct entry_space *es, unsigned int nr_entries)
|
||||
{
|
||||
unsigned i, nr_buckets;
|
||||
unsigned int i, nr_buckets;
|
||||
|
||||
ht->es = es;
|
||||
nr_buckets = roundup_pow_of_two(max(nr_entries / 4u, 16u));
|
||||
@@ -604,7 +605,7 @@ static void h_exit(struct smq_hash_table *ht)
|
||||
vfree(ht->buckets);
|
||||
}
|
||||
|
||||
static struct entry *h_head(struct smq_hash_table *ht, unsigned bucket)
|
||||
static struct entry *h_head(struct smq_hash_table *ht, unsigned int bucket)
|
||||
{
|
||||
return to_entry(ht->es, ht->buckets[bucket]);
|
||||
}
|
||||
@@ -614,7 +615,7 @@ static struct entry *h_next(struct smq_hash_table *ht, struct entry *e)
|
||||
return to_entry(ht->es, e->hash_next);
|
||||
}
|
||||
|
||||
static void __h_insert(struct smq_hash_table *ht, unsigned bucket, struct entry *e)
|
||||
static void __h_insert(struct smq_hash_table *ht, unsigned int bucket, struct entry *e)
|
||||
{
|
||||
e->hash_next = ht->buckets[bucket];
|
||||
ht->buckets[bucket] = to_index(ht->es, e);
|
||||
@@ -622,11 +623,11 @@ static void __h_insert(struct smq_hash_table *ht, unsigned bucket, struct entry
|
||||
|
||||
static void h_insert(struct smq_hash_table *ht, struct entry *e)
|
||||
{
|
||||
unsigned h = hash_64(from_oblock(e->oblock), ht->hash_bits);
|
||||
unsigned int h = hash_64(from_oblock(e->oblock), ht->hash_bits);
|
||||
__h_insert(ht, h, e);
|
||||
}
|
||||
|
||||
static struct entry *__h_lookup(struct smq_hash_table *ht, unsigned h, dm_oblock_t oblock,
|
||||
static struct entry *__h_lookup(struct smq_hash_table *ht, unsigned int h, dm_oblock_t oblock,
|
||||
struct entry **prev)
|
||||
{
|
||||
struct entry *e;
|
||||
@@ -642,7 +643,7 @@ static struct entry *__h_lookup(struct smq_hash_table *ht, unsigned h, dm_oblock
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void __h_unlink(struct smq_hash_table *ht, unsigned h,
|
||||
static void __h_unlink(struct smq_hash_table *ht, unsigned int h,
|
||||
struct entry *e, struct entry *prev)
|
||||
{
|
||||
if (prev)
|
||||
@@ -657,7 +658,7 @@ static void __h_unlink(struct smq_hash_table *ht, unsigned h,
|
||||
static struct entry *h_lookup(struct smq_hash_table *ht, dm_oblock_t oblock)
|
||||
{
|
||||
struct entry *e, *prev;
|
||||
unsigned h = hash_64(from_oblock(oblock), ht->hash_bits);
|
||||
unsigned int h = hash_64(from_oblock(oblock), ht->hash_bits);
|
||||
|
||||
e = __h_lookup(ht, h, oblock, &prev);
|
||||
if (e && prev) {
|
||||
@@ -674,7 +675,7 @@ static struct entry *h_lookup(struct smq_hash_table *ht, dm_oblock_t oblock)
|
||||
|
||||
static void h_remove(struct smq_hash_table *ht, struct entry *e)
|
||||
{
|
||||
unsigned h = hash_64(from_oblock(e->oblock), ht->hash_bits);
|
||||
unsigned int h = hash_64(from_oblock(e->oblock), ht->hash_bits);
|
||||
struct entry *prev;
|
||||
|
||||
/*
|
||||
@@ -690,16 +691,16 @@ static void h_remove(struct smq_hash_table *ht, struct entry *e)
|
||||
|
||||
struct entry_alloc {
|
||||
struct entry_space *es;
|
||||
unsigned begin;
|
||||
unsigned int begin;
|
||||
|
||||
unsigned nr_allocated;
|
||||
unsigned int nr_allocated;
|
||||
struct ilist free;
|
||||
};
|
||||
|
||||
static void init_allocator(struct entry_alloc *ea, struct entry_space *es,
|
||||
unsigned begin, unsigned end)
|
||||
unsigned int begin, unsigned int end)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
ea->es = es;
|
||||
ea->nr_allocated = 0u;
|
||||
@@ -743,7 +744,7 @@ static struct entry *alloc_entry(struct entry_alloc *ea)
|
||||
/*
|
||||
* This assumes the cblock hasn't already been allocated.
|
||||
*/
|
||||
static struct entry *alloc_particular_entry(struct entry_alloc *ea, unsigned i)
|
||||
static struct entry *alloc_particular_entry(struct entry_alloc *ea, unsigned int i)
|
||||
{
|
||||
struct entry *e = __get_entry(ea->es, ea->begin + i);
|
||||
|
||||
@@ -771,12 +772,12 @@ static bool allocator_empty(struct entry_alloc *ea)
|
||||
return l_empty(&ea->free);
|
||||
}
|
||||
|
||||
static unsigned get_index(struct entry_alloc *ea, struct entry *e)
|
||||
static unsigned int get_index(struct entry_alloc *ea, struct entry *e)
|
||||
{
|
||||
return to_index(ea->es, e) - ea->begin;
|
||||
}
|
||||
|
||||
static struct entry *get_entry(struct entry_alloc *ea, unsigned index)
|
||||
static struct entry *get_entry(struct entry_alloc *ea, unsigned int index)
|
||||
{
|
||||
return __get_entry(ea->es, ea->begin + index);
|
||||
}
|
||||
@@ -801,9 +802,9 @@ struct smq_policy {
|
||||
sector_t cache_block_size;
|
||||
|
||||
sector_t hotspot_block_size;
|
||||
unsigned nr_hotspot_blocks;
|
||||
unsigned cache_blocks_per_hotspot_block;
|
||||
unsigned hotspot_level_jump;
|
||||
unsigned int nr_hotspot_blocks;
|
||||
unsigned int cache_blocks_per_hotspot_block;
|
||||
unsigned int hotspot_level_jump;
|
||||
|
||||
struct entry_space es;
|
||||
struct entry_alloc writeback_sentinel_alloc;
|
||||
@@ -832,7 +833,7 @@ struct smq_policy {
|
||||
* Keeps track of time, incremented by the core. We use this to
|
||||
* avoid attributing multiple hits within the same tick.
|
||||
*/
|
||||
unsigned tick;
|
||||
unsigned int tick;
|
||||
|
||||
/*
|
||||
* The hash tables allows us to quickly find an entry by origin
|
||||
@@ -847,8 +848,8 @@ struct smq_policy {
|
||||
bool current_demote_sentinels;
|
||||
unsigned long next_demote_period;
|
||||
|
||||
unsigned write_promote_level;
|
||||
unsigned read_promote_level;
|
||||
unsigned int write_promote_level;
|
||||
unsigned int read_promote_level;
|
||||
|
||||
unsigned long next_hotspot_period;
|
||||
unsigned long next_cache_period;
|
||||
@@ -860,24 +861,24 @@ struct smq_policy {
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
static struct entry *get_sentinel(struct entry_alloc *ea, unsigned level, bool which)
|
||||
static struct entry *get_sentinel(struct entry_alloc *ea, unsigned int level, bool which)
|
||||
{
|
||||
return get_entry(ea, which ? level : NR_CACHE_LEVELS + level);
|
||||
}
|
||||
|
||||
static struct entry *writeback_sentinel(struct smq_policy *mq, unsigned level)
|
||||
static struct entry *writeback_sentinel(struct smq_policy *mq, unsigned int level)
|
||||
{
|
||||
return get_sentinel(&mq->writeback_sentinel_alloc, level, mq->current_writeback_sentinels);
|
||||
}
|
||||
|
||||
static struct entry *demote_sentinel(struct smq_policy *mq, unsigned level)
|
||||
static struct entry *demote_sentinel(struct smq_policy *mq, unsigned int level)
|
||||
{
|
||||
return get_sentinel(&mq->demote_sentinel_alloc, level, mq->current_demote_sentinels);
|
||||
}
|
||||
|
||||
static void __update_writeback_sentinels(struct smq_policy *mq)
|
||||
{
|
||||
unsigned level;
|
||||
unsigned int level;
|
||||
struct queue *q = &mq->dirty;
|
||||
struct entry *sentinel;
|
||||
|
||||
@@ -890,7 +891,7 @@ static void __update_writeback_sentinels(struct smq_policy *mq)
|
||||
|
||||
static void __update_demote_sentinels(struct smq_policy *mq)
|
||||
{
|
||||
unsigned level;
|
||||
unsigned int level;
|
||||
struct queue *q = &mq->clean;
|
||||
struct entry *sentinel;
|
||||
|
||||
@@ -918,7 +919,7 @@ static void update_sentinels(struct smq_policy *mq)
|
||||
|
||||
static void __sentinels_init(struct smq_policy *mq)
|
||||
{
|
||||
unsigned level;
|
||||
unsigned int level;
|
||||
struct entry *sentinel;
|
||||
|
||||
for (level = 0; level < NR_CACHE_LEVELS; level++) {
|
||||
@@ -1009,7 +1010,7 @@ static void requeue(struct smq_policy *mq, struct entry *e)
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned default_promote_level(struct smq_policy *mq)
|
||||
static unsigned int default_promote_level(struct smq_policy *mq)
|
||||
{
|
||||
/*
|
||||
* The promote level depends on the current performance of the
|
||||
@@ -1031,9 +1032,9 @@ static unsigned default_promote_level(struct smq_policy *mq)
|
||||
1, 1, 1, 2, 4, 6, 7, 8, 7, 6, 4, 4, 3, 3, 2, 2, 1
|
||||
};
|
||||
|
||||
unsigned hits = mq->cache_stats.hits;
|
||||
unsigned misses = mq->cache_stats.misses;
|
||||
unsigned index = safe_div(hits << 4u, hits + misses);
|
||||
unsigned int hits = mq->cache_stats.hits;
|
||||
unsigned int misses = mq->cache_stats.misses;
|
||||
unsigned int index = safe_div(hits << 4u, hits + misses);
|
||||
return table[index];
|
||||
}
|
||||
|
||||
@@ -1043,7 +1044,7 @@ static void update_promote_levels(struct smq_policy *mq)
|
||||
* If there are unused cache entries then we want to be really
|
||||
* eager to promote.
|
||||
*/
|
||||
unsigned threshold_level = allocator_empty(&mq->cache_alloc) ?
|
||||
unsigned int threshold_level = allocator_empty(&mq->cache_alloc) ?
|
||||
default_promote_level(mq) : (NR_HOTSPOT_LEVELS / 2u);
|
||||
|
||||
threshold_level = max(threshold_level, NR_HOTSPOT_LEVELS);
|
||||
@@ -1125,7 +1126,7 @@ static void end_cache_period(struct smq_policy *mq)
|
||||
#define CLEAN_TARGET 25u
|
||||
#define FREE_TARGET 25u
|
||||
|
||||
static unsigned percent_to_target(struct smq_policy *mq, unsigned p)
|
||||
static unsigned int percent_to_target(struct smq_policy *mq, unsigned int p)
|
||||
{
|
||||
return from_cblock(mq->cache_size) * p / 100u;
|
||||
}
|
||||
@@ -1151,7 +1152,7 @@ static bool clean_target_met(struct smq_policy *mq, bool idle)
|
||||
|
||||
static bool free_target_met(struct smq_policy *mq)
|
||||
{
|
||||
unsigned nr_free;
|
||||
unsigned int nr_free;
|
||||
|
||||
nr_free = from_cblock(mq->cache_size) - mq->cache_alloc.nr_allocated;
|
||||
return (nr_free + btracker_nr_demotions_queued(mq->bg_work)) >=
|
||||
@@ -1301,7 +1302,7 @@ static dm_oblock_t to_hblock(struct smq_policy *mq, dm_oblock_t b)
|
||||
|
||||
static struct entry *update_hotspot_queue(struct smq_policy *mq, dm_oblock_t b)
|
||||
{
|
||||
unsigned hi;
|
||||
unsigned int hi;
|
||||
dm_oblock_t hb = to_hblock(mq, b);
|
||||
struct entry *e = h_lookup(&mq->hotspot_table, hb);
|
||||
|
||||
@@ -1550,7 +1551,7 @@ static void smq_clear_dirty(struct dm_cache_policy *p, dm_cblock_t cblock)
|
||||
spin_unlock_irqrestore(&mq->lock, flags);
|
||||
}
|
||||
|
||||
static unsigned random_level(dm_cblock_t cblock)
|
||||
static unsigned int random_level(dm_cblock_t cblock)
|
||||
{
|
||||
return hash_32(from_cblock(cblock), 9) & (NR_CACHE_LEVELS - 1);
|
||||
}
|
||||
@@ -1661,7 +1662,7 @@ static int mq_set_config_value(struct dm_cache_policy *p,
|
||||
}
|
||||
|
||||
static int mq_emit_config_values(struct dm_cache_policy *p, char *result,
|
||||
unsigned maxlen, ssize_t *sz_ptr)
|
||||
unsigned int maxlen, ssize_t *sz_ptr)
|
||||
{
|
||||
ssize_t sz = *sz_ptr;
|
||||
|
||||
@@ -1700,16 +1701,16 @@ static void init_policy_functions(struct smq_policy *mq, bool mimic_mq)
|
||||
|
||||
static bool too_many_hotspot_blocks(sector_t origin_size,
|
||||
sector_t hotspot_block_size,
|
||||
unsigned nr_hotspot_blocks)
|
||||
unsigned int nr_hotspot_blocks)
|
||||
{
|
||||
return (hotspot_block_size * nr_hotspot_blocks) > origin_size;
|
||||
}
|
||||
|
||||
static void calc_hotspot_params(sector_t origin_size,
|
||||
sector_t cache_block_size,
|
||||
unsigned nr_cache_blocks,
|
||||
unsigned int nr_cache_blocks,
|
||||
sector_t *hotspot_block_size,
|
||||
unsigned *nr_hotspot_blocks)
|
||||
unsigned int *nr_hotspot_blocks)
|
||||
{
|
||||
*hotspot_block_size = cache_block_size * 16u;
|
||||
*nr_hotspot_blocks = max(nr_cache_blocks / 4u, 1024u);
|
||||
@@ -1725,9 +1726,9 @@ static struct dm_cache_policy *__smq_create(dm_cblock_t cache_size,
|
||||
bool mimic_mq,
|
||||
bool migrations_allowed)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned nr_sentinels_per_queue = 2u * NR_CACHE_LEVELS;
|
||||
unsigned total_sentinels = 2u * nr_sentinels_per_queue;
|
||||
unsigned int i;
|
||||
unsigned int nr_sentinels_per_queue = 2u * NR_CACHE_LEVELS;
|
||||
unsigned int total_sentinels = 2u * nr_sentinels_per_queue;
|
||||
struct smq_policy *mq = kzalloc(sizeof(*mq), GFP_KERNEL);
|
||||
|
||||
if (!mq)
|
||||
|
||||
@@ -155,7 +155,7 @@ const char *dm_cache_policy_get_name(struct dm_cache_policy *p)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_cache_policy_get_name);
|
||||
|
||||
const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p)
|
||||
const unsigned int *dm_cache_policy_get_version(struct dm_cache_policy *p)
|
||||
{
|
||||
struct dm_cache_policy_type *t = p->private;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ struct dm_cache_policy {
|
||||
* Configuration.
|
||||
*/
|
||||
int (*emit_config_values)(struct dm_cache_policy *p, char *result,
|
||||
unsigned maxlen, ssize_t *sz_ptr);
|
||||
unsigned int maxlen, ssize_t *sz_ptr);
|
||||
int (*set_config_value)(struct dm_cache_policy *p,
|
||||
const char *key, const char *value);
|
||||
|
||||
@@ -158,7 +158,7 @@ struct dm_cache_policy_type {
|
||||
* what gets passed on the target line to select your policy.
|
||||
*/
|
||||
char name[CACHE_POLICY_NAME_SIZE];
|
||||
unsigned version[CACHE_POLICY_VERSION_SIZE];
|
||||
unsigned int version[CACHE_POLICY_VERSION_SIZE];
|
||||
|
||||
/*
|
||||
* For use by an alias dm_cache_policy_type to point to the
|
||||
|
||||
@@ -276,7 +276,7 @@ enum cache_io_mode {
|
||||
struct cache_features {
|
||||
enum cache_metadata_mode mode;
|
||||
enum cache_io_mode io_mode;
|
||||
unsigned metadata_version;
|
||||
unsigned int metadata_version;
|
||||
bool discard_passdown:1;
|
||||
};
|
||||
|
||||
@@ -363,7 +363,7 @@ struct cache {
|
||||
* Rather than reconstructing the table line for the status we just
|
||||
* save it and regurgitate.
|
||||
*/
|
||||
unsigned nr_ctr_args;
|
||||
unsigned int nr_ctr_args;
|
||||
const char **ctr_args;
|
||||
|
||||
struct dm_kcopyd_client *copier;
|
||||
@@ -379,7 +379,7 @@ struct cache {
|
||||
unsigned long *dirty_bitset;
|
||||
atomic_t nr_dirty;
|
||||
|
||||
unsigned policy_nr_args;
|
||||
unsigned int policy_nr_args;
|
||||
struct dm_cache_policy *policy;
|
||||
|
||||
/*
|
||||
@@ -410,7 +410,7 @@ struct cache {
|
||||
|
||||
struct per_bio_data {
|
||||
bool tick:1;
|
||||
unsigned req_nr:2;
|
||||
unsigned int req_nr:2;
|
||||
struct dm_bio_prison_cell_v2 *cell;
|
||||
struct dm_hook_info hook_info;
|
||||
sector_t len;
|
||||
@@ -518,7 +518,7 @@ static void build_key(dm_oblock_t begin, dm_oblock_t end, struct dm_cell_key_v2
|
||||
#define WRITE_LOCK_LEVEL 0
|
||||
#define READ_WRITE_LOCK_LEVEL 1
|
||||
|
||||
static unsigned lock_level(struct bio *bio)
|
||||
static unsigned int lock_level(struct bio *bio)
|
||||
{
|
||||
return bio_data_dir(bio) == WRITE ?
|
||||
WRITE_LOCK_LEVEL :
|
||||
@@ -1881,7 +1881,7 @@ static void check_migrations(struct work_struct *ws)
|
||||
*/
|
||||
static void destroy(struct cache *cache)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
mempool_exit(&cache->migration_pool);
|
||||
|
||||
@@ -2121,7 +2121,7 @@ static int parse_features(struct cache_args *ca, struct dm_arg_set *as,
|
||||
};
|
||||
|
||||
int r, mode_ctr = 0;
|
||||
unsigned argc;
|
||||
unsigned int argc;
|
||||
const char *arg;
|
||||
struct cache_features *cf = &ca->features;
|
||||
|
||||
@@ -2541,7 +2541,7 @@ bad:
|
||||
|
||||
static int copy_ctr_args(struct cache *cache, int argc, const char **argv)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
const char **copy;
|
||||
|
||||
copy = kcalloc(argc, sizeof(*copy), GFP_KERNEL);
|
||||
@@ -2563,7 +2563,7 @@ static int copy_ctr_args(struct cache *cache, int argc, const char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cache_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
||||
static int cache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
{
|
||||
int r = -EINVAL;
|
||||
struct cache_args *ca;
|
||||
@@ -2666,7 +2666,7 @@ static int write_dirty_bitset(struct cache *cache)
|
||||
|
||||
static int write_discard_bitset(struct cache *cache)
|
||||
{
|
||||
unsigned i, r;
|
||||
unsigned int i, r;
|
||||
|
||||
if (get_cache_mode(cache) >= CM_READ_ONLY)
|
||||
return -EINVAL;
|
||||
@@ -2980,11 +2980,11 @@ static void cache_resume(struct dm_target *ti)
|
||||
}
|
||||
|
||||
static void emit_flags(struct cache *cache, char *result,
|
||||
unsigned maxlen, ssize_t *sz_ptr)
|
||||
unsigned int maxlen, ssize_t *sz_ptr)
|
||||
{
|
||||
ssize_t sz = *sz_ptr;
|
||||
struct cache_features *cf = &cache->features;
|
||||
unsigned count = (cf->metadata_version == 2) + !cf->discard_passdown + 1;
|
||||
unsigned int count = (cf->metadata_version == 2) + !cf->discard_passdown + 1;
|
||||
|
||||
DMEMIT("%u ", count);
|
||||
|
||||
@@ -3024,10 +3024,10 @@ static void emit_flags(struct cache *cache, char *result,
|
||||
* <policy name> <#policy args> <policy args>* <cache metadata mode> <needs_check>
|
||||
*/
|
||||
static void cache_status(struct dm_target *ti, status_type_t type,
|
||||
unsigned status_flags, char *result, unsigned maxlen)
|
||||
unsigned int status_flags, char *result, unsigned int maxlen)
|
||||
{
|
||||
int r = 0;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
ssize_t sz = 0;
|
||||
dm_block_t nr_free_blocks_metadata = 0;
|
||||
dm_block_t nr_blocks_metadata = 0;
|
||||
@@ -3064,18 +3064,18 @@ static void cache_status(struct dm_target *ti, status_type_t type,
|
||||
residency = policy_residency(cache->policy);
|
||||
|
||||
DMEMIT("%u %llu/%llu %llu %llu/%llu %u %u %u %u %u %u %lu ",
|
||||
(unsigned)DM_CACHE_METADATA_BLOCK_SIZE,
|
||||
(unsigned int)DM_CACHE_METADATA_BLOCK_SIZE,
|
||||
(unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata),
|
||||
(unsigned long long)nr_blocks_metadata,
|
||||
(unsigned long long)cache->sectors_per_block,
|
||||
(unsigned long long) from_cblock(residency),
|
||||
(unsigned long long) from_cblock(cache->cache_size),
|
||||
(unsigned) atomic_read(&cache->stats.read_hit),
|
||||
(unsigned) atomic_read(&cache->stats.read_miss),
|
||||
(unsigned) atomic_read(&cache->stats.write_hit),
|
||||
(unsigned) atomic_read(&cache->stats.write_miss),
|
||||
(unsigned) atomic_read(&cache->stats.demotion),
|
||||
(unsigned) atomic_read(&cache->stats.promotion),
|
||||
(unsigned int) atomic_read(&cache->stats.read_hit),
|
||||
(unsigned int) atomic_read(&cache->stats.read_miss),
|
||||
(unsigned int) atomic_read(&cache->stats.write_hit),
|
||||
(unsigned int) atomic_read(&cache->stats.write_miss),
|
||||
(unsigned int) atomic_read(&cache->stats.demotion),
|
||||
(unsigned int) atomic_read(&cache->stats.promotion),
|
||||
(unsigned long) atomic_read(&cache->nr_dirty));
|
||||
|
||||
emit_flags(cache, result, maxlen, &sz);
|
||||
@@ -3254,11 +3254,11 @@ static int request_invalidation(struct cache *cache, struct cblock_range *range)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int process_invalidate_cblocks_message(struct cache *cache, unsigned count,
|
||||
static int process_invalidate_cblocks_message(struct cache *cache, unsigned int count,
|
||||
const char **cblock_ranges)
|
||||
{
|
||||
int r = 0;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
struct cblock_range range;
|
||||
|
||||
if (!passthrough_mode(cache)) {
|
||||
@@ -3295,8 +3295,8 @@ static int process_invalidate_cblocks_message(struct cache *cache, unsigned coun
|
||||
*
|
||||
* The key migration_threshold is supported by the cache target core.
|
||||
*/
|
||||
static int cache_message(struct dm_target *ti, unsigned argc, char **argv,
|
||||
char *result, unsigned maxlen)
|
||||
static int cache_message(struct dm_target *ti, unsigned int argc, char **argv,
|
||||
char *result, unsigned int maxlen)
|
||||
{
|
||||
struct cache *cache = ti->private;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ struct mapped_device {
|
||||
struct dm_stats stats;
|
||||
|
||||
/* the number of internal suspends */
|
||||
unsigned internal_suspend_count;
|
||||
unsigned int internal_suspend_count;
|
||||
|
||||
int swap_bios;
|
||||
struct semaphore swap_bios_semaphore;
|
||||
@@ -327,9 +327,9 @@ static inline struct completion *dm_get_completion_from_kobject(struct kobject *
|
||||
return &container_of(kobj, struct dm_kobject_holder, kobj)->completion;
|
||||
}
|
||||
|
||||
unsigned __dm_get_module_param(unsigned *module_param, unsigned def, unsigned max);
|
||||
unsigned int __dm_get_module_param(unsigned int *module_param, unsigned int def, unsigned int max);
|
||||
|
||||
static inline bool dm_message_test_buffer_overflow(char *result, unsigned maxlen)
|
||||
static inline bool dm_message_test_buffer_overflow(char *result, unsigned int maxlen)
|
||||
{
|
||||
return !maxlen || strlen(result) + 1 >= maxlen;
|
||||
}
|
||||
|
||||
+24
-24
@@ -172,14 +172,14 @@ struct crypt_config {
|
||||
} iv_gen_private;
|
||||
u64 iv_offset;
|
||||
unsigned int iv_size;
|
||||
unsigned short int sector_size;
|
||||
unsigned short sector_size;
|
||||
unsigned char sector_shift;
|
||||
|
||||
union {
|
||||
struct crypto_skcipher **tfms;
|
||||
struct crypto_aead **tfms_aead;
|
||||
} cipher_tfm;
|
||||
unsigned tfms_count;
|
||||
unsigned int tfms_count;
|
||||
unsigned long cipher_flags;
|
||||
|
||||
/*
|
||||
@@ -213,7 +213,7 @@ struct crypt_config {
|
||||
* pool for per bio private data, crypto requests,
|
||||
* encryption requeusts/buffer pages and integrity tags
|
||||
*/
|
||||
unsigned tag_pool_max_sectors;
|
||||
unsigned int tag_pool_max_sectors;
|
||||
mempool_t tag_pool;
|
||||
mempool_t req_pool;
|
||||
mempool_t page_pool;
|
||||
@@ -230,7 +230,7 @@ struct crypt_config {
|
||||
#define POOL_ENTRY_SIZE 512
|
||||
|
||||
static DEFINE_SPINLOCK(dm_crypt_clients_lock);
|
||||
static unsigned dm_crypt_clients_n = 0;
|
||||
static unsigned int dm_crypt_clients_n = 0;
|
||||
static volatile unsigned long dm_crypt_pages_per_client;
|
||||
#define DM_CRYPT_MEMORY_PERCENT 2
|
||||
#define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_VECS * 16)
|
||||
@@ -355,7 +355,7 @@ static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv,
|
||||
static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti,
|
||||
const char *opts)
|
||||
{
|
||||
unsigned bs;
|
||||
unsigned int bs;
|
||||
int log;
|
||||
|
||||
if (crypt_integrity_aead(cc))
|
||||
@@ -1465,7 +1465,7 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
|
||||
static int crypt_alloc_req_skcipher(struct crypt_config *cc,
|
||||
struct convert_context *ctx)
|
||||
{
|
||||
unsigned key_index = ctx->cc_sector & (cc->tfms_count - 1);
|
||||
unsigned int key_index = ctx->cc_sector & (cc->tfms_count - 1);
|
||||
|
||||
if (!ctx->r.req) {
|
||||
ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO);
|
||||
@@ -1659,13 +1659,13 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone);
|
||||
* non-blocking allocations without a mutex first but on failure we fallback
|
||||
* to blocking allocations with a mutex.
|
||||
*/
|
||||
static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
|
||||
static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned int size)
|
||||
{
|
||||
struct crypt_config *cc = io->cc;
|
||||
struct bio *clone;
|
||||
unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||
gfp_t gfp_mask = GFP_NOWAIT | __GFP_HIGHMEM;
|
||||
unsigned i, len, remaining_size;
|
||||
unsigned int i, len, remaining_size;
|
||||
struct page *page;
|
||||
|
||||
retry:
|
||||
@@ -1805,7 +1805,7 @@ static void crypt_endio(struct bio *clone)
|
||||
{
|
||||
struct dm_crypt_io *io = clone->bi_private;
|
||||
struct crypt_config *cc = io->cc;
|
||||
unsigned rw = bio_data_dir(clone);
|
||||
unsigned int rw = bio_data_dir(clone);
|
||||
blk_status_t error;
|
||||
|
||||
/*
|
||||
@@ -2258,7 +2258,7 @@ static void crypt_free_tfms_aead(struct crypt_config *cc)
|
||||
|
||||
static void crypt_free_tfms_skcipher(struct crypt_config *cc)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
if (!cc->cipher_tfm.tfms)
|
||||
return;
|
||||
@@ -2283,7 +2283,7 @@ static void crypt_free_tfms(struct crypt_config *cc)
|
||||
|
||||
static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int err;
|
||||
|
||||
cc->cipher_tfm.tfms = kcalloc(cc->tfms_count,
|
||||
@@ -2341,12 +2341,12 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)
|
||||
return crypt_alloc_tfms_skcipher(cc, ciphermode);
|
||||
}
|
||||
|
||||
static unsigned crypt_subkey_size(struct crypt_config *cc)
|
||||
static unsigned int crypt_subkey_size(struct crypt_config *cc)
|
||||
{
|
||||
return (cc->key_size - cc->key_extra_size) >> ilog2(cc->tfms_count);
|
||||
}
|
||||
|
||||
static unsigned crypt_authenckey_size(struct crypt_config *cc)
|
||||
static unsigned int crypt_authenckey_size(struct crypt_config *cc)
|
||||
{
|
||||
return crypt_subkey_size(cc) + RTA_SPACE(sizeof(struct crypto_authenc_key_param));
|
||||
}
|
||||
@@ -2357,7 +2357,7 @@ static unsigned crypt_authenckey_size(struct crypt_config *cc)
|
||||
* This funcion converts cc->key to this special format.
|
||||
*/
|
||||
static void crypt_copy_authenckey(char *p, const void *key,
|
||||
unsigned enckeylen, unsigned authkeylen)
|
||||
unsigned int enckeylen, unsigned int authkeylen)
|
||||
{
|
||||
struct crypto_authenc_key_param *param;
|
||||
struct rtattr *rta;
|
||||
@@ -2375,7 +2375,7 @@ static void crypt_copy_authenckey(char *p, const void *key,
|
||||
|
||||
static int crypt_setkey(struct crypt_config *cc)
|
||||
{
|
||||
unsigned subkey_size;
|
||||
unsigned int subkey_size;
|
||||
int err = 0, i, r;
|
||||
|
||||
/* Ignore extra keys (which are used for IV etc) */
|
||||
@@ -3414,7 +3414,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio)
|
||||
crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector));
|
||||
|
||||
if (cc->on_disk_tag_size) {
|
||||
unsigned tag_len = cc->on_disk_tag_size * (bio_sectors(bio) >> cc->sector_shift);
|
||||
unsigned int tag_len = cc->on_disk_tag_size * (bio_sectors(bio) >> cc->sector_shift);
|
||||
|
||||
if (unlikely(tag_len > KMALLOC_MAX_SIZE) ||
|
||||
unlikely(!(io->integrity_metadata = kmalloc(tag_len,
|
||||
@@ -3442,14 +3442,14 @@ static int crypt_map(struct dm_target *ti, struct bio *bio)
|
||||
|
||||
static char hex2asc(unsigned char c)
|
||||
{
|
||||
return c + '0' + ((unsigned)(9 - c) >> 4 & 0x27);
|
||||
return c + '0' + ((unsigned int)(9 - c) >> 4 & 0x27);
|
||||
}
|
||||
|
||||
static void crypt_status(struct dm_target *ti, status_type_t type,
|
||||
unsigned status_flags, char *result, unsigned maxlen)
|
||||
unsigned int status_flags, char *result, unsigned int maxlen)
|
||||
{
|
||||
struct crypt_config *cc = ti->private;
|
||||
unsigned i, sz = 0;
|
||||
unsigned int i, sz = 0;
|
||||
int num_feature_args = 0;
|
||||
|
||||
switch (type) {
|
||||
@@ -3565,8 +3565,8 @@ static void crypt_resume(struct dm_target *ti)
|
||||
* key set <key>
|
||||
* key wipe
|
||||
*/
|
||||
static int crypt_message(struct dm_target *ti, unsigned argc, char **argv,
|
||||
char *result, unsigned maxlen)
|
||||
static int crypt_message(struct dm_target *ti, unsigned int argc, char **argv,
|
||||
char *result, unsigned int maxlen)
|
||||
{
|
||||
struct crypt_config *cc = ti->private;
|
||||
int key_size, ret = -EINVAL;
|
||||
@@ -3627,10 +3627,10 @@ static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
||||
limits->max_segment_size = PAGE_SIZE;
|
||||
|
||||
limits->logical_block_size =
|
||||
max_t(unsigned, limits->logical_block_size, cc->sector_size);
|
||||
max_t(unsigned int, limits->logical_block_size, cc->sector_size);
|
||||
limits->physical_block_size =
|
||||
max_t(unsigned, limits->physical_block_size, cc->sector_size);
|
||||
limits->io_min = max_t(unsigned, limits->io_min, cc->sector_size);
|
||||
max_t(unsigned int, limits->physical_block_size, cc->sector_size);
|
||||
limits->io_min = max_t(unsigned int, limits->io_min, cc->sector_size);
|
||||
limits->dma_alignment = limits->logical_block_size - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
struct delay_class {
|
||||
struct dm_dev *dev;
|
||||
sector_t start;
|
||||
unsigned delay;
|
||||
unsigned ops;
|
||||
unsigned int delay;
|
||||
unsigned int ops;
|
||||
};
|
||||
|
||||
struct delay_c {
|
||||
@@ -306,7 +306,7 @@ static int delay_map(struct dm_target *ti, struct bio *bio)
|
||||
DMEMIT("%s %llu %u", (c)->dev->name, (unsigned long long)(c)->start, (c)->delay)
|
||||
|
||||
static void delay_status(struct dm_target *ti, status_type_t type,
|
||||
unsigned status_flags, char *result, unsigned maxlen)
|
||||
unsigned int status_flags, char *result, unsigned int maxlen)
|
||||
{
|
||||
struct delay_c *dc = ti->private;
|
||||
int sz = 0;
|
||||
|
||||
@@ -391,7 +391,7 @@ static int ebs_map(struct dm_target *ti, struct bio *bio)
|
||||
}
|
||||
|
||||
static void ebs_status(struct dm_target *ti, status_type_t type,
|
||||
unsigned status_flags, char *result, unsigned maxlen)
|
||||
unsigned int status_flags, char *result, unsigned int maxlen)
|
||||
{
|
||||
struct ebs_c *ec = ti->private;
|
||||
|
||||
|
||||
+16
-16
@@ -51,7 +51,7 @@ static void writeset_free(struct writeset *ws)
|
||||
}
|
||||
|
||||
static int setup_on_disk_bitset(struct dm_disk_bitset *info,
|
||||
unsigned nr_bits, dm_block_t *root)
|
||||
unsigned int nr_bits, dm_block_t *root)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -62,7 +62,7 @@ static int setup_on_disk_bitset(struct dm_disk_bitset *info,
|
||||
return dm_bitset_resize(info, *root, 0, nr_bits, false, root);
|
||||
}
|
||||
|
||||
static size_t bitset_size(unsigned nr_bits)
|
||||
static size_t bitset_size(unsigned int nr_bits)
|
||||
{
|
||||
return sizeof(unsigned long) * dm_div_up(nr_bits, BITS_PER_LONG);
|
||||
}
|
||||
@@ -323,10 +323,10 @@ static int superblock_lock(struct era_metadata *md,
|
||||
static int superblock_all_zeroes(struct dm_block_manager *bm, bool *result)
|
||||
{
|
||||
int r;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
struct dm_block *b;
|
||||
__le64 *data_le, zero = cpu_to_le64(0);
|
||||
unsigned sb_block_size = dm_bm_block_size(bm) / sizeof(__le64);
|
||||
unsigned int sb_block_size = dm_bm_block_size(bm) / sizeof(__le64);
|
||||
|
||||
/*
|
||||
* We can't use a validator here - it may be all zeroes.
|
||||
@@ -363,12 +363,12 @@ static void ws_unpack(const struct writeset_disk *disk, struct writeset_metadata
|
||||
core->root = le64_to_cpu(disk->root);
|
||||
}
|
||||
|
||||
static void ws_inc(void *context, const void *value, unsigned count)
|
||||
static void ws_inc(void *context, const void *value, unsigned int count)
|
||||
{
|
||||
struct era_metadata *md = context;
|
||||
struct writeset_disk ws_d;
|
||||
dm_block_t b;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
memcpy(&ws_d, value + (i * sizeof(ws_d)), sizeof(ws_d));
|
||||
@@ -377,12 +377,12 @@ static void ws_inc(void *context, const void *value, unsigned count)
|
||||
}
|
||||
}
|
||||
|
||||
static void ws_dec(void *context, const void *value, unsigned count)
|
||||
static void ws_dec(void *context, const void *value, unsigned int count)
|
||||
{
|
||||
struct era_metadata *md = context;
|
||||
struct writeset_disk ws_d;
|
||||
dm_block_t b;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
memcpy(&ws_d, value + (i * sizeof(ws_d)), sizeof(ws_d));
|
||||
@@ -667,7 +667,7 @@ static void swap_writeset(struct era_metadata *md, struct writeset *new_writeset
|
||||
*--------------------------------------------------------------*/
|
||||
struct digest {
|
||||
uint32_t era;
|
||||
unsigned nr_bits, current_bit;
|
||||
unsigned int nr_bits, current_bit;
|
||||
struct writeset_metadata writeset;
|
||||
__le32 value;
|
||||
struct dm_disk_bitset info;
|
||||
@@ -702,7 +702,7 @@ static int metadata_digest_transcribe_writeset(struct era_metadata *md,
|
||||
{
|
||||
int r;
|
||||
bool marked;
|
||||
unsigned b, e = min(d->current_bit + INSERTS_PER_STEP, d->nr_bits);
|
||||
unsigned int b, e = min(d->current_bit + INSERTS_PER_STEP, d->nr_bits);
|
||||
|
||||
for (b = d->current_bit; b < e; b++) {
|
||||
r = writeset_marked_on_disk(&d->info, &d->writeset, b, &marked);
|
||||
@@ -1439,7 +1439,7 @@ static bool valid_block_size(dm_block_t block_size)
|
||||
/*
|
||||
* <metadata dev> <data dev> <data block size (sectors)>
|
||||
*/
|
||||
static int era_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
||||
static int era_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
{
|
||||
int r;
|
||||
char dummy;
|
||||
@@ -1618,7 +1618,7 @@ static int era_preresume(struct dm_target *ti)
|
||||
* <current era> <held metadata root | '-'>
|
||||
*/
|
||||
static void era_status(struct dm_target *ti, status_type_t type,
|
||||
unsigned status_flags, char *result, unsigned maxlen)
|
||||
unsigned int status_flags, char *result, unsigned int maxlen)
|
||||
{
|
||||
int r;
|
||||
struct era *era = ti->private;
|
||||
@@ -1633,10 +1633,10 @@ static void era_status(struct dm_target *ti, status_type_t type,
|
||||
goto err;
|
||||
|
||||
DMEMIT("%u %llu/%llu %u",
|
||||
(unsigned) (DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT),
|
||||
(unsigned int) (DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT),
|
||||
(unsigned long long) stats.used,
|
||||
(unsigned long long) stats.total,
|
||||
(unsigned) stats.era);
|
||||
(unsigned int) stats.era);
|
||||
|
||||
if (stats.snap != SUPERBLOCK_LOCATION)
|
||||
DMEMIT(" %llu", stats.snap);
|
||||
@@ -1662,8 +1662,8 @@ err:
|
||||
DMEMIT("Error");
|
||||
}
|
||||
|
||||
static int era_message(struct dm_target *ti, unsigned argc, char **argv,
|
||||
char *result, unsigned maxlen)
|
||||
static int era_message(struct dm_target *ti, unsigned int argc, char **argv,
|
||||
char *result, unsigned int maxlen)
|
||||
{
|
||||
struct era *era = ti->private;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ EXPORT_SYMBOL(dm_exception_store_type_unregister);
|
||||
static int set_chunk_size(struct dm_exception_store *store,
|
||||
const char *chunk_size_arg, char **error)
|
||||
{
|
||||
unsigned chunk_size;
|
||||
unsigned int chunk_size;
|
||||
|
||||
if (kstrtouint(chunk_size_arg, 10, &chunk_size)) {
|
||||
*error = "Invalid chunk size";
|
||||
@@ -159,7 +159,7 @@ static int set_chunk_size(struct dm_exception_store *store,
|
||||
}
|
||||
|
||||
int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
|
||||
unsigned chunk_size,
|
||||
unsigned int chunk_size,
|
||||
char **error)
|
||||
{
|
||||
/* Check chunk_size is a power of 2 */
|
||||
@@ -191,7 +191,7 @@ int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
|
||||
|
||||
int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
|
||||
struct dm_snapshot *snap,
|
||||
unsigned *args_used,
|
||||
unsigned int *args_used,
|
||||
struct dm_exception_store **store)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
@@ -97,9 +97,9 @@ struct dm_exception_store_type {
|
||||
*/
|
||||
void (*drop_snapshot) (struct dm_exception_store *store);
|
||||
|
||||
unsigned (*status) (struct dm_exception_store *store,
|
||||
status_type_t status, char *result,
|
||||
unsigned maxlen);
|
||||
unsigned int (*status) (struct dm_exception_store *store,
|
||||
status_type_t status, char *result,
|
||||
unsigned int maxlen);
|
||||
|
||||
/*
|
||||
* Return how full the snapshot is.
|
||||
@@ -119,9 +119,9 @@ struct dm_exception_store {
|
||||
struct dm_snapshot *snap;
|
||||
|
||||
/* Size of data blocks saved - must be a power of 2 */
|
||||
unsigned chunk_size;
|
||||
unsigned chunk_mask;
|
||||
unsigned chunk_shift;
|
||||
unsigned int chunk_size;
|
||||
unsigned int chunk_mask;
|
||||
unsigned int chunk_shift;
|
||||
|
||||
void *context;
|
||||
|
||||
@@ -145,7 +145,7 @@ static inline chunk_t dm_chunk_number(chunk_t chunk)
|
||||
return chunk & (chunk_t)((1ULL << DM_CHUNK_NUMBER_BITS) - 1ULL);
|
||||
}
|
||||
|
||||
static inline unsigned dm_consecutive_chunk_count(struct dm_exception *e)
|
||||
static inline unsigned int dm_consecutive_chunk_count(struct dm_exception *e)
|
||||
{
|
||||
return e->new_chunk >> DM_CHUNK_NUMBER_BITS;
|
||||
}
|
||||
@@ -182,12 +182,12 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type);
|
||||
int dm_exception_store_type_unregister(struct dm_exception_store_type *type);
|
||||
|
||||
int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
|
||||
unsigned chunk_size,
|
||||
unsigned int chunk_size,
|
||||
char **error);
|
||||
|
||||
int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
|
||||
struct dm_snapshot *snap,
|
||||
unsigned *args_used,
|
||||
unsigned int *args_used,
|
||||
struct dm_exception_store **store);
|
||||
void dm_exception_store_destroy(struct dm_exception_store *store);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user