linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Simplify len alignment calculation
Date: Mon, 2 Dec 2019 23:52:40 -0800	[thread overview]
Message-ID: <20191203075240.GB829117@vader> (raw)
In-Reply-To: <20191129093807.525-1-nborisov@suse.com>

On Fri, Nov 29, 2019 at 11:38:07AM +0200, Nikolay Borisov wrote:
> Use ALIGN() directly rather than achieving the same thing in a roundabout way.
> No semantic changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/delalloc-space.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/delalloc-space.c b/fs/btrfs/delalloc-space.c
> index 4cdac4d834f5..c08e905b0424 100644
> --- a/fs/btrfs/delalloc-space.c
> +++ b/fs/btrfs/delalloc-space.c
> @@ -142,8 +142,7 @@ int btrfs_check_data_free_space(struct inode *inode,
>  	int ret;
> 
>  	/* align the range */
> -	len = round_up(start + len, fs_info->sectorsize) -
> -	      round_down(start, fs_info->sectorsize);
> +	len = ALIGN(len, fs_info->sectorsize);

Consider sectorsize = 4096, start = 4095, len = 2. This range spans two
blocks, which is what the original compuation gives. Yours returns one
block instead.

  reply	other threads:[~2019-12-03  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29  9:38 [PATCH] btrfs: Simplify len alignment calculation Nikolay Borisov
2019-12-03  7:52 ` Omar Sandoval [this message]
2019-12-03  8:06   ` Nikolay Borisov

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=20191203075240.GB829117@vader \
    --to=osandov@osandov.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@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;
as well as URLs for NNTP newsgroup(s).