public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need()
Date: Mon, 17 Aug 2020 13:49:55 +0300	[thread overview]
Message-ID: <be8eec80-f60a-635e-6089-38ecdde08d60@suse.com> (raw)
In-Reply-To: <20200813063352.94447-1-wqu@suse.com>



On 13.08.20 г. 9:33 ч., Qu Wenruo wrote:
> We're just doing rounding up to sectorsize to calculate the lockend.
> 
> There is no need to do the unnecessary length calculation, just direct
> round_up() is enough.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/file.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 2f96f083eb8c..c71ea9e5c529 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1475,9 +1475,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
>  	int ret = 0;
>  
>  	start_pos = round_down(pos, fs_info->sectorsize);
> -	last_pos = start_pos
> -		+ round_up(pos + write_bytes - start_pos,
> -			   fs_info->sectorsize) - 1;
> +	last_pos = round_up(pos + write_bytes, fs_info->sectorsize) - 1;
>  
>  	if (start_pos < inode->vfs_inode.i_size) {
>  		struct btrfs_ordered_extent *ordered;
> 

  reply	other threads:[~2020-08-17 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13  6:33 [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need() Qu Wenruo
2020-08-17 10:49 ` Nikolay Borisov [this message]
2020-08-17 12:18 ` 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=be8eec80-f60a-635e-6089-38ecdde08d60@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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