Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16516
b: refs/heads/master
c: 2d38fe2
h: refs/heads/master
v: v3
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed Jan 6, 2006
1 parent d799ef0 commit c2e582f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 81f1777a55e8c631b61e5fa5980fb7a2004287af
refs/heads/master: 2d38fe204461dc542bb38f2b01a9cd115b367b36
25 changes: 15 additions & 10 deletions trunk/drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,20 @@ static inline ulong round_up(ulong n, ulong 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>
*/
Expand Down Expand Up @@ -848,16 +862,7 @@ static void snapshot_resume(struct dm_target *ti)
{
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,
Expand Down

0 comments on commit c2e582f

Please sign in to comment.