version 1.4.2.2, 2007/02/26 09:12:23 |
version 1.7, 2005/12/11 12:25:28 |
Line 74 static doff_t ufsdirhash_getprev(struct |
|
Line 74 static doff_t ufsdirhash_getprev(struct |
|
int dirblksiz); |
int dirblksiz); |
static int ufsdirhash_recycle(int wanted); |
static int ufsdirhash_recycle(int wanted); |
|
|
static POOL_INIT(ufsdirhash_pool, DH_NBLKOFF * sizeof(daddr_t), 0, 0, 0, |
POOL_INIT(ufsdirhash_pool, DH_NBLKOFF * sizeof(daddr_t), 0, 0, 0, "ufsdirhash", |
"ufsdirhash", &pool_allocator_nointr); |
&pool_allocator_nointr); |
|
|
#define DIRHASHLIST_LOCK() do { } while (0) |
#define DIRHASHLIST_LOCK() do { } while (0) |
#define DIRHASHLIST_UNLOCK() do { } while (0) |
#define DIRHASHLIST_UNLOCK() do { } while (0) |
Line 163 ufsdirhash_build(struct inode *ip) |
|
Line 163 ufsdirhash_build(struct inode *ip) |
|
DIRHASHLIST_UNLOCK(); |
DIRHASHLIST_UNLOCK(); |
return (-1); |
return (-1); |
} |
} |
dh->dh_hash = (doff_t **)malloc(narrays * sizeof(dh->dh_hash[0]), |
MALLOC(dh->dh_hash, doff_t **, narrays * sizeof(dh->dh_hash[0]), |
M_DIRHASH, M_NOWAIT | M_ZERO); |
M_DIRHASH, M_NOWAIT | M_ZERO); |
dh->dh_blkfree = (u_int8_t *)malloc(nblocks * sizeof(dh->dh_blkfree[0]), |
MALLOC(dh->dh_blkfree, u_int8_t *, nblocks * sizeof(dh->dh_blkfree[0]), |
M_DIRHASH, M_NOWAIT); |
M_DIRHASH, M_NOWAIT); |
if (dh->dh_hash == NULL || dh->dh_blkfree == NULL) |
if (dh->dh_hash == NULL || dh->dh_blkfree == NULL) |
goto fail; |
goto fail; |
Line 194 ufsdirhash_build(struct inode *ip) |
|
Line 194 ufsdirhash_build(struct inode *ip) |
|
bmask = VFSTOUFS(vp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; |
bmask = VFSTOUFS(vp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; |
pos = 0; |
pos = 0; |
while (pos < ip->i_size) { |
while (pos < ip->i_size) { |
if ((curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD) |
|
!= 0) { |
|
preempt(); |
|
} |
|
/* If necessary, get the next directory block. */ |
/* If necessary, get the next directory block. */ |
if ((pos & bmask) == 0) { |
if ((pos & bmask) == 0) { |
if (bp != NULL) |
if (bp != NULL) |
brelse(bp); |
brelse(bp); |
if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0) |
if (UFS_BLKATOFF(vp, (off_t)pos, NULL, &bp) != 0) |
goto fail; |
goto fail; |
} |
} |
|
|
|
|
if (bp != NULL) |
if (bp != NULL) |
brelse(bp); |
brelse(bp); |
blkoff = offset & ~bmask; |
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); |
return (EJUSTRETURN); |
} |
} |
dp = (struct direct *)(bp->b_data + (offset & bmask)); |
dp = (struct direct *)(bp->b_data + (offset & bmask)); |
Line 506 ufsdirhash_findfree(struct inode *ip, in |
|
Line 502 ufsdirhash_findfree(struct inode *ip, in |
|
dh->dh_blkfree[dirblock] >= howmany(slotneeded, DIRALIGN)); |
dh->dh_blkfree[dirblock] >= howmany(slotneeded, DIRALIGN)); |
DIRHASH_UNLOCK(dh); |
DIRHASH_UNLOCK(dh); |
pos = dirblock * dirblksiz; |
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) |
if (error) |
return (-1); |
return (-1); |
/* Find the first entry with free space. */ |
/* Find the first entry with free space. */ |