X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=mutex.c;h=e33e7cc8f2611a42256e72a3bceddf9e7560b1ef;hp=abe073f4ffdf7d49ee92500db8d89e254def2852;hb=b8d42b234f70ce2927e9ef1279aff42d62779cfd;hpb=7452440e1efb40680fdc951eebc7499a95a62f86 diff --git a/mutex.c b/mutex.c index abe073f4..e33e7cc8 100644 --- a/mutex.c +++ b/mutex.c @@ -33,6 +33,10 @@ struct fio_mutex *fio_mutex_init(int value) return NULL; } +#ifdef FIO_HAVE_FALLOCATE + posix_fallocate(fd, 0, sizeof(struct fio_mutex)); +#endif + if (ftruncate(fd, sizeof(struct fio_mutex)) < 0) { perror("ftruncate mutex"); goto err; @@ -85,6 +89,9 @@ struct fio_mutex *fio_mutex_init(int value) goto err; } + pthread_condattr_destroy(&cond); + pthread_mutexattr_destroy(&attr); + return mutex; err: if (mutex)