}
static int fio_sgio_getevents(struct thread_data *td, unsigned int min,
- unsigned int max, struct timespec fio_unused *t)
+ unsigned int max,
+ const struct timespec fio_unused *t)
{
struct sgio_data *sd = td->io_ops->data;
int left = max, ret, r = 0;
* don't block for min events == 0
*/
if (!min)
- fio_set_fd_nonblocking(f->fd, "sg");
+ sd->fd_flags[i] = fio_set_fd_nonblocking(f->fd, "sg");
+ else
+ sd->fd_flags[i] = -1;
sd->pfds[i].fd = f->fd;
sd->pfds[i].events = POLLIN;
if (!min) {
for_each_file(td, f, i) {
+ if (sd->fd_flags[i] == -1)
+ continue;
+
if (fcntl(f->fd, F_SETFL, sd->fd_flags[i]) < 0)
log_err("fio: sg failed to restore fcntl flags: %s\n", strerror(errno));
}