X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=backend.c;h=d1fe9641d88ebaa47489fc10a8f039e9443bbc10;hb=6418b9cd79dadc5c42beac4a6f1f396184ab4d5b;hp=6461fff70c21aa37192d3c2dd40a1831543b7a05;hpb=5bd5f71a3e54950fb4bee64c7ad5edc67e40b8c8;p=fio.git diff --git a/backend.c b/backend.c index 6461fff7..d1fe9641 100644 --- a/backend.c +++ b/backend.c @@ -322,6 +322,21 @@ requeue: return 0; } +static int fio_file_fsync(struct thread_data *td, struct fio_file *f) +{ + int ret; + + if (fio_file_open(f)) + return fio_io_sync(td, f); + + if (td_io_open_file(td, f)) + return 1; + + ret = fio_io_sync(td, f); + td_io_close_file(td, f); + return ret; +} + static inline void __update_tv_cache(struct thread_data *td) { fio_gettime(&td->tv_cache, NULL); @@ -822,9 +837,11 @@ sync_done: td_set_runstate(td, TD_FSYNCING); for_each_file(td, f, i) { - if (!fio_file_open(f)) + if (!fio_file_fsync(td, f)) continue; - fio_io_sync(td, f); + + log_err("fio: end_fsync failed for file %s\n", + f->file_name); } } } else