Blame SOURCES/fix_sil_jbod.patch

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