From: Alasdair G Kergon More snapshot metadata reading into separate function, to prepare for changing the place it gets called from. Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton --- drivers/md/dm-snap.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff -puN drivers/md/dm-snap.c~device-mapper-snapshot-metadata-reading-separation drivers/md/dm-snap.c --- devel/drivers/md/dm-snap.c~device-mapper-snapshot-metadata-reading-separation 2005-11-18 18:16:11.000000000 -0800 +++ devel-akpm/drivers/md/dm-snap.c 2005-11-18 18:16:11.000000000 -0800 @@ -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:

*/ @@ -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, _