Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4206580imm; Fri, 18 May 2018 00:51:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrGU35FOu1GiDBato+JImbskbvWh4x8FPPDMw6tWAUUCG/Kg+Gjm45mNxJtS/AvubNCab/v X-Received: by 2002:a17:902:7e05:: with SMTP id b5-v6mr8279901plm.230.1526629863818; Fri, 18 May 2018 00:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526629863; cv=none; d=google.com; s=arc-20160816; b=Eci5d/h4DVZ35x3BtU5f/4z4O2jUpVorYhBNQueE4GynNbygfW+JzqSqz0p4dvzPGM Uz3HZKwC4ipjT6c6tvyKRKeRGJLLZYwq0aTVzK3tet7JN8b1YBaldnKDtsjjxfJ2RwWo vy+7z1nAum44BDdKPjvEkOE3AsD09qs8B/b8Tg/KnURJlz6zJnN6PTVc8c0CP4yM5F0a Sn2QyYiICY+SKzgjjq2vT3ZS1tBPLzgvxr15LtpdBeHhKUtJpht6kG6WX2EPYuyYvKE5 2bqxzB48sNm8xNCrUVNjRYJRn1dBtIW8BKFsCfMBHz8HrAxAEmfcpzbhRUWfLIbyfwrK X6UQ== 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:dkim-signature:arc-authentication-results; bh=11dP+D/hZf+IFz8QhU6bNK06HK6b7UAnxVh7tvZXCcE=; b=HmoxaB40sf+Rup8bQOpNK+RPTLi9fv0xXwdhFk82HqiWm1f3dlDrFKZ1ulXSqAr/++ 0ETVqerSatgNUX33vab0LMKLDl0L/tLq/F+LoXder6rK1M8CGbAyQv45diMaVHn35ND3 D/ydXO/eVN4QC1UVhZhtMKgXjAys4prHN9g4qAAiFb+p+ch6vFl508EXq7bJLondSGNY CC3G5cPGDWERJv35jzaYL6Av2YzJXG8K9R4DZ3qvtKDOOaY63/FCSV668K6ElaMylaVO 1cOCARxB843DwhLIxlt8mxAl9h1czquIVDt/ag5fr7+gu5Rzce+C5DatO1QqfrC+fBf5 oQDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GUa3HRLm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si4260682pgp.312.2018.05.18.00.50.49; Fri, 18 May 2018 00:51:03 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GUa3HRLm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499AbeERHu0 (ORCPT + 99 others); Fri, 18 May 2018 03:50:26 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33519 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbeERHuY (ORCPT ); Fri, 18 May 2018 03:50:24 -0400 Received: by mail-qt0-f195.google.com with SMTP id e8-v6so9174641qth.0; Fri, 18 May 2018 00:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=11dP+D/hZf+IFz8QhU6bNK06HK6b7UAnxVh7tvZXCcE=; b=GUa3HRLmjrWfg/QggScmff7k4wxaS8hRHK0IUSWYeo+R8+MUhqBfiB2RG1wYjpmIJb 4kU6QG1p43SiebXRAMJypSdsEjLO77OzbdzwGFcRN1Dh4Ol0f8hDKo/qpxT5gin4UxmT uBdFKFV0b71+IGw8EyO+gudLzpk1ydXIhE9rFQis6FD9JPy93Dbi0Ig0LJXQYn0JQEU4 e4UFzaZg6tcGzNkAQconXlaABBEO9gBPT+oiLadlIabn7NfeAmycmyx7PfzgsIeQOkc8 ISV3rN9PSxfmGHSbOKBzcvqN1UpeOAQSx9vjyr7wDOL0Lvu6uyBHwAt6nsFs3qWP5lou nJIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=11dP+D/hZf+IFz8QhU6bNK06HK6b7UAnxVh7tvZXCcE=; b=pKa0i14Zmbt2cisWZuHjHt/ZohLj1LlDlyCak7vthFrRaM11Frzpcd4uDbpB3oidnz nTjj5tImx69+w0YqFTLP8Tn2JkfNAfSQiusQrrPokUk54nW+Jer+9crgrif+KQfo/947 aB3ZYM8hGSKH3jUSmVcaaqEkP0Gn4f+FK8Q7QEGye5ge350Mxin6bB6APQgJqh5TE4yv xHGiOE03/7B/t+pnBkAWyUNbnFiRQGBL3+x+Sr/2Y1bmqKk9Yfk2behJ1x1CnJ3+19BU Dq+CXLVcfObc6ijjoO7HrZEndTBfJa1f2nagCG9OzOBg+rYUE5tBlaX++7xrJJDgECk1 N44Q== X-Gm-Message-State: ALKqPwcceZoNj7WYFEPgJuae+6jB10EHwzhjCQub6Jtxh5z4rcyPRYsE WITVQ5m6SXjp6g7OjF8pc+SBEWZr1g== X-Received: by 2002:a0c:9e2c:: with SMTP id p44-v6mr4187830qve.97.1526629822786; Fri, 18 May 2018 00:50:22 -0700 (PDT) Received: from localhost.localdomain (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id s64-v6sm5443004qkl.85.2018.05.18.00.50.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 00:50:21 -0700 (PDT) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet , Andrew Morton , Dave Chinner , darrick.wong@oracle.com, tytso@mit.edu, linux-btrfs@vger.kernel.org, clm@fb.com, jbacik@fb.com, viro@zeniv.linux.org.uk, willy@infradead.org, peterz@infradead.org Subject: [PATCH 09/10] closures: closure_wait_event() Date: Fri, 18 May 2018 03:49:16 -0400 Message-Id: <20180518074918.13816-19-kent.overstreet@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518074918.13816-1-kent.overstreet@gmail.com> References: <20180518074918.13816-1-kent.overstreet@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Kent Overstreet --- include/linux/closure.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/closure.h b/include/linux/closure.h index 1072bf2c13..ef22d18f7c 100644 --- a/include/linux/closure.h +++ b/include/linux/closure.h @@ -375,4 +375,26 @@ static inline void closure_call(struct closure *cl, closure_fn fn, continue_at_nobarrier(cl, fn, wq); } +#define __closure_wait_event(waitlist, _cond) \ +do { \ + struct closure cl; \ + \ + closure_init_stack(&cl); \ + \ + while (1) { \ + closure_wait(waitlist, &cl); \ + if (_cond) \ + break; \ + closure_sync(&cl); \ + } \ + closure_wake_up(waitlist); \ + closure_sync(&cl); \ +} while (0) + +#define closure_wait_event(waitlist, _cond) \ +do { \ + if (!(_cond)) \ + __closure_wait_event(waitlist, _cond); \ +} while (0) + #endif /* _LINUX_CLOSURE_H */ -- 2.17.0