Commit 4afdd680f7c106e1c87b6dd7af9751c282ecb4b0

Authored by Joe Thornber
Committed by Alasdair G Kergon
1 parent 40db5a5376

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>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

drivers/md/dm-thin.c
... ... @@ -707,6 +707,12 @@
707 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 716 static void issue(struct thin_c *tc, struct bio *bio)
711 717 {
712 718 struct pool *pool = tc->pool;
... ... @@ -716,7 +722,7 @@
716 722 * Batch together any FUA/FLUSH bios we find and then issue
717 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 726 spin_lock_irqsave(&pool->lock, flags);
721 727 bio_list_add(&pool->deferred_flush_bios, bio);
722 728 spin_unlock_irqrestore(&pool->lock, flags);