Commit 2d38fe20 authored by Alasdair G Kergon's avatar Alasdair G Kergon Committed by Linus Torvalds

[PATCH] device-mapper snapshot: metadata reading separation

More snapshot metadata reading into separate function, to prepare for changing
the place it gets called from.
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 81f1777a
...@@ -371,6 +371,20 @@ static inline ulong round_up(ulong n, ulong size) ...@@ -371,6 +371,20 @@ static inline ulong round_up(ulong n, ulong size)
return (n + size) & ~size; 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> * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size>
*/ */
...@@ -848,16 +862,7 @@ static void snapshot_resume(struct dm_target *ti) ...@@ -848,16 +862,7 @@ static void snapshot_resume(struct dm_target *ti)
{ {
struct dm_snapshot *s = (struct dm_snapshot *) ti->private; struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
if (s->have_metadata) read_snapshot_metadata(s);
return;
if (s->store.read_metadata(&s->store)) {
down_write(&s->lock);
s->valid = 0;
up_write(&s->lock);
}
s->have_metadata = 1;
} }
static int snapshot_status(struct dm_target *ti, status_type_t type, static int snapshot_status(struct dm_target *ti, status_type_t type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment