summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-log.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-11 00:52:01 +0100
committerAlasdair G Kergon <agk@redhat.com>2009-12-11 00:52:01 +0100
commit076010e2e6ea5b66dfd1f81a6133fb014c9b291d (patch)
treeb8b6e7ebeb1b60166611e3bbd536818748689a6d /drivers/md/dm-log.c
parentdm log: add flush callback fn (diff)
downloadlinux-076010e2e6ea5b66dfd1f81a6133fb014c9b291d.tar.xz
linux-076010e2e6ea5b66dfd1f81a6133fb014c9b291d.zip
dm log: use flush callback fn
Call the flush callback from the log. If flush failed, we have no alternative but to mark the whole log as dirty. Also we set the variable flush_failed to prevent any bits ever being marked as clean again. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-log.c')
-rw-r--r--drivers/md/dm-log.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 666a80e3602e..315e36a96b6f 100644
--- a/drivers/md/dm-log.c
+++ b/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);