From df4a6314fc5c3462b22c81e4add6f1836fe1afdc Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Thu, 10 Dec 2009 23:52:01 +0000 Subject: [PATCH] --- yaml --- r: 176520 b: refs/heads/master c: 076010e2e6ea5b66dfd1f81a6133fb014c9b291d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/md/dm-log.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ae98c31f586c..e6f6a262c5bb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 87a8f240e9bcf025ba45e4563c842b0d59c5e8ef +refs/heads/master: 076010e2e6ea5b66dfd1f81a6133fb014c9b291d diff --git a/trunk/drivers/md/dm-log.c b/trunk/drivers/md/dm-log.c index 666a80e3602e..315e36a96b6f 100644 --- a/trunk/drivers/md/dm-log.c +++ b/trunk/drivers/md/dm-log.c @@ -677,13 +677,26 @@ static int core_flush(struct dm_dirty_log *log) static int disk_flush(struct dm_dirty_log *log) { - int r; - struct log_c *lc = (struct log_c *) log->context; + int r, i; + struct log_c *lc = log->context; /* only write if the log has changed */ if (!lc->touched_cleaned && !lc->touched_dirtied) return 0; + if (lc->touched_cleaned && log->flush_callback_fn && + log->flush_callback_fn(lc->ti)) { + /* + * At this point it is impossible to determine which + * regions are clean and which are dirty (without + * re-reading the log off disk). So mark all of them + * dirty. + */ + lc->flush_failed = 1; + for (i = 0; i < lc->region_count; i++) + log_clear_bit(lc, lc->clean_bits, i); + } + r = rw_header(lc, WRITE); if (r) fail_log_device(lc);