Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4207956imm; Fri, 18 May 2018 00:53:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp6e4NFbovVTm/uIaySaPWX96x15UGgEQKp+vceX5vvZtCZ3FNMoDsLLJNSYOGOfhE8AH84 X-Received: by 2002:a63:2d83:: with SMTP id t125-v6mr6641498pgt.336.1526629985580; Fri, 18 May 2018 00:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526629985; cv=none; d=google.com; s=arc-20160816; b=mp0nKT6YFtN5UGa3VHDHVT30LGqgyocyh8npSLjVFFbPZxsI5j3HUr34hQBHeWuqpy jMLUG6UY2CoEPxLzK6WGis2zv7YT39CL+qMnIqj9Ko4PZYmN1uJwi8y0WV/00VGC5Gp8 LsRPc2kbp+HVnTVGNQQGwQSxefOQXEWyP1lcnO/wU5d08D46rvxDRJYbQpoYMzf7IKQK 6VboBq5G/Qnyl4VlqajLD2rNKpPcLF5HaGi7npc4emSbiWl8vpOdLENwjFWE57x3XpYd v24AvimMwZYpQaoL4fXPo2oDx/SKsGqd9gCZorRjrqXEdRviqiEDGVRh5LrLKb6sVw3R Gw/A== 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=jmc7AEzlKlmmRlnCWPCGp07c3kvuJcXfX3r2Ikw0m7A=; b=KrCxYv+LJuA4pN9e/wfg1RarKP5Uhu0ULXxeH5QGb/Y4btmR+UBj1jLk+2rJP3ICS8 EBYPmIxKXhdog0Rua5nieNOAN4htCw3is8U9FKWcxEoHs2l2rL/K9MonhOVcdmHVpnj5 Wh3QGH5J0G0TqTnQ/LU/Lk25C3qy2ppW3sLp0hnEasYbQssI1qiItz1wd7iDVejkepF7 1aHJiAn+EaOeNn5TbKLDfThE2Gmk2jCuNDB6CyTHI7H0AabX4eHGW5ywX3wTQ+vIlTBP DAXGe5YeM2KaAFSjI0hpjFM24A9qy8ZsdCD5DbYCDOuJG9nuDhgVOQf9AiknOlz3psPl IXnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kpfRRziA; 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 k22-v6si6712694pll.393.2018.05.18.00.52.51; Fri, 18 May 2018 00:53:05 -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=kpfRRziA; 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 S1752411AbeERHuR (ORCPT + 99 others); Fri, 18 May 2018 03:50:17 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:45648 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbeERHuN (ORCPT ); Fri, 18 May 2018 03:50:13 -0400 Received: by mail-qk0-f194.google.com with SMTP id a8-v6so5728016qkj.12; Fri, 18 May 2018 00:50:13 -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=jmc7AEzlKlmmRlnCWPCGp07c3kvuJcXfX3r2Ikw0m7A=; b=kpfRRziAJjobH8qu0mtOwIugXwxqwZUnwDi7y465ElC3Me7ggYyhXb/L8BfRnVnTKU RRfGSsp6/zj/HtSZjRR18An5pEXeLfYbhAjRvPSin79oCfXSyh/bfUsBKAUeP0TBVQ54 saB3K6ARkGMBxSsBcuWv3GklM+evfD6iBnnAcqgLTovOQ6IlYqDh+5jjbcGV9ikRCcTD /1mPIjeZEfcUUcclf6/D4stncU1DgN2CAWyG+Z806hEl1wVW0drJB7KThJRD2JJYqrYw rdtUiguVZKxZ09uTkFW0MvI8qayhMJp6mjy94uHfuIXpv8p+rVQfQrK472KDJ8NIT725 +WTQ== 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=jmc7AEzlKlmmRlnCWPCGp07c3kvuJcXfX3r2Ikw0m7A=; b=SeD8huSnhv3vnaAeJ9U85voczrbRxw6m2z2HqavfDKDjChl9JGRg626/8OcXVmUKMR xARu4ELQiwU2I3/93gdhJvZ0uVUeH9HmHcdoTvitEN3YNvrjYBRMWKLZmCl+ea7O911e QbgIkuOn8pFklJy6G4QhobRcbQ2lZbm7AclaFyob6SyFKHUxfkZ+gtSAhYbi96GTBMzS 0QTox3I7/uDOYRpSRxgDeLTlLC3gnhmN6bqI/NQwIyKfmQhAKQ6EgxO1jGJuPR3aeU6w GsgWhb+Fr+b1hawRCiNz0mcpBWWJMnT6o+lludq9OgoKoHF7b4s/hOMFNU5jgHLqdVR6 IZFg== X-Gm-Message-State: ALKqPwfPULhjXb2GZvXyD3MGEdKdccF7LM8qYdM6cUXDw1m8TSM/pJZ0 txIa7f6c5YPnYejWfVKBOWpXLMtnBA== X-Received: by 2002:a37:488:: with SMTP id 130-v6mr7526951qke.125.1526629812511; Fri, 18 May 2018 00:50:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 00:50:11 -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 07/10] bcache: optimize continue_at_nobarrier() Date: Fri, 18 May 2018 03:49:11 -0400 Message-Id: <20180518074918.13816-14-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 --- drivers/md/bcache/closure.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index 3b9dfc9962..2392a46bcd 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h @@ -244,7 +244,7 @@ static inline void closure_queue(struct closure *cl) != offsetof(struct work_struct, func)); if (wq) { INIT_WORK(&cl->work, cl->work.func); - BUG_ON(!queue_work(wq, &cl->work)); + queue_work(wq, &cl->work); } else cl->fn(cl); } @@ -337,8 +337,13 @@ do { \ */ #define continue_at_nobarrier(_cl, _fn, _wq) \ do { \ - set_closure_fn(_cl, _fn, _wq); \ - closure_queue(_cl); \ + closure_set_ip(_cl); \ + if (_wq) { \ + INIT_WORK(&(_cl)->work, (void *) _fn); \ + queue_work((_wq), &(_cl)->work); \ + } else { \ + (_fn)(_cl); \ + } \ } while (0) /** -- 2.17.0