Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/ufs/ufs/ufs_dirhash.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/ufs/ufs/ufs_dirhash.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.4.2.4 retrieving revision 1.21.6.1 diff -u -p -r1.4.2.4 -r1.21.6.1 --- src/sys/ufs/ufs/ufs_dirhash.c 2007/10/27 11:36:51 1.4.2.4 +++ src/sys/ufs/ufs/ufs_dirhash.c 2008/06/02 13:24:37 1.21.6.1 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_dirhash.c,v 1.4.2.4 2007/10/27 11:36:51 yamt Exp $ */ +/* $NetBSD: ufs_dirhash.c,v 1.21.6.1 2008/06/02 13:24:37 mjf Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.4.2.4 2007/10/27 11:36:51 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.21.6.1 2008/06/02 13:24:37 mjf Exp $"); /* * This implements a hash-based lookup scheme for UFS directories. @@ -76,14 +76,16 @@ static doff_t ufsdirhash_getprev(struct int dirblksiz); static int ufsdirhash_recycle(int wanted); -static struct pool ufsdirhash_pool; +static pool_cache_t ufsdirhash_cache; #define DIRHASHLIST_LOCK() mutex_enter(&ufsdirhash_lock) #define DIRHASHLIST_UNLOCK() mutex_exit(&ufsdirhash_lock) #define DIRHASH_LOCK(dh) mutex_enter(&(dh)->dh_lock) #define DIRHASH_UNLOCK(dh) mutex_exit(&(dh)->dh_lock) -#define DIRHASH_BLKALLOC_WAITOK() pool_get(&ufsdirhash_pool, PR_WAITOK) -#define DIRHASH_BLKFREE(ptr) pool_put(&ufsdirhash_pool, ptr) +#define DIRHASH_BLKALLOC_WAITOK() \ + pool_cache_get(ufsdirhash_cache, PR_WAITOK) +#define DIRHASH_BLKFREE(ptr) \ + pool_cache_put(ufsdirhash_cache, ptr) /* Dirhash list; recently-used entries are near the tail. */ static TAILQ_HEAD(, dirhash) ufsdirhash_list; @@ -217,7 +219,7 @@ ufsdirhash_build(struct inode *ip) if ((pos & bmask) == 0) { if (bp != NULL) brelse(bp, 0); - if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0) + if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp, false) != 0) goto fail; } @@ -414,7 +416,8 @@ restart: if (bp != NULL) brelse(bp, 0); blkoff = offset & ~bmask; - if (ufs_blkatoff(vp, (off_t)blkoff, NULL, &bp) != 0) + if (ufs_blkatoff(vp, (off_t)blkoff, + NULL, &bp, true) != 0) return (EJUSTRETURN); } dp = (struct direct *)((char *)bp->b_data + (offset & bmask)); @@ -523,7 +526,7 @@ ufsdirhash_findfree(struct inode *ip, in dh->dh_blkfree[dirblock] >= howmany(slotneeded, DIRALIGN)); DIRHASH_UNLOCK(dh); pos = dirblock * dirblksiz; - error = ufs_blkatoff(ip->i_vnode, (off_t)pos, (void *)&dp, &bp); + error = ufs_blkatoff(ip->i_vnode, (off_t)pos, (void *)&dp, &bp, false); if (error) return (-1); /* Find the first entry with free space. */ @@ -1075,8 +1078,8 @@ ufsdirhash_init() mutex_init(&ufsdirhash_lock, MUTEX_DEFAULT, IPL_NONE); malloc_type_attach(M_DIRHASH); - pool_init(&ufsdirhash_pool, DH_NBLKOFF * sizeof(daddr_t), 0, 0, 0, - "ufsdirhash", &pool_allocator_nointr, IPL_NONE); + ufsdirhash_cache = pool_cache_init(DH_NBLKOFF * sizeof(daddr_t), 0, + 0, 0, "ufsdirhash", NULL, IPL_NONE, NULL, NULL, NULL); TAILQ_INIT(&ufsdirhash_list); } @@ -1085,7 +1088,7 @@ ufsdirhash_done(void) { KASSERT(TAILQ_EMPTY(&ufsdirhash_list)); - pool_destroy(&ufsdirhash_pool); + pool_cache_destroy(ufsdirhash_cache); malloc_type_detach(M_DIRHASH); mutex_destroy(&ufsdirhash_lock); }