From e8670ef8b26039573fbf835b4b95ba45a1039d83 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 6 Mar 2008 12:06:30 +0100 Subject: [PATCH] Always make job use open() instead of dup(), even for shared files The fd may be opened after other jobs are forked, thus they wont share fd space (unless the 'thread' option is used). Signed-off-by: Jens Axboe --- filesetup.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/filesetup.c b/filesetup.c index eedb3dc3..3eba27e1 100644 --- a/filesetup.c +++ b/filesetup.c @@ -245,15 +245,13 @@ static int file_lookup_open(struct fio_file *f, int flags) f->lock_owner = __f->lock_owner; f->lock_batch = __f->lock_batch; f->lock_ddir = __f->lock_ddir; - f->fd = dup(__f->fd); - f->references++; from_hash = 1; } else { dprint(FD_FILE, "file not found in hash %s\n", f->file_name); - f->fd = open(f->file_name, flags, 0600); from_hash = 0; } + f->fd = open(f->file_name, flags, 0600); return from_hash; } @@ -320,10 +318,7 @@ open_again: goto open_again; } - if (from_hash) - snprintf(buf, sizeof(buf) - 1, "dup(%s)", f->file_name); - else - snprintf(buf, sizeof(buf) - 1, "open(%s)",f->file_name); + snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name); td_verror(td, __e, buf); } -- 2.25.1