diff options
author | Neil Brown <neilb@suse.de> | 2006-12-14 17:31:16 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-12-14 17:31:16 +1100 |
commit | 758d3a8e7d3e0620d68d3b9e72ef0747319c6dac (patch) | |
tree | 313ba9725ec6165b42ffdfda6353f62c289de057 /Grow.c | |
parent | 583315d9c522c310c89d5640ae884ef7984b9c30 (diff) | |
download | mdadm-758d3a8e7d3e0620d68d3b9e72ef0747319c6dac.tar.gz mdadm-758d3a8e7d3e0620d68d3b9e72ef0747319c6dac.tar.xz mdadm-758d3a8e7d3e0620d68d3b9e72ef0747319c6dac.zip |
Increase raid456 stripe cache size if needed to --grow the array.
The setting used unfortunately requires intimate knowledge of the
kernel, and it not reset when the reshape finishes.
Diffstat (limited to 'Grow.c')
-rw-r--r-- | Grow.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -523,7 +523,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, case 6: st = super_by_version(array.major_version, array.minor_version); - /* size can be changed independantly. + /* size can be changed independently. * layout/chunksize/raid_disks/level can be changed * though the kernel may not support it all. * If 'suspend_lo' is not present in devfs, then @@ -620,7 +620,8 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, printf("mdadm: Need to backup %lluK of critical section..\n", last_block/2); sra = sysfs_read(fd, 0, - GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE); + GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE| + GET_CACHE); if (!sra) { fprintf(stderr, Name ": %s: Cannot get array details from sysfs\n", devname); @@ -742,10 +743,25 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, array.chunk_size = nchunk; array.layout = nlayout; if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) { + if (errno == ENOSPC) { + /* stripe cache is not big enough. + * It needs to be 4 times chunksize_size, + * and we assume pagesize is 4K + */ + if (sra->cache_size < 4 * (nchunk/4096)) { + sysfs_set_num(sra, NULL, + "stripe_cache_size", + 4 * (nchunk/4096) +1); + if (ioctl(fd, SET_ARRAY_INFO, + &array) == 0) + goto ok; + } + } fprintf(stderr, Name ": Cannot set device size/shape for %s: %s\n", devname, strerror(errno)); goto abort; } + ok: ; /* suspend the relevant region */ sysfs_set_num(sra, NULL, "suspend_hi", 0); /* just in case */ |