Skip to content

Commit

Permalink
io_uring: optimise kiocb_end_write for !ISREG
Browse files Browse the repository at this point in the history
file_end_write() is only for regular files, so the function do a couple
of dereferences to get inode and check for it. However, we already have
REQ_F_ISREG at hand, just use it and inline file_end_write().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Apr 11, 2021
1 parent 59d7001 commit 1c98679
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -2431,11 +2431,11 @@ static void kiocb_end_write(struct io_kiocb *req)
* thread.
*/
if (req->flags & REQ_F_ISREG) {
struct inode *inode = file_inode(req->file);
struct super_block *sb = file_inode(req->file)->i_sb;

__sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
__sb_writers_acquired(sb, SB_FREEZE_WRITE);
sb_end_write(sb);
}
file_end_write(req->file);
}

#ifdef CONFIG_BLOCK
Expand Down

0 comments on commit 1c98679

Please sign in to comment.