Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157223
b: refs/heads/master
c: 02d2fd3
h: refs/heads/master
i:
  157221: 565da4d
  157219: eaa2915
  157215: 010968d
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Sep 4, 2009
1 parent b2f92ca commit 41b8edb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 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: 7ec23d50949d5062b5b749638dd9380ed75e58e5
refs/heads/master: 02d2fd31defce6ff77146ad0fef4f19006055d86
26 changes: 7 additions & 19 deletions trunk/drivers/md/dm-snap-persistent.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ static void do_metadata(struct work_struct *work)
/*
* Read or write a chunk aligned and sized block of data from a device.
*/
static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata)
static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw,
int metadata)
{
struct dm_io_region where = {
.bdev = ps->store->cow->bdev,
Expand All @@ -198,7 +199,7 @@ static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata)
struct dm_io_request io_req = {
.bi_rw = rw,
.mem.type = DM_IO_VMA,
.mem.ptr.vma = ps->area,
.mem.ptr.vma = area,
.client = ps->io_client,
.notify.fn = NULL,
};
Expand Down Expand Up @@ -240,7 +241,7 @@ static int area_io(struct pstore *ps, int rw)

chunk = area_location(ps, ps->current_area);

r = chunk_io(ps, chunk, rw, 0);
r = chunk_io(ps, ps->area, chunk, rw, 0);
if (r)
return r;

Expand All @@ -254,20 +255,7 @@ static void zero_memory_area(struct pstore *ps)

static int zero_disk_area(struct pstore *ps, chunk_t area)
{
struct dm_io_region where = {
.bdev = ps->store->cow->bdev,
.sector = ps->store->chunk_size * area_location(ps, area),
.count = ps->store->chunk_size,
};
struct dm_io_request io_req = {
.bi_rw = WRITE,
.mem.type = DM_IO_VMA,
.mem.ptr.vma = ps->zero_area,
.client = ps->io_client,
.notify.fn = NULL,
};

return dm_io(&io_req, 1, &where, NULL);
return chunk_io(ps, ps->zero_area, area_location(ps, area), WRITE, 0);
}

static int read_header(struct pstore *ps, int *new_snapshot)
Expand Down Expand Up @@ -297,7 +285,7 @@ static int read_header(struct pstore *ps, int *new_snapshot)
if (r)
return r;

r = chunk_io(ps, 0, READ, 1);
r = chunk_io(ps, ps->area, 0, READ, 1);
if (r)
goto bad;

Expand Down Expand Up @@ -359,7 +347,7 @@ static int write_header(struct pstore *ps)
dh->version = cpu_to_le32(ps->version);
dh->chunk_size = cpu_to_le32(ps->store->chunk_size);

return chunk_io(ps, 0, WRITE, 1);
return chunk_io(ps, ps->area, 0, WRITE, 1);
}

/*
Expand Down

0 comments on commit 41b8edb

Please sign in to comment.