Blame SOURCES/fix_sil_jbod.patch

41b6f0
diff --git a/lib/format/ataraid/sil.c.fix_sil_jbod b/lib/format/ataraid/sil.c
41b6f0
index 6089682..8c3df38 100644
41b6f0
--- a/lib/format/ataraid/sil.c.fix_sil_jbod
41b6f0
+++ b/lib/format/ataraid/sil.c
41b6f0
@@ -1,8 +1,8 @@
41b6f0
 /*
41b6f0
  * Silicon Image Medley ATARAID metadata format handler.
41b6f0
  *
41b6f0
- * Copyright (C) 2004,2005  Heinz Mauelshagen, Red Hat GmbH.
41b6f0
- *                          All rights reserved.
41b6f0
+ * Copyright (C) 2004,2005,2009  Heinz Mauelshagen, Red Hat GmbH.
41b6f0
+ *				 All rights reserved.
41b6f0
  *
41b6f0
  * See file LICENSE at the top of this source tree for license information.
41b6f0
  */
41b6f0
@@ -166,6 +166,16 @@ sil_valid(struct lib_context *lc, struct dev_info *di,
41b6f0
 	return 1;
41b6f0
 }
41b6f0
 
41b6f0
+/* Return number of array sectors. */
41b6f0
+static uint64_t
41b6f0
+array_size(struct raid_dev *rd)
41b6f0
+{
41b6f0
+	struct sil *sil = META(rd, sil);
41b6f0
+
41b6f0
+	return (((uint64_t) sil->array_sectors_high) << 32) +
41b6f0
+	       sil->array_sectors_low;
41b6f0
+}
41b6f0
+
41b6f0
 static void
41b6f0
 free_sils(struct sil **sils, unsigned int i)
41b6f0
 {
41b6f0
@@ -381,6 +391,10 @@ devices(struct raid_dev *rd, void *context)
41b6f0
 	struct sil *sil = META(rd, sil);
41b6f0
 
41b6f0
 	switch (sil->type) {
41b6f0
+	case SIL_T_JBOD:
41b6f0
+		ret = array_size(rd) < rd->sectors ?
41b6f0
+		      1 : sil->drives_per_striped_set;
41b6f0
+		break;
41b6f0
 	case SIL_T_RAID0:
41b6f0
 	case SIL_T_RAID10:
41b6f0
 		ret = sil->drives_per_striped_set;
41b6f0
@@ -519,12 +533,9 @@ stripes(struct sil *sil)
41b6f0
 static uint64_t
41b6f0
 sectors(struct raid_dev *rd)
41b6f0
 {
41b6f0
-	uint64_t array_sectors, ret = 0;
41b6f0
+	uint64_t array_sectors = array_size(rd), ret = 0;
41b6f0
 	struct sil *sil = META(rd, sil);
41b6f0
 
41b6f0
-	array_sectors = (((uint64_t) sil->array_sectors_high) << 32) +
41b6f0
-		sil->array_sectors_low;
41b6f0
-
41b6f0
 	switch (sil->type) {
41b6f0
 	case SIL_T_SPARE:
41b6f0
 		/* Cook them up... */