From patchwork Sun Feb 1 03:01:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 4951 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 n1131mC5019126 for ; Sun, 1 Feb 2009 03:01:48 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 2AE0B8E0F91; Sat, 31 Jan 2009 22:01:47 -0500 (EST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n1131kQh004972 for ; Sat, 31 Jan 2009 22:01:46 -0500 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1131lBY006326; Sat, 31 Jan 2009 22:01:47 -0500 Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n1131MsT030721; Sat, 31 Jan 2009 22:01:23 -0500 Received: from htj.dyndns.org (IDENT:U2FsdGVkX1/U5tKHRdJpEmPW0iYFdHhSDF2nCE8ub08@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n1131Atb029685 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 1 Feb 2009 03:01:12 GMT Received: from [127.0.0.2] (htj.dyndns.org [127.0.0.2]) by htj.dyndns.org (Postfix) with ESMTPSA id 3371D4094A7B7; Sun, 1 Feb 2009 12:01:05 +0900 (KST) Message-ID: <49851070.7030306@kernel.org> Date: Sun, 01 Feb 2009 12:01:04 +0900 From: Tejun Heo User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com, Mauelshagen@redhat.com, dm-devel@redhat.com References: <1233456951-992-1-git-send-email-tj@kernel.org> <49851012.8070904@kernel.org> In-Reply-To: <49851012.8070904@kernel.org> X-Enigmail-Version: 0.95.7 X-Virus-Scanned: ClamAV 0.93.3/8932/Sat Jan 31 23:12:16 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Sun, 01 Feb 2009 03:01:14 +0000 (UTC) X-RedHat-Spam-Score: -3.989 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.31 X-loop: dm-devel@redhat.com Cc: Subject: [dm-devel] [PATCH 3/3] dmraid: make nv use alt_size if available 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 nv puts metatdata at the end of a device, so it's important that dmraid and BIOS agree where the end of the device is. Later kernel exports the BIOS as via sysfs and it's available as di->alt_sectors. Use it if available. Signed-off-by: Tejun Heo --- lib/format/ataraid/nv.c | 15 +++++++++++---- lib/format/ataraid/nv.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/format/ataraid/nv.c b/lib/format/ataraid/nv.c index 893cc3a..bd4589c 100644 --- a/lib/format/ataraid/nv.c +++ b/lib/format/ataraid/nv.c @@ -216,9 +216,16 @@ static int setup_rd(struct lib_context *lc, struct raid_dev *rd, static struct raid_dev * nv_read(struct lib_context *lc, struct dev_info *di) { - return read_raid_dev(lc, di, NULL, - sizeof(struct nv), NV_CONFIGOFFSET, - to_cpu, is_nv, NULL, setup_rd, handler); + uint64_t sectors = di->alt_sectors ? di->alt_sectors : di->sectors; + struct raid_dev *rd; + + rd = read_raid_dev(lc, di, NULL, sizeof(struct nv), + NV_CONFIGOFFSET(sectors), + to_cpu, is_nv, NULL, setup_rd, handler); + if (rd && di->alt_sectors) + log_notice(lc, "%s: using BIOS sectors %"PRIu64, + di->path, di->alt_sectors); + return rd; } /* Write private RAID metadata to device */ @@ -427,7 +434,7 @@ setup_rd(struct lib_context *lc, struct raid_dev *rd, if (!(rd->meta_areas = alloc_meta_areas(lc, rd, handler, 1))) return 0; - rd->meta_areas->offset = NV_CONFIGOFFSET >> 9; + rd->meta_areas->offset = info->u64 >> 9; rd->meta_areas->size = sizeof(*nv); rd->meta_areas->area = (void *) nv; diff --git a/lib/format/ataraid/nv.h b/lib/format/ataraid/nv.h index 020900c..cca32da 100644 --- a/lib/format/ataraid/nv.h +++ b/lib/format/ataraid/nv.h @@ -23,7 +23,7 @@ #include -#define NV_CONFIGOFFSET ((di->sectors - 2) << 9) +#define NV_CONFIGOFFSET(sects) (((sects) - 2) << 9) #define NV_DATAOFFSET 0 #define NV_ID_LENGTH 8