Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_descrip.c
Context not available. | |||||
static __read_mostly uma_zone_t file_zone; | static __read_mostly uma_zone_t file_zone; | ||||
static __read_mostly uma_zone_t filedesc0_zone; | static __read_mostly uma_zone_t filedesc0_zone; | ||||
static __read_mostly uma_zone_t pwd_zone; | __read_mostly uma_zone_t pwd_zone; | ||||
static __read_mostly smr_t pwd_smr; | extern smr_t vfs_smr; | ||||
static int closefp(struct filedesc *fdp, int fd, struct file *fp, | static int closefp(struct filedesc *fdp, int fd, struct file *fp, | ||||
struct thread *td, int holdleaders); | struct thread *td, int holdleaders); | ||||
Context not available. | |||||
fdp = td->td_proc->p_fd; | fdp = td->td_proc->p_fd; | ||||
smr_enter(pwd_smr); | smr_enter(vfs_smr); | ||||
for (;;) { | for (;;) { | ||||
pwd = smr_entered_load(&fdp->fd_pwd, pwd_smr); | pwd = smr_entered_load(&fdp->fd_pwd, vfs_smr); | ||||
MPASS(pwd != NULL); | MPASS(pwd != NULL); | ||||
if (refcount_acquire_if_not_zero(&pwd->pwd_refcount)) | if (refcount_acquire_if_not_zero(&pwd->pwd_refcount)) | ||||
break; | break; | ||||
} | } | ||||
smr_exit(pwd_smr); | smr_exit(vfs_smr); | ||||
return (pwd); | |||||
} | |||||
struct pwd * | |||||
pwd_get_smr(void) | |||||
{ | |||||
struct pwd *pwd; | |||||
pwd = smr_entered_load(&curproc->p_fd->fd_pwd, vfs_smr); | |||||
MPASS(pwd != NULL); | |||||
return (pwd); | return (pwd); | ||||
} | } | ||||
Context not available. | |||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); | ||||
pwd_zone = uma_zcreate("PWD", sizeof(struct pwd), NULL, NULL, | pwd_zone = uma_zcreate("PWD", sizeof(struct pwd), NULL, NULL, | ||||
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_SMR); | NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_SMR); | ||||
pwd_smr = uma_zone_get_smr(pwd_zone); | vfs_smr = uma_zone_get_smr(pwd_zone); | ||||
mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); | mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); | ||||
} | } | ||||
SYSINIT(select, SI_SUB_LOCK, SI_ORDER_FIRST, filelistinit, NULL); | SYSINIT(select, SI_SUB_LOCK, SI_ORDER_FIRST, filelistinit, NULL); | ||||
Context not available. |