]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
io_uring: optimise kiocb_end_write for !ISREG
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 22 Mar 2021 01:58:31 +0000 (01:58 +0000)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Apr 2021 23:41:59 +0000 (17:41 -0600)
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>
fs/io_uring.c

index 605f253e8f9399b8a6648a7c1c30c7189b04caf3..a3a0348ab6eb7ab3605ef069787921d6db4d7271 100644 (file)
@@ -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