Date: Sun, 28 Feb 2010 17:16:43 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r204473 - head/sys/fs/msdosfs Message-ID: <201002281716.o1SHGhiU041642@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Feb 28 17:16:43 2010 New Revision: 204473 URL: http://svn.freebsd.org/changeset/base/204473 Log: Use pm_fatlock to protect per-filesystem rb tree used to allocate fileno on the large FAT volumes. Previously, a single global mutex was used. Tested by: pho MFC after: 3 weeks Modified: head/sys/fs/msdosfs/msdosfs_fileno.c Modified: head/sys/fs/msdosfs/msdosfs_fileno.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fileno.c Sun Feb 28 17:15:45 2010 (r204472) +++ head/sys/fs/msdosfs/msdosfs_fileno.c Sun Feb 28 17:16:43 2010 (r204473) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mount.h> -#include <sys/mutex.h> #include <fs/msdosfs/bpb.h> #include <fs/msdosfs/direntry.h> @@ -59,9 +58,6 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_MSDOSFSFILENO, "msdosfs_fileno", "MSDOSFS fileno mapping node"); -static struct mtx fileno_mtx; -MTX_SYSINIT(fileno, &fileno_mtx, "MSDOSFS fileno", MTX_DEF); - RB_PROTOTYPE(msdosfs_filenotree, msdosfs_fileno, mf_tree, msdosfs_fileno_compare) @@ -117,30 +113,30 @@ msdosfs_fileno_map(mp, fileno) } if (fileno < FILENO_FIRST_DYN) return ((uint32_t)fileno); - mtx_lock(&fileno_mtx); + MSDOSFS_LOCK_MP(pmp); key.mf_fileno64 = fileno; mf = RB_FIND(msdosfs_filenotree, &pmp->pm_filenos, &key); if (mf != NULL) { mapped = mf->mf_fileno32; - mtx_unlock(&fileno_mtx); + MSDOSFS_UNLOCK_MP(pmp); return (mapped); } if (pmp->pm_nfileno < FILENO_FIRST_DYN) panic("msdosfs_fileno_map: wraparound"); - mtx_unlock(&fileno_mtx); + MSDOSFS_UNLOCK_MP(pmp); mf = malloc(sizeof(*mf), M_MSDOSFSFILENO, M_WAITOK); - mtx_lock(&fileno_mtx); + MSDOSFS_LOCK_MP(pmp); tmf = RB_FIND(msdosfs_filenotree, &pmp->pm_filenos, &key); if (tmf != NULL) { mapped = tmf->mf_fileno32; - mtx_unlock(&fileno_mtx); + MSDOSFS_UNLOCK_MP(pmp); free(mf, M_MSDOSFSFILENO); return (mapped); } mf->mf_fileno64 = fileno; mapped = mf->mf_fileno32 = pmp->pm_nfileno++; RB_INSERT(msdosfs_filenotree, &pmp->pm_filenos, mf); - mtx_unlock(&fileno_mtx); + MSDOSFS_UNLOCK_MP(pmp); return (mapped); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002281716.o1SHGhiU041642>