block: cache bdev in struct file for raw bdev IO
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 13 Oct 2021 08:57:11 +0000 (09:57 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 12:17:36 +0000 (06:17 -0600)
commitfac7c6d529acf2b5428ad08c1b1127e29e570790
tree4398d7651c06bb814bfc095fc217121dbbf15d4a
parentc712dccc64357b94f93e57882373e1365f0e2a56
block: cache bdev in struct file for raw bdev IO

bdev = &BDEV_I(file->f_mapping->host)->bdev

Getting struct block_device from a file requires 2 memory dereferences
as illustrated above, that takes a toll on performance, so cache it in
yet unused file->private_data. That gives a noticeable peak performance
improvement.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/8415f9fe12e544b9da89593dfbca8de2b52efe03.1634115360.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/fops.c