Re: [PATCH 3/3] btrfs: Use for loop in prealloc_file_extent_cluster

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

 




On 17.06.20 г. 16:02 ч., Johannes Thumshirn wrote:
> Looks good,
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> 
> I've you have to re-post another potential candidate in this 
> function would be:
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 9235c671bef8..3ebf64578a32 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -2578,7 +2578,8 @@ int prealloc_file_extent_cluster(struct inode *inode,
>         u64 alloc_hint = 0;
>         u64 start;
>         u64 end;
> -       u64 offset = BTRFS_I(inode)->index_cnt;
> +       struct btrfs_inode *btrfs_inode = BTRFS_I(inode);
> +       u64 offset = btrfs_inode->index_cnt;
>         u64 num_bytes;
>         int nr = 0;
>         int ret = 0;
> @@ -2589,7 +2590,7 @@ int prealloc_file_extent_cluster(struct inode *inode,
>         BUG_ON(cluster->start != cluster->boundary[0]);
>         inode_lock(inode);
>  
> -       ret = btrfs_alloc_data_chunk_ondemand(BTRFS_I(inode),
> +       ret = btrfs_alloc_data_chunk_ondemand(btrfs_inode,
>                                               prealloc_end + 1 - prealloc_start);
>         if (ret)
>                 goto out;
> @@ -2611,7 +2612,7 @@ int prealloc_file_extent_cluster(struct inode *inode,
>                                                 num_bytes, num_bytes,
>                                                 end + 1, &alloc_hint);
>                 cur_offset = end + 1;
> -               unlock_extent(&BTRFS_I(inode)->io_tree, start, end);
> +               unlock_extent(&btrfs_inode->io_tree, start, end);
>                 if (ret)
>                         break;
>                 nr++;
> 
> 
> This would save 3 BTRFS_I() calls, but not sure how much of a difference it
> makes in the end.
> 

As a matter of fact I've already done this in my monstrous in patch 44/46.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux