Skip to content

Commit 9974fa2

Browse files
committed
dm table: add dm_table_run_md_queue_async
Introduce dm_table_run_md_queue_async() to run the request_queue of the mapped_device associated with a request-based DM table. Also add dm_md_get_queue() wrapper to extract the request_queue from a mapped_device. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
1 parent 17f4ff4 commit 9974fa2

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎drivers/md/dm-table.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,25 @@ struct mapped_device *dm_table_get_md(struct dm_table *t)
16181618
}
16191619
EXPORT_SYMBOL(dm_table_get_md);
16201620

1621+
void dm_table_run_md_queue_async(struct dm_table *t)
1622+
{
1623+
struct mapped_device *md;
1624+
struct request_queue *queue;
1625+
unsigned long flags;
1626+
1627+
if (!dm_table_request_based(t))
1628+
return;
1629+
1630+
md = dm_table_get_md(t);
1631+
queue = dm_get_md_queue(md);
1632+
if (queue) {
1633+
spin_lock_irqsave(queue->queue_lock, flags);
1634+
blk_run_queue_async(queue);
1635+
spin_unlock_irqrestore(queue->queue_lock, flags);
1636+
}
1637+
}
1638+
EXPORT_SYMBOL(dm_table_run_md_queue_async);
1639+
16211640
static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev,
16221641
sector_t start, sector_t len, void *data)
16231642
{

‎drivers/md/dm.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@ sector_t dm_get_size(struct mapped_device *md)
468468
return get_capacity(md->disk);
469469
}
470470

471+
struct request_queue *dm_get_md_queue(struct mapped_device *md)
472+
{
473+
return md->queue;
474+
}
475+
471476
struct dm_stats *dm_get_stats(struct mapped_device *md)
472477
{
473478
return &md->stats;

‎drivers/md/dm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ int dm_lock_for_deletion(struct mapped_device *md, bool mark_deferred, bool only
188188
int dm_cancel_deferred_remove(struct mapped_device *md);
189189
int dm_request_based(struct mapped_device *md);
190190
sector_t dm_get_size(struct mapped_device *md);
191+
struct request_queue *dm_get_md_queue(struct mapped_device *md);
191192
struct dm_stats *dm_get_stats(struct mapped_device *md);
192193

193194
int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,

‎include/linux/device-mapper.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ struct mapped_device *dm_table_get_md(struct dm_table *t);
462462
*/
463463
void dm_table_event(struct dm_table *t);
464464

465+
/*
466+
* Run the queue for request-based targets.
467+
*/
468+
void dm_table_run_md_queue_async(struct dm_table *t);
469+
465470
/*
466471
* The device must be suspended before calling this method.
467472
* Returns the previous table, which the caller must destroy.

0 commit comments

Comments
 (0)