[dm-devel] [PATCH] Cope if snapshot-origin got extended

Alasdair G Kergon agk at redhat.com
Fri Jan 28 20:35:11 UTC 2005


Handle writes to a snapshot-origin device that has been extended since
the snapshot was taken.

The idea is to allow:
  create origin lv
  create snapshot of it
Deactivate both devices.
  extend the origin
Reactivate with the revised device sizes.

Then the origin is bigger than the snapshot and reads to the new
part of the origin don't need to trigger exceptions.

[This is the easiest case: It's harder to support doing this while the 
devices are active, or shrinking the origin (which doesn't achieve much).]

--- diff/drivers/md/dm-snap.c	2005-01-28 18:04:03.000000000 +0000
+++ source/drivers/md/dm-snap.c	2005-01-28 20:25:26.000000000 +0000
@@ -931,6 +931,10 @@
 		if (!snap->valid)
 			continue;
 
+		/* Nothing to do if writing beyond end of snapshot */
+		if (bio->bi_sector >= dm_table_get_size(snap->table))
+			continue;
+
 		down_write(&snap->lock);
 
 		/*




More information about the dm-devel mailing list