From patchwork Tue Dec 1 13:26:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: heinzm@sourceware.org X-Patchwork-Id: 63947 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB1DQJap001013 for ; Tue, 1 Dec 2009 13:26:19 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 6ACA88E0D3D; Tue, 1 Dec 2009 08:26:18 -0500 (EST) Received: from int-mx04.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nB1DQGes001101 for ; Tue, 1 Dec 2009 08:26:16 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB1DQGQq004503 for ; Tue, 1 Dec 2009 08:26:16 -0500 Received: from sourceware.org (sourceware.org [209.132.176.174]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id nB1DQ5vr012761 for ; Tue, 1 Dec 2009 08:26:05 -0500 Received: (qmail 8304 invoked by uid 9450); 1 Dec 2009 13:26:04 -0000 Date: 1 Dec 2009 13:26:04 -0000 Message-ID: <20091201132604.8302.qmail@sourceware.org> From: heinzm@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -3.891 (AWL,RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-loop: dm-devel@redhat.com Cc: Subject: [dm-devel] dmraid/lib/format/ataraid sil.c X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com --- dmraid/lib/format/ataraid/sil.c 2009/09/16 11:45:14 1.4 +++ dmraid/lib/format/ataraid/sil.c 2009/12/01 13:26:04 1.5 @@ -1,8 +1,8 @@ /* * Silicon Image Medley ATARAID metadata format handler. * - * Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH. - * All rights reserved. + * Copyright (C) 2004,2005,2009 Heinz Mauelshagen, Red Hat GmbH. + * All rights reserved. * * See file LICENSE at the top of this source tree for license information. */ @@ -166,6 +166,16 @@ return 1; } +/* Return number of array sectors. */ +static uint64_t +array_size(struct raid_dev *rd) +{ + struct sil *sil = META(rd, sil); + + return (((uint64_t) sil->array_sectors_high) << 32) + + sil->array_sectors_low; +} + static void free_sils(struct sil **sils, unsigned int i) { @@ -381,6 +391,10 @@ struct sil *sil = META(rd, sil); switch (sil->type) { + case SIL_T_JBOD: + ret = array_size(rd) < rd->sectors ? + 1 : sil->drives_per_striped_set; + break; case SIL_T_RAID0: case SIL_T_RAID10: ret = sil->drives_per_striped_set; @@ -519,12 +533,9 @@ static uint64_t sectors(struct raid_dev *rd) { - uint64_t array_sectors, ret = 0; + uint64_t array_sectors = array_size(rd), ret = 0; struct sil *sil = META(rd, sil); - array_sectors = (((uint64_t) sil->array_sectors_high) << 32) + - sil->array_sectors_low; - switch (sil->type) { case SIL_T_SPARE: /* Cook them up... */