Skip to content

Commit

Permalink
dm thin: reduce number of metadata commits
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Thornber authored and Alasdair G Kergon committed Jul 27, 2012
1 parent 40db5a5 commit 4afdd68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/md/dm-thin.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ static void remap_to_origin(struct thin_c *tc, struct bio *bio)
bio->bi_bdev = tc->origin_dev->bdev;
}

static int bio_triggers_commit(struct thin_c *tc, struct bio *bio)
{
return (bio->bi_rw & (REQ_FLUSH | REQ_FUA)) &&
dm_thin_changed_this_transaction(tc->td);
}

static void issue(struct thin_c *tc, struct bio *bio)
{
struct pool *pool = tc->pool;
Expand All @@ -716,7 +722,7 @@ static void issue(struct thin_c *tc, struct bio *bio)
* Batch together any FUA/FLUSH bios we find and then issue
* a single commit for them in process_deferred_bios().
*/
if (bio->bi_rw & (REQ_FLUSH | REQ_FUA)) {
if (bio_triggers_commit(tc, bio)) {
spin_lock_irqsave(&pool->lock, flags);
bio_list_add(&pool->deferred_flush_bios, bio);
spin_unlock_irqrestore(&pool->lock, flags);
Expand Down

0 comments on commit 4afdd68

Please sign in to comment.