Received: by 10.192.165.148 with SMTP id m20csp3364991imm; Sun, 29 Apr 2018 21:32:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHSE/d1NdfedYUW7w8fnPhBBCfaKBjN1pTQSv3vDhYt0O7gvhMs4b7Cowf2Q5pDFHZxk8x X-Received: by 10.98.55.69 with SMTP id e66mr10616573pfa.253.1525062777827; Sun, 29 Apr 2018 21:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525062777; cv=none; d=google.com; s=arc-20160816; b=pTtTn6A1VCG5OwP1pY8P9EeA1NUsn5GDx7G4eJuSZtUSyL1Ki0StCXRL4ddt15Im67 MxQxYrb3M++eHJDDs1/E23oOEnFyp2o2/jwOK4u+VtHz+w04AltS3UNrmVVdxVty6rtW L1JDaCC71QSxgf1xclM69wb9io2h+wmqYDJw9fV5Um2ZBQxcsjN/UKOPXF/ATlwMsFxl /bwpuo/F3IbULdhztNlv55om7HN0m08qNLiynw4Ha8ouYFN8BykUE2VdEBusEiz88sYC dR0nHvBTR9S/5mnr68WnmPsEZmg0DjKP094JXKK4wpKf/56LHtHJ5G5AJxiDZc4f5D9i g5Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=e6iq6rkmU1Tf932+GCE4YyAnuG90Yjvg0rd3+0W+Iio=; b=dqRM0J8XRCCuhMWlDJfjE1eePnbe91aoRIthczrjFqjaiTJQ2/mzykrl/HmsboP3cf kgflPS89gL5wVkBUjACojvdGfwq4xj8G/bZ82Rlb3i1iv81w1CCD1TnwM4iK0aIwnAgv R5usMVbEDo0slFr7ojUenDdfORIO/306faEg21V0cUYNW6sXJm36vJsjYOppL42GEHxZ ZnRFJfzaZIfOwD55/gHjTxVIuczDfnRmzdTOvsGLC05bhSm84+ZtAhmCDkyPqq0Kw3jt Zw5T3yiUlPzOhMJDrWzWUvJoMa31u2+GjqwBr4lN59Jo1kX5TT66/pqVIopOXxo/oEMW pVpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d132-v6si5686473pgc.253.2018.04.29.21.32.43; Sun, 29 Apr 2018 21:32:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbeD3EcW (ORCPT + 99 others); Mon, 30 Apr 2018 00:32:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:38773 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751661AbeD3EcU (ORCPT ); Mon, 30 Apr 2018 00:32:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AA387AD0B; Mon, 30 Apr 2018 04:32:18 +0000 (UTC) From: NeilBrown To: "Paul E. McKenney" , Trond Myklebust , Mathieu Desnoyers , Anna Schumaker Date: Mon, 30 Apr 2018 14:31:30 +1000 Subject: [PATCH 3/4] rculist: add list_for_each_entry_from_rcu() Cc: linux-nfs@vger.kernel.org, Lai Jiangshan , Josh Triplett , Steven Rostedt , linux-kernel@vger.kernel.org Message-ID: <152506269061.7246.13075216914692813995.stgit@noble> In-Reply-To: <152506256513.7246.13171564155614823841.stgit@noble> References: <152506256513.7246.13171564155614823841.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org list_for_each_entry_from_rcu() is an RCU version of list_for_each_entry_from(). It walks a linked list under rcu protection, from a given start point. It is similar to list_for_each_entry_continue_rcu() but starts *at* the given position rather than *after* it. Naturally, the start point must be known to be in the list. Signed-off-by: NeilBrown --- include/linux/rculist.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 127f534fec94..36df6ccbc874 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -403,6 +403,19 @@ static inline void list_splice_tail_init_rcu(struct list_head *list, &pos->member != (head); \ pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) +/** + * list_for_each_entry_from_rcu - iterate over a list from current point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_node within the struct. + * + * Iterate over the tail of a list starting from a given position, + * which must have been in the list when the RCU read lock was taken. + */ +#define list_for_each_entry_from_rcu(pos, head, member) \ + for (; &(pos)->member != (head); \ + pos = list_entry_rcu(pos->member.next, typeof(*(pos)), member)) + /** * hlist_del_rcu - deletes entry from hash list without re-initialization * @n: the element to delete from the hash list.