[PATCH] device-mapper snapshot: metadata reading separation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



More snapshot metadata reading into separate function, to prepare
for changing the place it gets called from.

Signed-Off-By: Alasdair G Kergon <[email protected]>

Index: linux-2.6.14/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.14.orig/drivers/md/dm-snap.c	2005-11-17 22:17:55.000000000 +0000
+++ linux-2.6.14/drivers/md/dm-snap.c	2005-11-17 22:18:25.000000000 +0000
@@ -371,6 +371,20 @@ static inline ulong round_up(ulong n, ul
 	return (n + size) & ~size;
 }
 
+static void read_snapshot_metadata(struct dm_snapshot *s)
+{
+	if (s->have_metadata)
+		return;
+
+	if (s->store.read_metadata(&s->store)) {
+		down_write(&s->lock);
+		s->valid = 0;
+		up_write(&s->lock);
+	}
+
+	s->have_metadata = 1;
+}
+
 /*
  * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size>
  */
@@ -848,16 +862,7 @@ static void snapshot_resume(struct dm_ta
 {
 	struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
 
-	if (s->have_metadata)
-		return;
-
-	if (s->store.read_metadata(&s->store)) {
-		down_write(&s->lock);
-		s->valid = 0;
-		up_write(&s->lock);
-	}
-
-	s->have_metadata = 1;
+	read_snapshot_metadata(s);
 }
 
 static int snapshot_status(struct dm_target *ti, status_type_t type,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux