From: Neil Brown Date: Sat, 12 Jul 2008 10:28:38 +0000 (+1000) Subject: Correct unit conversion for component_size and dev/size in sysfs. X-Git-Tag: mdadm-3.0-devel1~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=047d2e49f52a25cc88781d11cd83e147791975d6;p=thirdparty%2Fmdadm.git Correct unit conversion for component_size and dev/size in sysfs. These are both Kilobytes, so do the conversion to sectors properly. --- diff --git a/sysfs.c b/sysfs.c index a2844213..b7a95eda 100644 --- a/sysfs.c +++ b/sysfs.c @@ -234,7 +234,7 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options) strcpy(dbase, "size"); if (load_sys(fname, buf)) goto abort; - dev->component_size = strtoull(buf, NULL, 0); + dev->component_size = strtoull(buf, NULL, 0) * 2; } if (options & GET_STATE) { dev->disk.state = 0; @@ -359,7 +359,7 @@ int sysfs_set_array(struct mdinfo *sra, rv |= sysfs_set_num(sra, NULL, "raid_disks", info->array.raid_disks); rv |= sysfs_set_num(sra, NULL, "chunk_size", info->array.chunk_size); rv |= sysfs_set_num(sra, NULL, "layout", info->array.layout); - rv |= sysfs_set_num(sra, NULL, "component_size", info->component_size); + rv |= sysfs_set_num(sra, NULL, "component_size", info->component_size/2); rv |= sysfs_set_num(sra, NULL, "resync_start", info->resync_start); sra->array = info->array; return rv;