On 26.02.20 г. 7:56 ч., Qu Wenruo wrote:
> These two functions are weirdly named, mark_block_processed() in fact
> just mark a range dirty unconditionally, while __mark_block_processed()
> does extra check before doing the marking.
>
> Rename mark_block_processed() to mark_range_processed(), and rename
> __mark_block_processed() to mark_block_processed().
>
> Since we're here, also kill the forward declaration.
>
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> ---
> fs/btrfs/relocation.c | 65 +++++++++++++++++++++----------------------
> 1 file changed, 32 insertions(+), 33 deletions(-)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 1fe34d8eef6d..d81fa6d63129 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -189,8 +189,34 @@ struct reloc_control {
>
> static void remove_backref_node(struct backref_cache *cache,
> struct backref_node *node);
> -static void __mark_block_processed(struct reloc_control *rc,
> - struct backref_node *node);
> +
> +static int in_block_group(u64 bytenr, struct btrfs_block_group *block_group)
> +{
> + if (bytenr >= block_group->start &&
> + bytenr < block_group->start + block_group->length)
> + return 1;
> + return 0;
> +}
This function can be killed altogether and replaced with the in_range
macro defined in fs/btrfs/misc.h . The only difference is you'd have to
call it
in_range(bytenr, block_group->start, block_group->length);
Seeing how in_block_group is called in only 2 places I don't think it
will be a big loss.
> +
> +static void mark_range_processed(struct reloc_control *rc,
> + u64 bytenr, u32 blocksize)
> +{
> + set_extent_bits(&rc->processed_blocks, bytenr, bytenr + blocksize - 1,
> + EXTENT_DIRTY);
> +}
Having a wrapper just for this seems a bit pointless, remove it and open
code the set_extent_bit call in mark_block_processed.
<snip>