[DRBD-cvs] r1484 - trunk/drbd

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Fri, 6 Aug 2004 14:25:51 +0200 (CEST)


Author: phil
Date: 2004-08-06 14:25:49 +0200 (Fri, 06 Aug 2004)
New Revision: 1484

Modified:
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
Log:
Commited LGE's suggestion. (Made 2<<16 to 1<<16)


Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-04 13:50:14 UTC (rev 1483)
+++ trunk/drbd/drbd_fs.c	2004-08-06 12:25:49 UTC (rev 1484)
@@ -369,7 +369,18 @@
 	if ( new_conf.meta_index == -1 ) i = 1;
 	else i = new_conf.meta_index+1;
 
-	if( drbd_get_capacity(bdev2) < 2*MD_RESERVED_SIZE*i ) {
+	/* for internal, we need to check agains <= (then we have a drbd with
+	 * zero size, but meta data...) to be on the safe side, I require 64MB
+	 * minimal data storage area for drbd with internal meta data (thats
+	 * 192 total).  if someone wants to use that small devices, she can use
+	 * drbd 0.6 anyways...
+	 *
+	 * FIXME this is arbitrary and needs to be reconsidered as soon as we
+	 * move to flexible size meta data.
+	 */
+	if( drbd_get_capacity(bdev2) < 2*MD_RESERVED_SIZE*i
+				+ (new_conf.meta_index == -1) ? (1<<16) : 0 )
+	{
 		retcode = MDDeviceTooSmall;
 		goto release_bdev2_fail_ioctl;
 	}

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-08-04 13:50:14 UTC (rev 1483)
+++ trunk/drbd/drbd_int.h	2004-08-06 12:25:49 UTC (rev 1484)
@@ -870,7 +870,7 @@
    * either at the end of the backing device
    * or on a seperate meta data device. */
 
-#define MD_RESERVED_SIZE ( 128 * (1<<10) )  // 128 MB  ( in units of kb )
+#define MD_RESERVED_SIZE ( 128LU * (1<<10) )  // 128 MB  ( in units of kb )
 // The following numbers are sectors
 #define MD_GC_OFFSET 0
 #define MD_AL_OFFSET 8      // 8 Sectors after start of meta area