Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp415041imm; Thu, 26 Jul 2018 22:36:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf2vV/CKIUjBqf/WmPaBqGt0j/xSe6mPhljFTwsy3cTq8v6eUCn1SvFBXZyXgT8TUdnGLmj X-Received: by 2002:a63:4d47:: with SMTP id n7-v6mr4687590pgl.270.1532669778866; Thu, 26 Jul 2018 22:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532669778; cv=none; d=google.com; s=arc-20160816; b=VDX8Dy/x+YzHtD4nJBYp5RIwTcCuMizbKbRUWlBWep916378N+nbGjlZvGTHq/xRB+ Pt5YMzD9UdmI5W1oarKnhro2vB0vNvaGyOZYlEXFyUXcDIhz3HCpn2JwBxMRgbQ9ADE+ xSsE0hlNmlmy8Xim8XCcSnLMkRS/gC7LZid5eo7vllQz6/zqeXqETC1ZFfDolw6rbUcp MyI2TDmJb//eQ7gdcP0s+KEzgyVPsC05MNW4DP6ueftCSqqVEZkVjKuOhTPeGSLfYpYY UBrxi6Ba2K9kH0i5CnJcXIAnGNW1ylKbMai/OrnKnDr1P5oqNNANtOFna5ik4L7LE8an Ackw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=S0u+8R/kG15RUMwz4fDoLza/W/9wQA3th1rkEjNBM70=; b=yjc+RHwW5do4g8sdKrz6tY1X8rOqaApJ6kgactrV7AROJ+QUYDpdMBpHvGTdvBlFzj hPg/aIX60SYaNN0O9gN7L9pdAFkUzwszv6WSqcgsjMOkEZKOHAMT9BpY+DPJoa0LOhXv aNDiG88Q6KV6Cwu33fx+MBeg7nnYTuCX21VbhfZpmE9QghNUWUDuXZ+UBir7FYOzAivm WggiHCi+8kRVEgjtS3Re7NsHFt5375VvZPBfJdLgRqaz8Lgd+oBvle3ee85I57/IYVu5 JZbTJ4O3nNCtt6OHnQ5UsjlccX+WjIxJGDfZ7BzRTCP56prTuMh0NGPDUwcJ6+TrNJ0o +Jhg== 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 y5-v6si2708864pll.89.2018.07.26.22.36.01; Thu, 26 Jul 2018 22:36:18 -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 S1729518AbeG0GzQ (ORCPT + 99 others); Fri, 27 Jul 2018 02:55:16 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:41320 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725861AbeG0GzP (ORCPT ); Fri, 27 Jul 2018 02:55:15 -0400 Received: from linux-r8p5.suse.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Thu, 26 Jul 2018 23:35:00 -0600 From: Davidlohr Bueso To: akpm@linux-foundation.org Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, peterz@infradead.org, linux-kernel@vger.kernel.org, dave@stgolabs.net, Davidlohr Bueso Subject: [PATCH 2/2] fs/eventpoll: simplify ep_is_linked callers Date: Thu, 26 Jul 2018 22:34:32 -0700 Message-Id: <20180727053432.16679-3-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180727053432.16679-1-dave@stgolabs.net> References: <20180727053432.16679-1-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of having each caller pass the rdllink explicitly, just have ep_is_linked() pass it while the callers just need the epi pointer. This helper is all about the rdllink, and this change, furthermore, improves the function's self documentation. Signed-off-by: Davidlohr Bueso --- fs/eventpoll.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 88473e6271ef..42bbe6824b4b 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -336,9 +336,9 @@ static inline int ep_cmp_ffd(struct epoll_filefd *p1, } /* Tells us if the item is currently linked */ -static inline int ep_is_linked(struct list_head *p) +static inline int ep_is_linked(struct epitem *epi) { - return !list_empty(p); + return !list_empty(&epi->rdllink); } static inline struct eppoll_entry *ep_pwq_from_wait(wait_queue_entry_t *p) @@ -721,7 +721,7 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep, * queued into ->ovflist but the "txlist" might already * contain them, and the list_splice() below takes care of them. */ - if (!ep_is_linked(&epi->rdllink)) { + if (!ep_is_linked(epi)) { list_add_tail(&epi->rdllink, &ep->rdllist); ep_pm_stay_awake(epi); } @@ -790,7 +790,7 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi) rb_erase_cached(&epi->rbn, &ep->rbr); spin_lock_irq(&ep->wq.lock); - if (ep_is_linked(&epi->rdllink)) + if (ep_is_linked(epi)) list_del_init(&epi->rdllink); spin_unlock_irq(&ep->wq.lock); @@ -1171,7 +1171,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v } /* If this file is already in the ready list we exit soon */ - if (!ep_is_linked(&epi->rdllink)) { + if (!ep_is_linked(epi)) { list_add_tail(&epi->rdllink, &ep->rdllist); ep_pm_stay_awake_rcu(epi); } @@ -1495,7 +1495,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, ep_set_busy_poll_napi_id(epi); /* If the file is already "ready" we drop it inside the ready list */ - if (revents && !ep_is_linked(&epi->rdllink)) { + if (revents && !ep_is_linked(epi)) { list_add_tail(&epi->rdllink, &ep->rdllist); ep_pm_stay_awake(epi); @@ -1533,7 +1533,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, * And ep_insert() is called with "mtx" held. */ spin_lock_irq(&ep->wq.lock); - if (ep_is_linked(&epi->rdllink)) + if (ep_is_linked(epi)) list_del_init(&epi->rdllink); spin_unlock_irq(&ep->wq.lock); @@ -1601,7 +1601,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, */ if (ep_item_poll(epi, &pt, 1)) { spin_lock_irq(&ep->wq.lock); - if (!ep_is_linked(&epi->rdllink)) { + if (!ep_is_linked(epi)) { list_add_tail(&epi->rdllink, &ep->rdllist); ep_pm_stay_awake(epi); -- 2.16.4