[lustre-devel] [PATCH 04/29] lustre: osc: simplify list manipulation

NeilBrown neilb at suse.com
Tue Jan 8 22:24:01 PST 2019


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>
---
 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);
 	}




More information about the lustre-devel mailing list