[lustre-devel] [PATCH 06/29] lustre: osc: use overlapped() consistently.
Andreas Dilger
adilger at whamcloud.com
Wed Jan 9 18:01:08 PST 2019
On Jan 8, 2019, at 23:24, NeilBrown <neilb at suse.com> wrote:
>
> osc_extent_is_overlapped() open-codes exactly the test that
> overlapped() performs.
> So use overlapped() instead, to make the code more obviously
> consistent.
>
> Signed-off-by: NeilBrown <neilb at suse.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
> ---
> drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
> index cab1a4f99cc2..dd3c87124aa5 100644
> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
> @@ -313,6 +313,11 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
> __res; \
> })
>
> +static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2)
> +{
> + return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start);
> +}
> +
> /**
> * sanity check - to make sure there is no overlapped extent in the tree.
> */
> @@ -329,8 +334,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj,
> for (tmp = first_extent(obj); tmp; tmp = next_extent(tmp)) {
> if (tmp == ext)
> continue;
> - if (tmp->oe_end >= ext->oe_start &&
> - tmp->oe_start <= ext->oe_end)
> + if (overlapped(tmp, ext))
> return 1;
> }
> return 0;
> @@ -655,11 +659,6 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext)
> osc_extent_put(env, ext);
> }
>
> -static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2)
> -{
> - return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start);
> -}
> -
> /**
> * Find or create an extent which includes @index, core function to manage
> * extent tree.
>
>
Cheers, Andreas
---
Andreas Dilger
CTO Whamcloud
More information about the lustre-devel
mailing list