Re: [PATCH v2 2/2] ext2, ext4: use the super_block dax_device

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

 



On Sun 27-08-17 20:48:46, Dan Williams wrote:
> The ->iomap_begin() operation is a hot path, and now that mount_bdev()
> arranges for the dax_device to be populated in the super_block, we can
> just reference that attribute directly rather than perform a new lookup.
> 
> Cc: Jan Kara <jack@xxxxxxxx>
> Cc: "Theodore Ts'o" <tytso@xxxxxxx>
> Cc: Andreas Dilger <adilger.kernel@xxxxxxxxx>
> Reported-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>

Looks good. You can add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza


> ---
>  fs/ext2/inode.c |   10 ++--------
>  fs/ext4/inode.c |   10 ++--------
>  2 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index 30163d007b2f..7102b77a83c6 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -800,7 +800,6 @@ int ext2_get_block(struct inode *inode, sector_t iblock,
>  static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  		unsigned flags, struct iomap *iomap)
>  {
> -	struct block_device *bdev;
>  	unsigned int blkbits = inode->i_blkbits;
>  	unsigned long first_block = offset >> blkbits;
>  	unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits;
> @@ -814,13 +813,9 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  		return ret;
>  
>  	iomap->flags = 0;
> -	bdev = inode->i_sb->s_bdev;
> -	iomap->bdev = bdev;
> +	iomap->bdev = inode->i_sb->s_bdev;
>  	iomap->offset = (u64)first_block << blkbits;
> -	if (blk_queue_dax(bdev->bd_queue))
> -		iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);
> -	else
> -		iomap->dax_dev = NULL;
> +	iomap->dax_dev = inode->i_sb->s_daxdev;
>  
>  	if (ret == 0) {
>  		iomap->type = IOMAP_HOLE;
> @@ -842,7 +837,6 @@ static int
>  ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length,
>  		ssize_t written, unsigned flags, struct iomap *iomap)
>  {
> -	fs_put_dax(iomap->dax_dev);
>  	if (iomap->type == IOMAP_MAPPED &&
>  	    written < length &&
>  	    (flags & IOMAP_WRITE))
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index c774bdc22759..311690522366 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3404,7 +3404,6 @@ static int ext4_releasepage(struct page *page, gfp_t wait)
>  static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  			    unsigned flags, struct iomap *iomap)
>  {
> -	struct block_device *bdev;
>  	unsigned int blkbits = inode->i_blkbits;
>  	unsigned long first_block = offset >> blkbits;
>  	unsigned long last_block = (offset + length - 1) >> blkbits;
> @@ -3473,12 +3472,8 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  	}
>  
>  	iomap->flags = 0;
> -	bdev = inode->i_sb->s_bdev;
> -	iomap->bdev = bdev;
> -	if (blk_queue_dax(bdev->bd_queue))
> -		iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);
> -	else
> -		iomap->dax_dev = NULL;
> +	iomap->bdev = inode->i_sb->s_bdev;
> +	iomap->dax_dev = inode->i_sb->s_daxdev;
>  	iomap->offset = first_block << blkbits;
>  
>  	if (ret == 0) {
> @@ -3511,7 +3506,6 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length,
>  	int blkbits = inode->i_blkbits;
>  	bool truncate = false;
>  
> -	fs_put_dax(iomap->dax_dev);
>  	if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT))
>  		return 0;
>  
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux