[lustre-devel] [PATCH 08/22] Revert "staging: lustre: lnet: config: Use list_for_each_entry_safe"

James Simmons jsimmons at infradead.org
Wed Aug 1 20:04:18 PDT 2018


> This reverts commit cb734cf73eaed9b9bb7f190cceaafc15af0d8815.
> 
> These loops really want to remove everything, and using a
>   while(!list_empty())
> loop makes this more obvious.

Reviewed-by: James Simmons <jsimmons at infradead.org>
 
> Signed-off-by: NeilBrown <neilb at suse.com>
> ---
>  drivers/staging/lustre/lnet/lnet/config.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
> index 136905db2746..26b799e66e53 100644
> --- a/drivers/staging/lustre/lnet/lnet/config.c
> +++ b/drivers/staging/lustre/lnet/lnet/config.c
> @@ -1026,7 +1026,6 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
>  	struct list_head *t;
>  	struct list_head *t2;
>  	struct lnet_text_buf *tb;
> -	struct lnet_text_buf *temp;
>  	struct lnet_text_buf *tb2;
>  	__u32 net1;
>  	__u32 net2;
> @@ -1049,7 +1048,9 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
>  	len = 0;
>  	rc = 0;
>  
> -	list_for_each_entry_safe(tb, temp, &raw_entries, ltb_list) {
> +	while (!list_empty(&raw_entries)) {
> +		tb = list_entry(raw_entries.next, struct lnet_text_buf,
> +				ltb_list);
>  		strncpy(source, tb->ltb_text, sizeof(source));
>  		source[sizeof(source) - 1] = '\0';
>  
> 
> 
> 


More information about the lustre-devel mailing list