summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-07-12 20:28:38 +1000
committerNeil Brown <neilb@suse.de>2008-07-12 20:28:38 +1000
commit047d2e49f52a25cc88781d11cd83e147791975d6 (patch)
treee4cf33f32d5a391f7ac864f718be06093043e4b4 /sysfs.c
parent6416d5275d65be25a6cd63583bb2b92e6fba95a5 (diff)
downloadmdadm-047d2e49f52a25cc88781d11cd83e147791975d6.tar.gz
mdadm-047d2e49f52a25cc88781d11cd83e147791975d6.tar.xz
mdadm-047d2e49f52a25cc88781d11cd83e147791975d6.zip
Correct unit conversion for component_size and dev/size in sysfs.
These are both Kilobytes, so do the conversion to sectors properly.
Diffstat (limited to 'sysfs.c')
-rw-r--r--sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysfs.c b/sysfs.c
index a284421..b7a95ed 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;