ioengines: fixup td_io_unlink_file() error propagation
authorJens Axboe <axboe@fb.com>
Mon, 8 Aug 2016 15:46:06 +0000 (09:46 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 8 Aug 2016 15:46:06 +0000 (09:46 -0600)
Return 0 for success, error number on error. gluster already did this,
but pmemblk did not.

Signed-off-by: Jens Axboe <axboe@fb.com>
engines/pmemblk.c
filesetup.c
ioengines.c

index 6d19864ae0dbf8d3b884e1f4743ba92a0bf61854..ca72697819511dc1190658bc687d2f5534f621f4 100644 (file)
@@ -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);
index 1ecdda61c3f460f8ae03dda4a6a5cce9c7fd5278..42a9f4155fbf13a8a284c9070de8f110d80c6001 100644 (file)
@@ -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;
                }
index 4129ac2363b9757baf89e54788f94b656746e824..a06909e0ff9d5140c3ea065dbb2a5821c27e68a3 100644 (file)
@@ -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)