svn commit: r218569 - projects/graid/head/sys/geom/raid
Alexander Motin
mav at FreeBSD.org
Fri Feb 11 14:49:26 UTC 2011
Author: mav
Date: Fri Feb 11 14:49:25 2011
New Revision: 218569
URL: http://svn.freebsd.org/changeset/base/218569
Log:
Fix second volume offset/size rounding. Previous version could create
intersecting volumes.
Modified:
projects/graid/head/sys/geom/raid/md_intel.c
Modified: projects/graid/head/sys/geom/raid/md_intel.c
==============================================================================
--- projects/graid/head/sys/geom/raid/md_intel.c Fri Feb 11 14:44:00 2011 (r218568)
+++ projects/graid/head/sys/geom/raid/md_intel.c Fri Feb 11 14:49:25 2011 (r218569)
@@ -1681,19 +1681,6 @@ makedisk:
size = size - (sd->sd_offset + sd->sd_size);
}
- /* Handle size argument. */
- len = sizeof(*sizearg);
- sizearg = gctl_get_param(req, "size", &len);
- if (sizearg != NULL && len == sizeof(*sizearg) &&
- *sizearg > 0) {
- if (*sizearg > size) {
- gctl_error(req, "Size too big %lld > %lld.",
- (long long)*sizearg, (long long)size);
- return (-9);
- }
- size = *sizearg;
- }
-
/* Handle strip argument. */
strip = 131072;
len = sizeof(*striparg);
@@ -1716,8 +1703,23 @@ makedisk:
}
/* Round offset up to strip. */
- size -= ((strip - off) % strip);
- off += ((strip - off) % strip);
+ if (off % strip != 0) {
+ size -= strip - off % strip;
+ off += strip - off % strip;
+ }
+
+ /* Handle size argument. */
+ len = sizeof(*sizearg);
+ sizearg = gctl_get_param(req, "size", &len);
+ if (sizearg != NULL && len == sizeof(*sizearg) &&
+ *sizearg > 0) {
+ if (*sizearg > size) {
+ gctl_error(req, "Size too big %lld > %lld.",
+ (long long)*sizearg, (long long)size);
+ return (-9);
+ }
+ size = *sizearg;
+ }
/* Round size down to strip or sector. */
if (level == G_RAID_VOLUME_RL_RAID1)
More information about the svn-src-projects
mailing list