Re: [PATCH v2 1/3] block: cache bdev in struct file for raw bdev IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 13, 2021 at 09:57:11AM +0100, Pavel Begunkov wrote:
> 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@xxxxxxxxx>
> ---
>  block/fops.c | 29 +++++++++++++----------------
>  1 file changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/block/fops.c b/block/fops.c
> index 7bb9581a146c..c71e91cd6bcb 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -17,7 +17,7 @@
>  #include <linux/fs.h>
>  #include "blk.h"
>  
> -static struct inode *bdev_file_inode(struct file *file)
> +static inline struct inode *bdev_file_inode(struct file *file)
>  {
>  	return file->f_mapping->host;
>  }

This is unrelated to the rest.

But the actual described change looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux