Skip to content

Commit

Permalink
io_uring: remove __io_file_supports_nowait
Browse files Browse the repository at this point in the history
Now that this only checks O_NONBLOCK and FMODE_NOWAIT, the helper is
complete overkilļ, and the comments are confusing bordering to wrong.
Just inline the check into the caller.

Signed-off-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 20, 2023
1 parent 4826c59 commit b9a6c94
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions io_uring/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,19 +1766,6 @@ static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_flags)
}
}

/*
* If we tracked the file through the SCM inflight mechanism, we could support
* any file. For now, just ensure that anything potentially problematic is done
* inline.
*/
static bool __io_file_supports_nowait(struct file *file, umode_t mode)
{
/* any ->read/write should understand O_NONBLOCK */
if (file->f_flags & O_NONBLOCK)
return true;
return file->f_mode & FMODE_NOWAIT;
}

/*
* If we tracked the file through the SCM inflight mechanism, we could support
* any file. For now, just ensure that anything potentially problematic is done
Expand All @@ -1791,7 +1778,7 @@ unsigned int io_file_get_flags(struct file *file)

if (S_ISREG(mode))
res |= FFS_ISREG;
if (__io_file_supports_nowait(file, mode))
if ((file->f_flags & O_NONBLOCK) || (file->f_mode & FMODE_NOWAIT))
res |= FFS_NOWAIT;
return res;
}
Expand Down

0 comments on commit b9a6c94

Please sign in to comment.