diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-04-27 20:11:23 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-04-28 00:08:44 +0300 |
commit | 7e0d574f2683a2346c978613a72ff07afc89b17a (patch) | |
tree | f1b83fd5151b6f364b01b25950b174914205acc4 /drivers/md/dm.c | |
parent | b194679fac3067e785f432109c69759aa75b038c (diff) | |
download | linux-7e0d574f2683a2346c978613a72ff07afc89b17a.tar.xz |
dm: introduce enum dm_queue_mode to cleanup related code
Introduce an enumeration type for the queue mode. This patch does
not change any functionality but makes the DM code easier to read.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 9940c9a42665..45660246e8f5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1807,13 +1807,13 @@ void dm_unlock_md_type(struct mapped_device *md) mutex_unlock(&md->type_lock); } -void dm_set_md_type(struct mapped_device *md, unsigned type) +void dm_set_md_type(struct mapped_device *md, enum dm_queue_mode type) { BUG_ON(!mutex_is_locked(&md->type_lock)); md->type = type; } -unsigned dm_get_md_type(struct mapped_device *md) +enum dm_queue_mode dm_get_md_type(struct mapped_device *md) { return md->type; } @@ -1840,7 +1840,7 @@ EXPORT_SYMBOL_GPL(dm_get_queue_limits); int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) { int r; - unsigned type = dm_get_md_type(md); + enum dm_queue_mode type = dm_get_md_type(md); switch (type) { case DM_TYPE_REQUEST_BASED: @@ -1871,6 +1871,9 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) if (type == DM_TYPE_DAX_BIO_BASED) queue_flag_set_unlocked(QUEUE_FLAG_DAX, md->queue); break; + case DM_TYPE_NONE: + WARN_ON_ONCE(true); + break; } return 0; @@ -2556,7 +2559,7 @@ int dm_noflush_suspending(struct dm_target *ti) } EXPORT_SYMBOL_GPL(dm_noflush_suspending); -struct dm_md_mempools *dm_alloc_md_mempools(struct mapped_device *md, unsigned type, +struct dm_md_mempools *dm_alloc_md_mempools(struct mapped_device *md, enum dm_queue_mode type, unsigned integrity, unsigned per_io_data_size) { struct dm_md_mempools *pools = kzalloc_node(sizeof(*pools), GFP_KERNEL, md->numa_node_id); |