diff options
author | Joe Thornber <ejt@redhat.com> | 2012-07-27 10:08:14 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2012-07-27 10:08:14 -0400 |
commit | 4afdd680f7c106e1c87b6dd7af9751c282ecb4b0 (patch) | |
tree | b5afcd97153a4a9e70823a2d0d2c33bfc2b51926 /drivers/md | |
parent | 40db5a537655aa0b17a82a4b5596f8d27400edd8 (diff) |
dm thin: reduce number of metadata commits
Reduce the number of metadata commits by using
dm_thin_changed_this_transaction to check if metadata was changed on a
per thin device granularity.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-thin.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index bc9d08c0218b..98c50f9626d8 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -707,6 +707,12 @@ static void remap_to_origin(struct thin_c *tc, struct bio *bio) | |||
707 | bio->bi_bdev = tc->origin_dev->bdev; | 707 | bio->bi_bdev = tc->origin_dev->bdev; |
708 | } | 708 | } |
709 | 709 | ||
710 | static int bio_triggers_commit(struct thin_c *tc, struct bio *bio) | ||
711 | { | ||
712 | return (bio->bi_rw & (REQ_FLUSH | REQ_FUA)) && | ||
713 | dm_thin_changed_this_transaction(tc->td); | ||
714 | } | ||
715 | |||
710 | static void issue(struct thin_c *tc, struct bio *bio) | 716 | static void issue(struct thin_c *tc, struct bio *bio) |
711 | { | 717 | { |
712 | struct pool *pool = tc->pool; | 718 | struct pool *pool = tc->pool; |
@@ -716,7 +722,7 @@ static void issue(struct thin_c *tc, struct bio *bio) | |||
716 | * Batch together any FUA/FLUSH bios we find and then issue | 722 | * Batch together any FUA/FLUSH bios we find and then issue |
717 | * a single commit for them in process_deferred_bios(). | 723 | * a single commit for them in process_deferred_bios(). |
718 | */ | 724 | */ |
719 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA)) { | 725 | if (bio_triggers_commit(tc, bio)) { |
720 | spin_lock_irqsave(&pool->lock, flags); | 726 | spin_lock_irqsave(&pool->lock, flags); |
721 | bio_list_add(&pool->deferred_flush_bios, bio); | 727 | bio_list_add(&pool->deferred_flush_bios, bio); |
722 | spin_unlock_irqrestore(&pool->lock, flags); | 728 | spin_unlock_irqrestore(&pool->lock, flags); |