The following changes since commit 18a56e5e5b942060a57b70114c1963bda777ce3f: Fio 1.41.5 (2010-06-25 14:34:14 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Greg Edwards (2): gracefully handle full /tmp file system fix posix_fallocate() return value usage filesetup.c | 4 ++-- mutex.c | 8 ++++++++ smalloc.c | 12 +++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) --- Diff of recent changes: diff --git a/filesetup.c b/filesetup.c index b90d12a..f088390 100644 --- a/filesetup.c +++ b/filesetup.c @@ -71,9 +71,9 @@ static int extend_file(struct thread_data *td, struct fio_file *f) f->real_file_size); r = posix_fallocate(f->fd, 0, f->real_file_size); - if (r < 0) { + if (r > 0) { log_err("fio: posix_fallocate fails: %s\n", - strerror(-r)); + strerror(r)); } } #endif diff --git a/mutex.c b/mutex.c index abe073f..88044f3 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; diff --git a/smalloc.c b/smalloc.c index 409998a..4cd8298 100644 --- a/smalloc.c +++ b/smalloc.c @@ -10,9 +10,11 @@ #include <unistd.h> #include <sys/types.h> #include <limits.h> +#include <fcntl.h> #include "mutex.h" #include "arch/arch.h" +#include "os/os.h" #define SMALLOC_REDZONE /* define to detect memory corruption */ @@ -176,7 +178,7 @@ static int find_next_zero(int word, int start) static int add_pool(struct pool *pool, unsigned int alloc_size) { - int fd, bitmap_blocks; + int fd, bitmap_blocks, ret; char file[] = "/tmp/.fio_smalloc.XXXXXX"; void *ptr; @@ -200,6 +202,14 @@ static int add_pool(struct pool *pool, unsigned int alloc_size) pool->nr_blocks = bitmap_blocks; pool->free_blocks = bitmap_blocks * SMALLOC_BPB; +#ifdef FIO_HAVE_FALLOCATE + ret = posix_fallocate(fd, 0, alloc_size); + if (ret > 0) { + fprintf(stderr, "posix_fallocate pool file failed: %s\n", strerror(ret)); + goto out_unlink; + } +#endif + if (ftruncate(fd, alloc_size) < 0) goto out_unlink; -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html