[lustre-devel] [PATCH 04/29] lustre: osc: simplify list manipulation
Andreas Dilger
adilger at whamcloud.com
Wed Jan 9 17:58:56 PST 2019
> On Jan 8, 2019, at 23:24, NeilBrown <neilb at suse.com> wrote:
>
> when A is empty,
> list_move_tail(&A, &B);
> is identical to
> list_add_tail(&A, &B);
>
> so always use list_move_tail() - it is easier to understand.
>
> Signed-off-by: NeilBrown <neilb at suse.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
> ---
> drivers/staging/lustre/lustre/osc/osc_cache.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
> index 00056dffceb9..6771675dd520 100644
> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
> @@ -2885,10 +2885,7 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj,
> }
> /* This extent could be on the full extents list, that's OK */
> EASSERT(!ext->oe_hp && !ext->oe_urgent, ext);
> - if (!list_empty(&ext->oe_link))
> - list_move_tail(&ext->oe_link, &list);
> - else
> - list_add_tail(&ext->oe_link, &list);
> + list_move_tail(&ext->oe_link, &list);
>
> ext = next_extent(ext);
> }
>
>
Cheers, Andreas
---
Andreas Dilger
CTO Whamcloud
More information about the lustre-devel
mailing list