More snapshot metadata reading into separate function, in preparation for calling it from elsewhere. Signed-Off-By: Alasdair G Kergon --- diff/drivers/md/dm-snap.c 2005-07-06 17:18:27.000000000 +0100 +++ source/drivers/md/dm-snap.c 2005-07-06 17:18:35.000000000 +0100 @@ -371,6 +371,20 @@ 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:

*/ @@ -848,16 +862,7 @@ { 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,