Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp34230pxj; Mon, 17 May 2021 20:10:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL/s1eTRSdYFwIKxCok0HSk2eW42pF95giBH31O9zolLbbf1nCYcQJexuIUJEiyF+iT1tH X-Received: by 2002:a05:6e02:8f0:: with SMTP id n16mr2343961ilt.7.1621307453630; Mon, 17 May 2021 20:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621307453; cv=none; d=google.com; s=arc-20160816; b=iINVU21Hc0DkJmaVW1HYVZ7vdEc8bAxhwms78++8Jom/8VQI7+iSap7GwEVmoQaBh+ 3B05Rs+Xea+hYFri+2jOZol5TwSBm+qipTJtYFST1rFRzQRipZNllCQmCzbkQ9ThlwUW jiawpg8ExJ01SJe57Emjp4ycRu4T7z5eRPCyfy++G9vUek0VUXSKHN6i+/1FAiQ2cq9+ U5JZzQT2uOyVHf5mA3WxP7khtdFe9ytUXXOVurY4n/TntCbBn/ORHs7mDWztGZCupdPs klBHhTKa714NbD1d8d4AMeVD4NtG/JeQG/WngBCQAvbYGFI8ARX3AQwvUMHkJ1KckwXw AwyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ABthK9TkHfuVHjHRvzS53QlXfUHJzunSdxSK4wgCaTs=; b=sfcbBy3V5ycGQUdIsApLZZEOWb+f0oEfwYyhh8C4oyqP3kCPE67fhqwuZg/obJa+VX cKRE3ietSIn49NaHaR1CpziQNhdIUVoZf5La2osTKvSVKO2wAEGV3fr6zpz8VpCVTDRi pzYp2TT9mBjoj9+t4mbluHAb8WQP1pXy4OfmEQ7b7zbmO8h8pb3c4IhmeC4AWUBrHNzR sLe/K7ZaWCiqze3qL9Zcl0bR0sI+bpbGAxIHzWnvFYmldhATEbWczGUvbQ3tSsXgWhwk fClGwvx8dkXS/YkQ3SVhCb9qdJnUHZhBShJVzxX1IgT7yTtLnEQNQ49zC97YsV7jxdbe vSwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R6JvZMp3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si6612174ilq.76.2021.05.17.20.10.25; Mon, 17 May 2021 20:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R6JvZMp3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240767AbhEQOjK (ORCPT + 99 others); Mon, 17 May 2021 10:39:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:58572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240402AbhEQOeM (ORCPT ); Mon, 17 May 2021 10:34:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15F97613F8; Mon, 17 May 2021 14:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261007; bh=ln//Pg6dZHhKTER4ykJcOQPJKAQkkz386kNjhSNwFlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6JvZMp3CYa11AeAldhMQrTsWVt8QOPXRXChKy+3Olrve8SbRxHl3bCwQWN0azzkh wUwnERz3uUqHTPb7fRxlRnd2mCklZ0KDBMuEY2/00mEhgbrtmaE3xvjYmkz1A9TaUt hkhT78+3LgjwbNEAGocjmxIWn5eK39LbXfZekdVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Kurz , Jan Kara , Dan Williams , Vivek Goyal , Sasha Levin Subject: [PATCH 5.12 280/363] dax: Add an enum for specifying dax wakup mode Date: Mon, 17 May 2021 16:02:26 +0200 Message-Id: <20210517140312.075682084@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vivek Goyal [ Upstream commit 698ab77aebffe08b312fbcdddeb0e8bd08b78717 ] Dan mentioned that he is not very fond of passing around a boolean true/false to specify if only next waiter should be woken up or all waiters should be woken up. He instead prefers that we introduce an enum and make it very explicity at the callsite itself. Easier to read code. This patch should not introduce any change of behavior. Reviewed-by: Greg Kurz Reviewed-by: Jan Kara Suggested-by: Dan Williams Signed-off-by: Vivek Goyal Link: https://lore.kernel.org/r/20210428190314.1865312-2-vgoyal@redhat.com Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- fs/dax.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index b3d27fdc6775..5ecee51c44ee 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -144,6 +144,16 @@ struct wait_exceptional_entry_queue { struct exceptional_entry_key key; }; +/** + * enum dax_wake_mode: waitqueue wakeup behaviour + * @WAKE_ALL: wake all waiters in the waitqueue + * @WAKE_NEXT: wake only the first waiter in the waitqueue + */ +enum dax_wake_mode { + WAKE_ALL, + WAKE_NEXT, +}; + static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas, void *entry, struct exceptional_entry_key *key) { @@ -182,7 +192,8 @@ static int wake_exceptional_entry_func(wait_queue_entry_t *wait, * The important information it's conveying is whether the entry at * this index used to be a PMD entry. */ -static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all) +static void dax_wake_entry(struct xa_state *xas, void *entry, + enum dax_wake_mode mode) { struct exceptional_entry_key key; wait_queue_head_t *wq; @@ -196,7 +207,7 @@ static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all) * must be in the waitqueue and the following check will see them. */ if (waitqueue_active(wq)) - __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key); + __wake_up(wq, TASK_NORMAL, mode == WAKE_ALL ? 0 : 1, &key); } /* @@ -268,7 +279,7 @@ static void put_unlocked_entry(struct xa_state *xas, void *entry) { /* If we were the only waiter woken, wake the next one */ if (entry && !dax_is_conflict(entry)) - dax_wake_entry(xas, entry, false); + dax_wake_entry(xas, entry, WAKE_NEXT); } /* @@ -286,7 +297,7 @@ static void dax_unlock_entry(struct xa_state *xas, void *entry) old = xas_store(xas, entry); xas_unlock_irq(xas); BUG_ON(!dax_is_locked(old)); - dax_wake_entry(xas, entry, false); + dax_wake_entry(xas, entry, WAKE_NEXT); } /* @@ -524,7 +535,7 @@ static void *grab_mapping_entry(struct xa_state *xas, dax_disassociate_entry(entry, mapping, false); xas_store(xas, NULL); /* undo the PMD join */ - dax_wake_entry(xas, entry, true); + dax_wake_entry(xas, entry, WAKE_ALL); mapping->nrexceptional--; entry = NULL; xas_set(xas, index); @@ -937,7 +948,7 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev, xas_lock_irq(xas); xas_store(xas, entry); xas_clear_mark(xas, PAGECACHE_TAG_DIRTY); - dax_wake_entry(xas, entry, false); + dax_wake_entry(xas, entry, WAKE_NEXT); trace_dax_writeback_one(mapping->host, index, count); return ret; -- 2.30.2