From owner-freebsd-current Sun Feb 9 18:32: 7 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EA6C37B401 for ; Sun, 9 Feb 2003 18:32:05 -0800 (PST) Received: from smtp03.iprimus.com.au (smtp03.iprimus.com.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1ED8C43FAF for ; Sun, 9 Feb 2003 18:32:04 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from smtp01.iprimus.net.au (210.50.30.70) by smtp03.iprimus.com.au (6.7.010) id 3E3E0A81001198B2 for current@freebsd.org; Mon, 10 Feb 2003 13:32:02 +1100 Received: from dilbert.robbins.dropbear.id.au ([203.134.133.33]) by smtp01.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Mon, 10 Feb 2003 13:32:01 +1100 Received: from dilbert.robbins.dropbear.id.au (fnyu68xfz7osdryp@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id h1A2Vo7W017792; Mon, 10 Feb 2003 13:31:50 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id h1A2VmTe017791; Mon, 10 Feb 2003 13:31:48 +1100 (EST) (envelope-from tim) Date: Mon, 10 Feb 2003 13:31:48 +1100 From: Tim Robbins To: Mike Makonnen Cc: Poul-Henning Kamp , current@freebsd.org Subject: Re: MSDOSFS wastes 256k when nothing is mounted! Message-ID: <20030210133148.A17199@dilbert.robbins.dropbear.id.au> References: <31456.1044819599@critter.freebsd.dk> <20030209230848.VZI7113.pop015.verizon.net@kokeb.ambesa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030209230848.VZI7113.pop015.verizon.net@kokeb.ambesa.net>; from mtm@identd.net on Sun, Feb 09, 2003 at 06:08:47PM -0500 X-OriginalArrivalTime: 10 Feb 2003 02:32:01.0971 (UTC) FILETIME=[97CF9030:01C2D0AC] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Feb 09, 2003 at 06:08:47PM -0500, Mike Makonnen wrote: > How about the attached? > > It's only partially tested since it seems I can't mount any msdos floppies (both > on this _and_ my previous kernel). > Index: sys/fs/msdosfs/msdosfs_denode.c > =================================================================== > RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_denode.c,v > retrieving revision 1.67 > diff -u -r1.67 msdosfs_denode.c > --- sys/fs/msdosfs/msdosfs_denode.c 21 Jan 2003 08:55:46 -0000 1.67 > +++ sys/fs/msdosfs/msdosfs_denode.c 9 Feb 2003 22:14:41 -0000 > @@ -73,6 +73,12 @@ > static u_long dehash; /* size of hash table - 1 */ > #define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / > \ sizeof(struct direntry)) & dehash]) > +#define DEHASH_INIT do {\ > + if (dehashtbl == NULL) {\ > + dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);\ > + KASSERT(dehashtbl != NULL, "msdosfs dehashtbl == NULL");\ > + }\ > + } while (0) > static struct mtx dehash_mtx; > > union _qcvt { [...] > @@ -130,6 +138,7 @@ > > loop: > mtx_lock(&dehash_mtx); > + DEHASH_INIT; > for (dep = DEHASH(dev, dirclust, diroff); dep; dep = dep->de_next) { > if (dirclust == dep->de_dirclust > && diroff == dep->de_diroffset hashinit() can sleep, and I don't think it's safe to sleep here (msdosfs_hashget() and msdosfs_hashins()) with dehash_mtx and sometimes a vnode lock held. It might be better to initialise the table the first time an msdosfs filesystem is mounted. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message