From: Jens Axboe Date: Thu, 6 Mar 2008 11:06:30 +0000 (+0100) Subject: Always make job use open() instead of dup(), even for shared files X-Git-Tag: fio-1.20-rc2~2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e8670ef8b26039573fbf835b4b95ba45a1039d83;p=fio.git 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 --- 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); }