From 4d48b96b280a76f29eb5d5f1578559932f551b2d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 11 Jul 2009 18:12:37 +0100 Subject: Add basic RAID[56] support David Woodhouse originally contributed this code, and Chris Mason changed it around to reflect the current design goals for raid56. The original code expected all metadata and data writes to be full stripes. This meant metadata block size == stripe size, and had a few other restrictions. This version allows metadata blocks smaller than the stripe size. It implements both raid5 and raid6, although it does not have code to rebuild from parity if one of the drives is missing or incorrect. Signed-off-by: David Woodhouse Signed-off-by: Chris Mason --- extent_io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'extent_io.c') diff --git a/extent_io.c b/extent_io.c index ebb35b28..45fa6bf6 100644 --- a/extent_io.c +++ b/extent_io.c @@ -663,13 +663,14 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, return eb; } -int read_extent_from_disk(struct extent_buffer *eb) +int read_extent_from_disk(struct extent_buffer *eb, + unsigned long offset, unsigned long len) { int ret; - ret = pread(eb->fd, eb->data, eb->len, eb->dev_bytenr); + ret = pread(eb->fd, eb->data + offset, len, eb->dev_bytenr); if (ret < 0) goto out; - if (ret != eb->len) { + if (ret != len) { ret = -EIO; goto out; } -- cgit v1.2.3