summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c3
-rw-r--r--sys/sys/file.h10
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index ee3f7c9..db41fbd 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1037,7 +1037,7 @@ falloc(td, resultfp, resultfd)
FREE(fp, M_FILE);
return (error);
}
- mtx_init(&fp->f_mtx, "file structure", MTX_DEF);
+ fp->f_mtxp = mtx_pool_alloc();
fp->f_gcflag = 0;
fp->f_count = 1;
fp->f_cred = crhold(p->p_ucred);
@@ -1075,7 +1075,6 @@ ffree(fp)
nfiles--;
sx_xunlock(&filelist_lock);
crfree(fp->f_cred);
- mtx_destroy(&fp->f_mtx);
FREE(fp, M_FILE);
}
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 6986a38..b8a17c2 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -105,7 +105,7 @@ struct file {
off_t f_offset;
caddr_t f_data; /* vnode or socket */
u_int f_flag; /* see fcntl.h */
- struct mtx f_mtx; /* mutex to protect data */
+ struct mtx *f_mtxp; /* mutex to protect data */
};
#ifdef MALLOC_DECLARE
@@ -128,10 +128,10 @@ int fdrop __P((struct file *fp, struct thread *td));
int fdrop_locked __P((struct file *fp, struct thread *td));
/* Lock a file. */
-#define FILE_LOCK(f) mtx_lock(&(f)->f_mtx)
-#define FILE_UNLOCK(f) mtx_unlock(&(f)->f_mtx)
-#define FILE_LOCKED(f) mtx_owned(&(f)->f_mtx)
-#define FILE_LOCK_ASSERT(f, type) mtx_assert(&(f)->f_mtx, (type))
+#define FILE_LOCK(f) mtx_lock((f)->f_mtxp)
+#define FILE_UNLOCK(f) mtx_unlock((f)->f_mtxp)
+#define FILE_LOCKED(f) mtx_owned((f)->f_mtxp)
+#define FILE_LOCK_ASSERT(f, type) mtx_assert((f)->f_mtxp, (type))
int fgetvp __P((struct thread *td, int fd, struct vnode **vpp));
int fgetvp_read __P((struct thread *td, int fd, struct vnode **vpp));
OpenPOWER on IntegriCloud