diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-03-31 00:00:31 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-03-31 00:00:31 -0400 |
commit | b522adcde9c4d3fb7b579cfa9160d8bde7744be8 (patch) | |
tree | 4208e3dcec3ebdfa6ad9bc153f76129400532717 /drivers/md/md.h | |
parent | 1f403624bde3c678a166984b1e6a727a0ce06f2b (diff) |
md: 'array_size' sysfs attribute
Allow userspace to set the size of the array according to the following
semantics:
1/ size must be <= to the size returned by mddev->pers->size(mddev, 0, 0)
a) If size is set before the array is running, do_md_run will fail
if size is greater than the default size
b) A reshape attempt that reduces the default size to less than the set
array size should be blocked
2/ once userspace sets the size the kernel will not change it
3/ writing 'default' to this attribute returns control of the size to the
kernel and reverts to the size reported by the personality
Also, convert locations that need to know the default size from directly
reading ->array_sectors to <pers>_size. Resync/reshape operations
always follow the default size.
Finally, fixup other locations that read a number of 1k-blocks from
userspace to use strict_blocks_to_sectors() which checks for unsigned
long long to sector_t overflow and blocks to sectors overflow.
Reviewed-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index ce89dda24074..d13e34f842e2 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -147,6 +147,8 @@ struct mddev_s | |||
147 | sector_t dev_sectors; /* used size of | 147 | sector_t dev_sectors; /* used size of |
148 | * component devices */ | 148 | * component devices */ |
149 | sector_t array_sectors; /* exported array size */ | 149 | sector_t array_sectors; /* exported array size */ |
150 | int external_size; /* size managed | ||
151 | * externally */ | ||
150 | __u64 events; | 152 | __u64 events; |
151 | 153 | ||
152 | char uuid[16]; | 154 | char uuid[16]; |
@@ -431,3 +433,4 @@ extern void md_new_event(mddev_t *mddev); | |||
431 | extern int md_allow_write(mddev_t *mddev); | 433 | extern int md_allow_write(mddev_t *mddev); |
432 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | 434 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); |
433 | extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); | 435 | extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); |
436 | extern void md_set_array_sectors_lock(mddev_t *mddev, sector_t array_sectors); | ||