Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp597791pxj; Tue, 18 May 2021 09:58:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsCzF0mlJrX1UmFEGjVlY4qRs+fKjpGgRbF/xm4nvHFU7GvJymaLnbWYRHJWdhvKqndon/ X-Received: by 2002:a50:fb17:: with SMTP id d23mr7961287edq.338.1621357091263; Tue, 18 May 2021 09:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357091; cv=none; d=google.com; s=arc-20160816; b=fghrzafvRQCC5gj+icdn+0JnnNLnpYOdgY5TE6BklapxQcrEBbJEP6Kjp2sogTt6D5 iCPC14a5HvomkS56tYtm+I2LULPQZMvhkbpT4f3BYM5lIyNQksxY7tC6jHds5JLpIkuN hbkM0/Lihn5J+5yC7JEMcY1IAKA+tnvZas/m9OT26gVNZ/5I6IS8iHuBqM2ZB/K/ud7/ 6Icj9AZ+RdERNxoIhEYptiXM5I/QRBNueU9GLH2smhEq3yBbuZMv/WRYG0RnmSaqb3PG vAvY2sFNv36xs+pfFtKUMLofC48Gox1hhlL28J6wLUs3YyVvujjCrYbYUt9d5sEylsHY G5HA== 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=Ls2b2HgfV/6T1AfhdpJ2oJRy3uJuDpwpl+ZPT4r2LQq5XP/p7z2dbfBIMkHVwiEZir anKtpjh4uBdVaSW4rmsU2xCx75Q9VOLsiOPUdUzTrSCjGPqnsv/H7Z95WIduoUXhvjnh +KcH0xD9Q+/LVyrQ/sYtoOHmG/E/ir8qgO9DUpAhNuNqeGJAC1Tt8f3EvlvwjmiEVxxj JXznF1bXXRj96IdcXmWH2j+WtK90DC9RPhyMRb8JzMkEAg0UcbteX6Wuox+of1k+p3zR v5EZ6oANoORQFg77hCkJeYqG/XKpk+hM4KIxM9nEYnYA7ORjB7aGKXhGXrH6JFmz8uoj 2xrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zv6Guxi0; 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 v22si17998004ejc.505.2021.05.18.09.57.14; Tue, 18 May 2021 09:58:11 -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=zv6Guxi0; 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 S1343915AbhEQQEK (ORCPT + 99 others); Mon, 17 May 2021 12:04:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:51450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243276AbhEQPnm (ORCPT ); Mon, 17 May 2021 11:43:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D0C9F61D18; Mon, 17 May 2021 14:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262571; bh=ln//Pg6dZHhKTER4ykJcOQPJKAQkkz386kNjhSNwFlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zv6Guxi0xof+bCdSRFNj/cde0VYODH2+VXEkWS0OwwkxbpHhCxJ0uAEXMK4h5eice lcrDPabEpsQ7cJ4dw9EagXve0e56oRgELwWrscueemlpxSpQjVwcKEW0HP8SUFc5St zEj01UVifZ4dzls7gYcPJPtInKQK0WIiopCCzH9w= 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.10 216/289] dax: Add an enum for specifying dax wakup mode Date: Mon, 17 May 2021 16:02:21 +0200 Message-Id: <20210517140312.396226633@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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