Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1564892lqb; Sun, 26 May 2024 07:01:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHDGfbW5DH2orLbBaQhjaXyzers44EhZIEYo5CCATfUliz7H+qkxfBxuV3iXRct9gX05zuFzFkK/Kk3RnGdYIcuayUgvZ1LlruQjDi0w== X-Google-Smtp-Source: AGHT+IGUTLkDnUR+9GqInQwESm2hmRfYE55aQR0M/r+mj6l9bS0eakTAzllqVxB4d+rhY6PCvpOc X-Received: by 2002:a05:6a00:4c8b:b0:6ea:9252:435 with SMTP id d2e1a72fcca58-6f8f3d70f73mr11628733b3a.30.1716732105293; Sun, 26 May 2024 07:01:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716732105; cv=pass; d=google.com; s=arc-20160816; b=jTv3EQj6+J9Z5i/46OWFJxYluAH9j8+oWHQrPNTpHhnmGNXcRD6JmX7fc+gn5X2Xbn 68lztG8U6yNWTI74YowaoOIRGR/thkeZnOsRuwU14QCfn3682zN5qlPuP3aK0qIjMo+L WWKaC9ih0fVeRkKfJQyWnWuwvRsySXaEJw0gcLGmBexIhKYAAt1lsqM/Rbk9YNEWaWsj OqI7wp4xKlGmmsrdDXHE6emnpu0YTa76WuFAbW2+LXFttOcT2edHS4X9B93345UDZqZW afxvIdPELoOK3TWQecjp5oAcd9FN7QJCswm9qRv1er87MJKsjnI/W2rdn29ZDg4Xhk/v iLxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n3yJ3+ce7q5V5qKFmntDCIjLm2bWmBUIJjuIPEeKk64=; fh=k89GefxlvN1s0+UuFvJ8W1LLQPEyNC3hr+5hkybIS/g=; b=RRiDs3NWYSwMy6WHXbdtXtKS1uJw71zI/2kNJZUteX47akBev26e0AGg9aaTmoXUZe nl8TCLDE1jluwZI8a3saPviBxForWmGd6E+hS9/PabAO7VAVfEOOJFwPbPHK7vLJaX95 xDVoqn1MpX8aBASHxarp4NHRd9s3tRyDL4ITaYBvhUXkfOUMqvcf/zWwA/RH0IXVnsF7 nam4PlhJQymptOaN4toLj93ojB2rOumMnQFOxKnwBY1rOHoA2VK39P02SnKwdV2Vbgy6 haPN1IkVsVK5Z58/r7SnacfmZTFv642xBQ0VrLf7I4nrD0vebhlzOKU+s97x6fEDGRfd Jaxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=VbkPyGvo; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-189613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189613-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fcdedff9si4530551b3a.164.2024.05.26.07.01.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 07:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=VbkPyGvo; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-189613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189613-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AFEB0B20E95 for ; Sun, 26 May 2024 08:54:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20D688F66; Sun, 26 May 2024 08:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VbkPyGvo" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 998D08F45; Sun, 26 May 2024 08:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716713655; cv=none; b=hPKoLLsOJwhNhcJuyrHfLpnRklGklk+sTUczor97uX9hxFuVEPcnPF8Ek7NBDaqO9NBmlJyeXI2oPogcMKThz209d0KHXvI3+NdVrm64fzmGJGLXOySSatPHvECOcBolHYcP4myGDCoiZfqTeT6kHSBdXFwa3+lBEehxeDOORtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716713655; c=relaxed/simple; bh=cA7Ws5kGbeYZ56/9CtGWIABcTIJ42WDh1D1JqOL20dU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VvjlFsBjefcBoNrCv92hdtsAw+Mw97NLX8FlmStuSkLcHJOW7PrBBtM+FCyWh62nrArGBGOkEW7Z9modRuZp4vJVIwWCQnuLR9ZvELdPu48l+4h/o/cUVioNRWwzi2KZ0P7IlK9jUYENbdpNfwGhfGcP+dUjLmT7IdVRp8Mdaj4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=VbkPyGvo; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=n3yJ3+ce7q5V5qKFmntDCIjLm2bWmBUIJjuIPEeKk64=; b=VbkPyGvoZjMTYs4o4RGegZQ2j/ VNtyf0yIl9DvapF6+IFJyTcQXwVgdTYK3yvxl2hsG/YIKM9FlnEQdq3Z6QvQbL7D5ZFevSvQNYxzr 8QX3Id45Jwsnuw/uER3JAHscanNf0Fv6PraehjuKzXkBw2uBWOLnqLFmat9UlN5jVKym+lwTrHs8Q n9c/sfA9IF46fMvztgQ45DwHnu75qymSN+MjeY1dsFCEJ5as9Bf9m535fglF0iOy2dPkMkIAUW/iG ZpA8+4S/Lg4TYA8VUuP5CYj0FipQgz75OLOE8mGhtCC8rKwXgUYWboVEkq3DK9A3GtthJR32Xp7FJ atHyV/Aw==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sB9dn-0000000CNlL-3Jtc; Sun, 26 May 2024 08:54:07 +0000 Date: Sun, 26 May 2024 01:54:07 -0700 From: Christoph Hellwig To: linan666@huaweicloud.com Cc: song@kernel.org, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: Re: [PATCH] md: make md_flush_request() more readable Message-ID: References: <20240525185622.3896616-1-linan666@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240525185622.3896616-1-linan666@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Sun, May 26, 2024 at 02:56:22AM +0800, linan666@huaweicloud.com wrote: > - bio = NULL; > - } > - spin_unlock_irq(&mddev->lock); > - > - if (!bio) { > + spin_unlock_irq(&mddev->lock); > INIT_WORK(&mddev->flush_work, submit_flushes); > queue_work(md_wq, &mddev->flush_work); > } else { > /* flush was performed for some other bio while we waited. */ > + spin_unlock_irq(&mddev->lock); > if (bio->bi_iter.bi_size == 0) > /* an empty barrier - all done */ This stil looks like a somwwhat odd flow Why not go all the way and turn it into: ... queue_work(md_wq, &mddev->flush_work); return true; } /* flush was performed for some other bio while we waited. */ spin_unlock_irq(&mddev->lock); if (bio->bi_iter.bi_size == 0) { /* pure flush without data - all done */ bio_endio(bio); return true; } bio->bi_opf &= ~REQ_PREFLUSH; return false; }