Re: [PATCH v2 09/12] btrfs: Factor out in_range macro

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

 



On Mon, Feb 11, 2019 at 10:35:07AM +0200, Nikolay Borisov wrote:
> This is used in more than one places so let's factor it out in ctree.h.
> No functional changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>

Reviewed-by: David Sterba <dsterba@xxxxxxxx>

> ---
>  fs/btrfs/ctree.h       | 2 ++
>  fs/btrfs/extent-tree.c | 1 -
>  fs/btrfs/volumes.c     | 1 -
>  3 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 86dbf2160ae2..c61fff4c294d 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3808,6 +3808,8 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
>  	return signal_pending(current);
>  }
>  
> +#define in_range(b, first, len) ((b) >= (first) && (b) < (first) + (len))

I think it's time to add a new file for such small helpers and not
clutter ctree.h. There's math.h but too specific (and we did object
against that back then but, well). Something like utils.h or common.h
would be good, with eg. the assert macros or cond_wake_mb, and the math
helpers too. That's for later and does not affect this patchet.



[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