diff options
| author | Joe Thornber <ejt@redhat.com> | 2014-10-06 10:28:30 -0400 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2014-11-10 15:25:27 -0500 |
| commit | 8a01a6af75f839ff8eb25dab69b49224e855bfa1 (patch) | |
| tree | 6e0c31ce682332cd8af5d6f77037b56421507542 | |
| parent | 4646015d7e4ca5a4dc19427fb0a0aeff15a4fd91 (diff) | |
dm thin: prefetch missing metadata pages
Prefetch metadata at the start of the worker thread and then again every
128th bio processed from the deferred list.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
| -rw-r--r-- | drivers/md/dm-thin-metadata.c | 5 | ||||
| -rw-r--r-- | drivers/md/dm-thin-metadata.h | 5 | ||||
| -rw-r--r-- | drivers/md/dm-thin.c | 10 |
3 files changed, 16 insertions, 4 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index ee42d1c52387..43adbb863f5a 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
| @@ -1809,3 +1809,8 @@ bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd) | |||
| 1809 | 1809 | ||
| 1810 | return needs_check; | 1810 | return needs_check; |
| 1811 | } | 1811 | } |
| 1812 | |||
| 1813 | void dm_pool_issue_prefetches(struct dm_pool_metadata *pmd) | ||
| 1814 | { | ||
| 1815 | dm_tm_issue_prefetches(pmd->tm); | ||
| 1816 | } | ||
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index efedd5a4cd8f..921d15ee56a0 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
| @@ -213,6 +213,11 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | |||
| 213 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd); | 213 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd); |
| 214 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd); | 214 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd); |
| 215 | 215 | ||
| 216 | /* | ||
| 217 | * Issue any prefetches that may be useful. | ||
| 218 | */ | ||
| 219 | void dm_pool_issue_prefetches(struct dm_pool_metadata *pmd); | ||
| 220 | |||
| 216 | /*----------------------------------------------------------------*/ | 221 | /*----------------------------------------------------------------*/ |
| 217 | 222 | ||
| 218 | #endif | 223 | #endif |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index eecfe7495232..97a7eb4d0412 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -1526,6 +1526,7 @@ static void process_thin_deferred_bios(struct thin_c *tc) | |||
| 1526 | struct bio *bio; | 1526 | struct bio *bio; |
| 1527 | struct bio_list bios; | 1527 | struct bio_list bios; |
| 1528 | struct blk_plug plug; | 1528 | struct blk_plug plug; |
| 1529 | unsigned count = 0; | ||
| 1529 | 1530 | ||
| 1530 | if (tc->requeue_mode) { | 1531 | if (tc->requeue_mode) { |
| 1531 | requeue_bio_list(tc, &tc->deferred_bio_list); | 1532 | requeue_bio_list(tc, &tc->deferred_bio_list); |
| @@ -1567,6 +1568,10 @@ static void process_thin_deferred_bios(struct thin_c *tc) | |||
| 1567 | pool->process_discard(tc, bio); | 1568 | pool->process_discard(tc, bio); |
| 1568 | else | 1569 | else |
| 1569 | pool->process_bio(tc, bio); | 1570 | pool->process_bio(tc, bio); |
| 1571 | |||
| 1572 | if ((count++ & 127) == 0) { | ||
| 1573 | dm_pool_issue_prefetches(pool->pmd); | ||
| 1574 | } | ||
| 1570 | } | 1575 | } |
| 1571 | blk_finish_plug(&plug); | 1576 | blk_finish_plug(&plug); |
| 1572 | } | 1577 | } |
| @@ -1652,6 +1657,7 @@ static void do_worker(struct work_struct *ws) | |||
| 1652 | { | 1657 | { |
| 1653 | struct pool *pool = container_of(ws, struct pool, worker); | 1658 | struct pool *pool = container_of(ws, struct pool, worker); |
| 1654 | 1659 | ||
| 1660 | dm_pool_issue_prefetches(pool->pmd); | ||
| 1655 | process_prepared(pool, &pool->prepared_mappings, &pool->process_prepared_mapping); | 1661 | process_prepared(pool, &pool->prepared_mappings, &pool->process_prepared_mapping); |
| 1656 | process_prepared(pool, &pool->prepared_discards, &pool->process_prepared_discard); | 1662 | process_prepared(pool, &pool->prepared_discards, &pool->process_prepared_discard); |
| 1657 | process_deferred_bios(pool); | 1663 | process_deferred_bios(pool); |
| @@ -1996,10 +2002,6 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
| 1996 | /* fall through */ | 2002 | /* fall through */ |
| 1997 | 2003 | ||
| 1998 | case -EWOULDBLOCK: | 2004 | case -EWOULDBLOCK: |
| 1999 | /* | ||
| 2000 | * In future, the failed dm_thin_find_block above could | ||
| 2001 | * provide the hint to load the metadata into cache. | ||
| 2002 | */ | ||
| 2003 | thin_defer_bio(tc, bio); | 2005 | thin_defer_bio(tc, bio); |
| 2004 | cell_defer_no_holder_no_free(tc, &cell1); | 2006 | cell_defer_no_holder_no_free(tc, &cell1); |
| 2005 | return DM_MAPIO_SUBMITTED; | 2007 | return DM_MAPIO_SUBMITTED; |
