FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 08-15-2008, 06:42 AM
FUJITA Tomonori
 
Default dm snapshot: make chunk_io handle any buffer

chunk_io() can perform I/Os only with ps->area. This patch adds a new
argument (a pointer to a buffer) to chunk_io() so that it can performs
I/Os with the buffer.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
drivers/md/dm-exception-store.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 41f4080..fe5f8b4 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -175,7 +175,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, uint32_t chunk, int rw, int metadata)
+static int chunk_io(struct pstore *ps, uint32_t chunk, int rw, int metadata,
+ void *data)
{
struct dm_io_region where = {
.bdev = ps->snap->cow->bdev,
@@ -185,7 +186,7 @@ static int chunk_io(struct pstore *ps, uint32_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 = data,
.client = ps->io_client,
.notify.fn = NULL,
};
@@ -220,7 +221,7 @@ static int area_io(struct pstore *ps, uint32_t area, int rw)
/* convert a metadata area index to a chunk index */
chunk = 1 + ((ps->exceptions_per_area + 1) * area);

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

@@ -261,7 +262,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, 0, READ, 1, ps->area);
if (r)
goto bad;

@@ -323,7 +324,7 @@ static int write_header(struct pstore *ps)
dh->version = cpu_to_le32(ps->version);
dh->chunk_size = cpu_to_le32(ps->snap->chunk_size);

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

/*
--
1.5.5.GIT

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 10-29-2008, 10:48 PM
Alasdair G Kergon
 
Default dm snapshot: make chunk_io handle any buffer

On Mon, Oct 27, 2008 at 09:07:48PM +0900, FUJITA Tomonori wrote:
> chunk_io() can perform I/Os only with ps->area. This patch adds a new
> argument (a pointer to a buffer) to chunk_io() so that it can performs
> I/Os with the buffer.

> +static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata,
> + void *data)

data is part of ps so should not need passing in as it's already accessible!

It's looking like struct pstore is acquiring fields that apply to only one
type of snapshot: IOW More-invasive refactoring of that struct is needed.
- Which fields apply to both? Which apply only to one type of snapshot?

Alasdair
--
agk@redhat.com

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 10-30-2008, 05:06 AM
FUJITA Tomonori
 
Default dm snapshot: make chunk_io handle any buffer

On Wed, 29 Oct 2008 23:48:52 +0000
Alasdair G Kergon <agk@redhat.com> wrote:

> On Mon, Oct 27, 2008 at 09:07:48PM +0900, FUJITA Tomonori wrote:
> > chunk_io() can perform I/Os only with ps->area. This patch adds a new
> > argument (a pointer to a buffer) to chunk_io() so that it can performs
> > I/Os with the buffer.
>
> > +static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata,
> > + void *data)
>
> data is part of ps so should not need passing in as it's already accessible!

The later patches uses chunk_io() to I/O for any data buffer (that is,
buffers are not in pstore).


> It's looking like struct pstore is acquiring fields that apply to only one
> type of snapshot: IOW More-invasive refactoring of that struct is needed.
> - Which fields apply to both? Which apply only to one type of snapshot?

The 7/9 patch adds the following fields to struct pstore:

struct disk_exception {
@@ -131,6 +146,27 @@ struct pstore {
struct dm_io_client *io_client;

struct workqueue_struct *metadata_wq;
+
+ /*
+ * for shared exception
+ */
+ u64 root_tree_chunk;
+ u64 snapmask;
+ u32 tree_level;
+
+ u32 nr_snapshots;
+
+ unsigned long nr_chunks;
+ unsigned long nr_bitmap_chunks;
+ unsigned long *bitmap;
+ unsigned long cur_bitmap_chunk;
+ unsigned long cur_bitmap_index;
+
+ struct list_head chunk_buffer_list;
+ struct list_head chunk_buffer_dirty_list;
+
+ int header_dirty;
+ int nr_chunk_buffers;


The new snapshot code uses the following existing fields in struct
pstore:

void *zero_area;
chunk_t current_area;
chunk_t next_free;
uint32_t current_committed;


Do you want to split struct pstore?


Thanks,

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 12:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org