Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 3/3] btrfs: Use for loop in prealloc_file_extent_cluster
Date: Wed, 17 Jun 2020 16:18:35 +0300	[thread overview]
Message-ID: <040e42ef-7582-e5d8-5933-8bfb504c2c9a@suse.com> (raw)
In-Reply-To: <SN4PR0401MB35988C7F273C9359252FAE099B9A0@SN4PR0401MB3598.namprd04.prod.outlook.com>



On 17.06.20 г. 16:02 ч., Johannes Thumshirn wrote:
> Looks good,
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> 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.

  reply	other threads:[~2020-06-17 13:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  9:10 [PATCH 0/3] Refactor prealloc_file_extent_cluster Nikolay Borisov
2020-06-17  9:10 ` [PATCH 1/3] btrfs: Remove hole check in prealloc_file_extent_cluster Nikolay Borisov
2020-06-17 12:57   ` Johannes Thumshirn
2020-06-17 16:22   ` David Sterba
2020-06-17  9:10 ` [PATCH 2/3] btrfs: Perform data management operations outside of inode lock Nikolay Borisov
2020-06-17 12:54   ` Johannes Thumshirn
2020-06-17  9:10 ` [PATCH 3/3] btrfs: Use for loop in prealloc_file_extent_cluster Nikolay Borisov
2020-06-17 13:02   ` Johannes Thumshirn
2020-06-17 13:18     ` Nikolay Borisov [this message]
2020-06-17 16:38 ` [PATCH 0/3] Refactor prealloc_file_extent_cluster David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=040e42ef-7582-e5d8-5933-8bfb504c2c9a@suse.com \
    --to=nborisov@suse.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox