Re: [PATCH] btrfs: Simplify len alignment calculation

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

 



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@xxxxxxxx>
> ---
>  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.



[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