Date: Mon, 10 Feb 2003 13:31:48 +1100 From: Tim Robbins <tjr@freebsd.org> To: Mike Makonnen <mtm@identd.net> Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>, current@freebsd.org Subject: Re: MSDOSFS wastes 256k when nothing is mounted! Message-ID: <20030210133148.A17199@dilbert.robbins.dropbear.id.au> 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 References: <31456.1044819599@critter.freebsd.dk> <20030209230848.VZI7113.pop015.verizon.net@kokeb.ambesa.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030210133148.A17199>