From: Jens Axboe Date: Mon, 8 Aug 2016 15:46:06 +0000 (-0600) Subject: ioengines: fixup td_io_unlink_file() error propagation X-Git-Tag: fio-2.14~52 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=2442c9353bdc597301dfa75a5da78dcce3708a75 ioengines: fixup td_io_unlink_file() error propagation Return 0 for success, error number on error. gluster already did this, but pmemblk did not. Signed-off-by: Jens Axboe --- diff --git a/engines/pmemblk.c b/engines/pmemblk.c index 6d19864a..ca726978 100644 --- a/engines/pmemblk.c +++ b/engines/pmemblk.c @@ -475,7 +475,7 @@ static int fio_pmemblk_unlink_file(struct thread_data *td, struct fio_file *f) pmb_parse_path(f->file_name, &path, &bsize, &fsize); if (!path) - return 1; + return ENOENT; unlink(path); free(path); diff --git a/filesetup.c b/filesetup.c index 1ecdda61..42a9f415 100644 --- a/filesetup.c +++ b/filesetup.c @@ -58,8 +58,12 @@ static int extend_file(struct thread_data *td, struct fio_file *f) unlink_file = 1; if (unlink_file || new_layout) { + int ret; + dprint(FD_FILE, "layout unlink %s\n", f->file_name); - if ((td_io_unlink_file(td, f) < 0) && (errno != ENOENT)) { + + ret = td_io_unlink_file(td, f); + if (ret != 0 && ret != ENOENT) { td_verror(td, errno, "unlink"); return 1; } diff --git a/ioengines.c b/ioengines.c index 4129ac23..a06909e0 100644 --- a/ioengines.c +++ b/ioengines.c @@ -521,8 +521,15 @@ int td_io_unlink_file(struct thread_data *td, struct fio_file *f) { if (td->io_ops->unlink_file) return td->io_ops->unlink_file(td, f); - else - return unlink(f->file_name); + else { + int ret; + + ret = unlink(f->file_name); + if (ret < 0) + return errno; + + return 0; + } } int td_io_get_file_size(struct thread_data *td, struct fio_file *f)