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.1.2.4 retrieving revision 1.4.2.1 diff -u -p -r1.1.2.4 -r1.4.2.1 --- src/sys/ufs/ufs/ufs_dirhash.c 2005/11/10 14:12:39 1.1.2.4 +++ src/sys/ufs/ufs/ufs_dirhash.c 2006/06/21 15:12:39 1.4.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_dirhash.c,v 1.1.2.4 2005/11/10 14:12:39 skrll Exp $ */ +/* $NetBSD: ufs_dirhash.c,v 1.4.2.1 2006/06/21 15:12:39 yamt Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. @@ -74,8 +74,8 @@ static doff_t ufsdirhash_getprev(struct int dirblksiz); static int ufsdirhash_recycle(int wanted); -POOL_INIT(ufsdirhash_pool, DH_NBLKOFF * sizeof(daddr_t), 0, 0, 0, "ufsdirhash", - &pool_allocator_nointr); +static POOL_INIT(ufsdirhash_pool, DH_NBLKOFF * sizeof(daddr_t), 0, 0, 0, + "ufsdirhash", &pool_allocator_nointr); #define DIRHASHLIST_LOCK() do { } while (0) #define DIRHASHLIST_UNLOCK() do { } while (0) @@ -163,9 +163,9 @@ ufsdirhash_build(struct inode *ip) DIRHASHLIST_UNLOCK(); return (-1); } - MALLOC(dh->dh_hash, doff_t **, narrays * sizeof(dh->dh_hash[0]), + dh->dh_hash = (doff_t **)malloc(narrays * sizeof(dh->dh_hash[0]), M_DIRHASH, M_NOWAIT | M_ZERO); - MALLOC(dh->dh_blkfree, u_int8_t *, nblocks * sizeof(dh->dh_blkfree[0]), + dh->dh_blkfree = (u_int8_t *)malloc(nblocks * sizeof(dh->dh_blkfree[0]), M_DIRHASH, M_NOWAIT); if (dh->dh_hash == NULL || dh->dh_blkfree == NULL) goto fail; @@ -194,11 +194,15 @@ ufsdirhash_build(struct inode *ip) bmask = VFSTOUFS(vp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; pos = 0; while (pos < ip->i_size) { + if ((curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD) + != 0) { + preempt(1); + } /* If necessary, get the next directory block. */ if ((pos & bmask) == 0) { if (bp != NULL) brelse(bp); - if (UFS_BLKATOFF(vp, (off_t)pos, NULL, &bp) != 0) + if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0) goto fail; } @@ -393,7 +397,7 @@ restart: if (bp != NULL) brelse(bp); blkoff = offset & ~bmask; - if (UFS_BLKATOFF(vp, (off_t)blkoff, NULL, &bp) != 0) + if (ufs_blkatoff(vp, (off_t)blkoff, NULL, &bp) != 0) return (EJUSTRETURN); } dp = (struct direct *)(bp->b_data + (offset & bmask)); @@ -502,7 +506,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); if (error) return (-1); /* Find the first entry with free space. */