X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=mutex.c;h=c1ce2a3e8740de808e70076a141b642646f9087f;hp=abe073f4ffdf7d49ee92500db8d89e254def2852;hb=03e20d687566753b90383571e5e152c5142bdffd;hpb=7452440e1efb40680fdc951eebc7499a95a62f86 diff --git a/mutex.c b/mutex.c index abe073f4..c1ce2a3e 100644 --- a/mutex.c +++ b/mutex.c @@ -33,6 +33,14 @@ struct fio_mutex *fio_mutex_init(int value) return NULL; } +#ifdef FIO_HAVE_FALLOCATE + ret = posix_fallocate(fd, 0, sizeof(struct fio_mutex)); + if (ret > 0) { + fprintf(stderr, "posix_fallocate mutex failed: %s\n", strerror(ret)); + goto err; + } +#endif + if (ftruncate(fd, sizeof(struct fio_mutex)) < 0) { perror("ftruncate mutex"); goto err; @@ -85,6 +93,9 @@ struct fio_mutex *fio_mutex_init(int value) goto err; } + pthread_condattr_destroy(&cond); + pthread_mutexattr_destroy(&attr); + return mutex; err: if (mutex)