From owner-freebsd-ia64@FreeBSD.ORG Mon Jun 28 03:59:28 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7F9E16A4CE; Mon, 28 Jun 2004 03:59:27 +0000 (GMT) Received: from eagle.sharma-home.net (cpe-24-221-178-208.ca.sprintbbd.net [24.221.178.208]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88AAB43D1F; Mon, 28 Jun 2004 03:59:27 +0000 (GMT) (envelope-from arun@freebsd.org) Received: from [192.168.1.254] (unknown [192.168.1.254]) by eagle.sharma-home.net (Postfix) with ESMTP id 13B061FF39; Sun, 27 Jun 2004 20:59:24 -0700 (PDT) Message-ID: <41072494.4060000@freebsd.org> From: Arun Sharma User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en MIME-Version: 1.0 To: John Baldwin References: <20040627071931.GA25902@sharma-home.net> <200406272344.53886.jhb@FreeBSD.org> In-Reply-To: <200406272344.53886.jhb@FreeBSD.org> Content-Type: multipart/mixed; boundary="------------010504020203090401090509" cc: freebsd-ia64@FreeBSD.org Subject: Re: Clobbering foreign partitions X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Mon, 28 Jun 2004 03:59:28 -0000 X-Original-Date: Tue, 27 Jul 2004 20:59:16 -0700 X-List-Received-Date: Mon, 28 Jun 2004 03:59:28 -0000 This is a multi-part message in MIME format. --------------010504020203090401090509 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit John Baldwin wrote: > > Looks ok to me. Marcel, do you think you can test this? > I also hacked the md driver so that I could test these scenerios without a second disk. The patch is attached. Since my ia64 box is currently having disk problems, I had to do the testing on i386 hardware, by compiling sysinstall/libdisk with -D__ia64__ -U__i386__. Certainly this needs to be revalidated on real ia64 hardware. -Arun --------------010504020203090401090509 Content-Type: text/plain; name="md-geom.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="md-geom.patch" Index: md.c =================================================================== RCS file: /net/eagle/home/scratch/freebsd/src/sys/dev/md/md.c,v retrieving revision 1.123 diff -u -r1.123 md.c --- md.c 18 May 2004 07:30:04 -0000 1.123 +++ md.c 25 Jun 2004 16:22:59 -0000 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ #include #include +#include #include #include @@ -165,6 +167,8 @@ /* MD_SWAP related fields */ vm_object_t object; unsigned npage; + + struct disk *disk; /* disklabel/slice stuff */ }; static int mddestroy(struct md_s *sc, struct thread *td); @@ -359,6 +363,36 @@ return (0); } + +static int +mdopen(struct disk *dp) +{ + struct md_s *sc; + + sc = dp->d_drv1; + if (sc == NULL || sc->flags & MD_SHUTDOWN) + return ENXIO; + return 0; +} + +static void +mdstrategy(struct bio *bp) +{ + struct md_s *sc; + + sc = bp->bio_disk->d_drv1; + + if (sc->flags & MD_SHUTDOWN) { + biofinish(bp, NULL, ENXIO); + return; + } + + mtx_lock(&sc->queue_mtx); + bioq_disksort(&sc->bio_queue, bp); + mtx_unlock(&sc->queue_mtx); + wakeup(sc); +} + static void g_md_start(struct bio *bp) { @@ -377,7 +411,6 @@ DECLARE_GEOM_CLASS(g_md_class, g_md); - static int mdstart_malloc(struct md_s *sc, struct bio *bp) { @@ -509,6 +542,8 @@ vn_finished_write(mp); } bp->bio_resid = auio.uio_resid; + biodone(bp); + return (error); } @@ -656,7 +691,7 @@ } } - if (error != -1) { + if ((error != -1) && (sc->type != MD_VNODE)) { bp->bio_completed = bp->bio_length; g_io_deliver(bp, error); } @@ -940,7 +975,20 @@ mddestroy(sc, td); return (error); } - mdinit(sc); + + /* lets create the disk device */ + sc->disk = disk_alloc(); + sc->disk->d_name = "md"; + sc->disk->d_drv1 = sc; + sc->disk->d_maxsize = DFLTPHYS; + sc->disk->d_sectorsize = sc->secsize; + sc->disk->d_mediasize = (off_t) sc->secsize * sc->nsect; + sc->disk->d_fwsectors = sc->nsect; + sc->disk->d_fwheads = sc->fwheads; + sc->disk->d_unit = sc->unit; + sc->disk->d_strategy = mdstrategy; + sc->disk->d_open = mdopen; + disk_create(sc->disk, DISK_VERSION); return (0); } @@ -982,6 +1030,8 @@ if (sc->uma) uma_zdestroy(sc->uma); + if (sc->disk) + disk_destroy(sc->disk); /* XXX: LOCK(unique unit numbers) */ LIST_REMOVE(sc, list); /* XXX: UNLOCK(unique unit numbers) */ --------------010504020203090401090509--