summaryrefslogtreecommitdiff
path: root/restripe.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-08-19 17:55:15 +1000
committerNeilBrown <neilb@suse.de>2008-08-19 17:55:15 +1000
commit94a20f0c800fd0aa9c26e99750bd2588cae8f038 (patch)
treed8df647125a5dc530b7489c1e505bece79b9742c /restripe.c
parente9dd159873cfa0da1ec3e4f173c24f330ea526f8 (diff)
downloadmdadm-94a20f0c800fd0aa9c26e99750bd2588cae8f038.tar.gz
Fix alignment for backup of reshape data.
Since we introduced O_DIRECT for device access we need properly aligned buffers and IO requests. The reshape code missed out on the conversion. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'restripe.c')
-rw-r--r--restripe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/restripe.c b/restripe.c
index afde836..509b450 100644
--- a/restripe.c
+++ b/restripe.c
@@ -152,7 +152,8 @@ int save_stripes(int *source, unsigned long long *offsets,
int nwrites, int *dest,
unsigned long long start, unsigned long long length)
{
- char buf[8192];
+ char abuf[8192+512];
+ char *buf = (char*)(((unsigned long)abuf+511)&~511UL);
int cpos = start % chunk_size; /* where in chunk we are up to */
int len;
int data_disks = raid_disks - (level == 0 ? 0 : level <=5 ? 1 : 2);
@@ -162,7 +163,7 @@ int save_stripes(int *source, unsigned long long *offsets,
unsigned long long offset;
int i;
len = chunk_size - cpos;
- if (len > sizeof(buf)) len = sizeof(buf);
+ if (len > 8192) len = 8192;
if (len > length) len = length;
/* len bytes to be moved from one device */