Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ufs/ufs_dirhash.c
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
static int ufsdirhash_recycle(int wanted); | static int ufsdirhash_recycle(int wanted); | ||||
static void ufsdirhash_lowmem(void); | static void ufsdirhash_lowmem(void); | ||||
static void ufsdirhash_free_locked(struct inode *ip); | static void ufsdirhash_free_locked(struct inode *ip); | ||||
static uma_zone_t ufsdirhash_zone; | static uma_zone_t ufsdirhash_zone; | ||||
#define DIRHASHLIST_LOCK() mtx_lock(&ufsdirhash_mtx) | #define DIRHASHLIST_LOCK() mtx_lock(&ufsdirhash_mtx) | ||||
#define DIRHASHLIST_UNLOCK() mtx_unlock(&ufsdirhash_mtx) | #define DIRHASHLIST_UNLOCK() mtx_unlock(&ufsdirhash_mtx) | ||||
#define DIRHASH_BLKALLOC_WAITOK() uma_zalloc(ufsdirhash_zone, M_WAITOK) | #define DIRHASH_BLKALLOC() uma_zalloc(ufsdirhash_zone, M_NOWAIT) | ||||
markj: I would just drop the NOWAIT suffix, or get rid of the UMA wrappers entirely. | |||||
#define DIRHASH_BLKFREE(ptr) uma_zfree(ufsdirhash_zone, (ptr)) | #define DIRHASH_BLKFREE(ptr) uma_zfree(ufsdirhash_zone, (ptr)) | ||||
#define DIRHASH_ASSERT_LOCKED(dh) \ | #define DIRHASH_ASSERT_LOCKED(dh) \ | ||||
sx_assert(&(dh)->dh_lock, SA_LOCKED) | sx_assert(&(dh)->dh_lock, SA_LOCKED) | ||||
/* Dirhash list; recently-used entries are near the tail. */ | /* Dirhash list; recently-used entries are near the tail. */ | ||||
static TAILQ_HEAD(, dirhash) ufsdirhash_list; | static TAILQ_HEAD(, dirhash) ufsdirhash_list; | ||||
/* Protects: ufsdirhash_list, `dh_list' field, ufs_dirhashmem. */ | /* Protects: ufsdirhash_list, `dh_list' field, ufs_dirhashmem. */ | ||||
▲ Show 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | dh->dh_hash = malloc(narrays * sizeof(dh->dh_hash[0]), | ||||
M_DIRHASH, M_NOWAIT | M_ZERO); | M_DIRHASH, M_NOWAIT | M_ZERO); | ||||
if (dh->dh_hash == NULL) | if (dh->dh_hash == NULL) | ||||
goto fail; | goto fail; | ||||
dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]), | dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]), | ||||
M_DIRHASH, M_NOWAIT); | M_DIRHASH, M_NOWAIT); | ||||
if (dh->dh_blkfree == NULL) | if (dh->dh_blkfree == NULL) | ||||
goto fail; | goto fail; | ||||
for (i = 0; i < narrays; i++) { | for (i = 0; i < narrays; i++) { | ||||
if ((dh->dh_hash[i] = DIRHASH_BLKALLOC_WAITOK()) == NULL) | if ((dh->dh_hash[i] = DIRHASH_BLKALLOC()) == NULL) | ||||
goto fail; | goto fail; | ||||
for (j = 0; j < DH_NBLKOFF; j++) | for (j = 0; j < DH_NBLKOFF; j++) | ||||
dh->dh_hash[i][j] = DIRHASH_EMPTY; | dh->dh_hash[i][j] = DIRHASH_EMPTY; | ||||
} | } | ||||
for (i = 0; i < dirblocks; i++) | for (i = 0; i < dirblocks; i++) | ||||
dh->dh_blkfree[i] = DIRBLKSIZ / DIRALIGN; | dh->dh_blkfree[i] = DIRBLKSIZ / DIRALIGN; | ||||
bmask = vp->v_mount->mnt_stat.f_iosize - 1; | bmask = vp->v_mount->mnt_stat.f_iosize - 1; | ||||
pos = 0; | pos = 0; | ||||
▲ Show 20 Lines • Show All 891 Lines • Show Last 20 Lines |
I would just drop the NOWAIT suffix, or get rid of the UMA wrappers entirely.