From patchwork Mon Dec 16 21:02:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910559 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 9DAD01DDA33 for ; Mon, 16 Dec 2024 21:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382994; cv=none; b=aUYucIqgE32iLeNUU0EImLsF8J7jlWxWA4Hfem87TQM5yheHN6NLC6VdnQBSnfpqyLFF9uLbUj4SeKPbYAB2UGrP6+mWqM6vdhnmJTZsjkqk0DFLBOxuAmvHkFaIAY5SxZNs4eUBHrl+ZjGRTEzSflp/fieZhsswGNih4CbQtUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382994; c=relaxed/simple; bh=LNKloMuydOZ6vdKyiJ/L3WMJa3QVlxqMTyb5lpAXZcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aqLXhShXGMhx8bd8/bxlbXRiDWPoDXtBmT/KBVkwe0I3Ga2HgVmbd1dH1RIaO4fHOHHpVx4Wjj72Q4MGeAi1lWnagPiWGD57bvfpOHOtfVaJGiNFqgE5qtMvnjpdMjig3FhMM9SsuceMUQsUZDSU4YgIdWAxu+41xYE+/Oc2axs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=dNfjBy8w; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="dNfjBy8w" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsq36qGQz6ClL9C; Mon, 16 Dec 2024 21:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734382989; x=1736974990; bh=ENQil eXtI/V01YPDsiwCqc+qezZbrvAB3Bg1UdX9Tew=; b=dNfjBy8weVBFkpCiWbvcT 6jpkTwsf1f4QztdTTOuFLbrnb8wV1GJZFQZ8H6A7FfNQIm/VMIGTihvH/AAUw4PF ZGcaQWtB05KDMKgT9ukwuOb3PkMbXXKfwmnU0HUOGtdX+B8Vu+8p1YVbV7YbXAXH iv2uk8RWS8+2EvgEWfyxrg4IHS5FYRLvmRztPZhJZAU2JbMCZSaxnRIlfK3h3Gyw Ey+u7lc1b+oQOanno94AGOd3MfrhgqnQ47aNs4iepC9PrJ1Y+v/K8VNthXSlZHWD Nr/UxMD/jOeZGg1e/er9YdQjqHcmw2ZXlhqDMGTIBZz3vvWi5i15jgtQpDsWUKYx Q== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id z3ThdsurqFSF; Mon, 16 Dec 2024 21:03:09 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBspz02j2z6ClL93; Mon, 16 Dec 2024 21:03:06 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 1/6] blk-zoned: Minimize #include directives Date: Mon, 16 Dec 2024 13:02:39 -0800 Message-ID: <20241216210244.2687662-2-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Only include those header files that are necessary. Cc: Damien Le Moal Cc: Christoph Hellwig Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- block/blk-zoned.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 84da1eadff64..1575b887fa38 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -11,12 +11,8 @@ */ #include -#include #include #include -#include -#include -#include #include #include #include From patchwork Mon Dec 16 21:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910560 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 4F0301F4704 for ; Mon, 16 Dec 2024 21:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382996; cv=none; b=Suy1wCSBxEUvylBbFD4NINWO9ni4opE9czLLK07S04cxziUrcIz9pHt8lvVlzjL90agz87wfuj9BhR6iw/bLYRg4Kd4w4TxqTFk0SIhQKrP035u/HBWADuvNobj/DjGAp5Q3J8dz+IGGx7w+3h2mAuxulOaiMfvesVwn+VCDycM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382996; c=relaxed/simple; bh=2/wuVBd9vtCgCvitew9JXGAcumfl3qFLh4zbUSM9Fiw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jjP+oLoZE8PmaCj2884R746+2ca9i8XzPUODqkfkSbStdB3v8R0hp+a8tco3EDrjH11R3eMPfB1TlQMRq5x2tDzT1HJL1DyWmRXmIlwfq9o4VFIIPyPsotofk8tHV2eNybRbQ9bU2/bDtx5sAJ3aHpa9EP7xwvgUTo1Tdj3acsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=MIYjyHOB; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="MIYjyHOB" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsq65rTZz6ClL9C; Mon, 16 Dec 2024 21:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734382992; x=1736974993; bh=JOtqq cgCdGHoYCryMnj3aKo5LqKKur4Z44DupCz9HOg=; b=MIYjyHOBwpQT7xVUH5pZo KVotTi2z+X4BuGhb5Wz+RO/OxgNqf1emS4zLZmHcMlF46ZDAhd6ebvIz/YeIve8p 3K8/jBzZss58KasPY5P9eXk963COPjGa5RaucQH9WtzG3lL4shkMyAfZ60r036Iw Bzw8bH2wqA/f6BgeBeojFOaTO5bN/jzQYxufWtRibPf5EjDs0J0r6X/siRQiRjt5 xIVo2y9i45dOxfR9oS1rKHDXXs7YhpaBf7BOQEimh1wtTEpYkJs+K2gXATlo2CCp p4FJpbYRYlrsNGcSjURIjoWkiw3ESUlZ5jXMHgJoHXIpq9Du4A+igmrMHJn0g83c w== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id pGM_aeuBE7yO; Mon, 16 Dec 2024 21:03:12 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBsq20jbJz6ClL92; Mon, 16 Dec 2024 21:03:09 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 2/6] blk-zoned: Document the locking order Date: Mon, 16 Dec 2024 13:02:40 -0800 Message-ID: <20241216210244.2687662-3-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document that zwplug->lock is the outer lock relative to disk->zone_wplugs_lock. Cc: Damien Le Moal Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- block/blk-zoned.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 1575b887fa38..3e42372fa832 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -46,7 +46,8 @@ static const char *const zone_cond_name[] = { * reference is dropped whenever the zone of the zone write plug is reset, * finished and when the zone becomes full (last write BIO to the zone * completes). - * @lock: Spinlock to atomically manipulate the plug. + * @lock: Spinlock to atomically manipulate the plug. Outer lock relative to + * disk->zone_wplugs_lock. * @flags: Flags indicating the plug state. * @zone_no: The number of the zone the plug is managing. * @wp_offset: The zone write pointer location relative to the start of the zone From patchwork Mon Dec 16 21:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910561 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 E16C61DDA21 for ; Mon, 16 Dec 2024 21:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382999; cv=none; b=CDPZ9gnblUJ56R2C8PtHA7S2Dzlb+v77QAceUCI3GQLcwwJZXgH2vDzcRyz0hVAMC3dNud9kwy+LcrSXt/Ty51DwSOskwMGqHswCIh1ZQCXHdwjJ+lJ9ro+Zn3EZEohc8tXQS44iBPSj67s39bR0o3CPsB/HnHpJWfvK1sRzSQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734382999; c=relaxed/simple; bh=2Ph+ckJX+fc1IBb1oVC5HTjexIIyiGqPDJLEQYLnNQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B3amTPdalg444uM5FI/EIYZlMrFsyC7QZLC+fS0M8orOmUDbxSXwsJMfg0puenC4nv7O5eQMDZEk4XuZnlQJludAKCn0/AViw0xB9EHSQxTRMUWSsLDWwzTc1J1C5sHl1FAnpROFqXlFO85Kv3926eir4os74kcXMIeTnVF/eiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=rxB5/mZK; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="rxB5/mZK" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsq940rjz6ClL9C; Mon, 16 Dec 2024 21:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734382994; x=1736974995; bh=tHGUS 8kHZ5mZzZyaiXIx6o9AVK4Y4JY2Qq/yPY+00Kc=; b=rxB5/mZKUpYZgAk/vj3xG D6Yyy9scocWhWdoW0cOj1ANowbufEZWPwEIldy8z/1KLRt5M+ofO4Hm+l7IxuWBA hd9km+jQlMgjCck2jwzdrJd+dfQkkblXwnHBcXq+pVRN4xZhJUacpjA+r2mD/036 w4Dr2yTJzx0ZppPdd6z2i1GS42f4X63bXVFbMk81V/2DW/1IO2QBua7lRVFSx61E TqJ4dAVzyWwyc3/Fq9AV51mSSmeB0el2T9XUn1N4lYibUiAy2i6BfluwmCFO+Mzu zvCXQxJm3ZMAbl+RrDLVFoUcesNdDVPXhwH6/LliPVlctZeiWaRNK4bgSb4gWgGP w== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id gc-Cxix3DxGo; Mon, 16 Dec 2024 21:03:14 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBsq45HbSz6ClL93; Mon, 16 Dec 2024 21:03:12 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 3/6] blk-zoned: Document locking assumptions Date: Mon, 16 Dec 2024 13:02:41 -0800 Message-ID: <20241216210244.2687662-4-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document which functions expect that their callers must hold a lock. Cc: Damien Le Moal Cc: Christoph Hellwig Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- block/blk-zoned.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 3e42372fa832..ca44b2d6727c 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -460,6 +460,8 @@ static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug) static inline bool disk_should_remove_zone_wplug(struct gendisk *disk, struct blk_zone_wplug *zwplug) { + lockdep_assert_held(&zwplug->lock); + /* If the zone write plug was already removed, we are done. */ if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED) return false; @@ -914,6 +916,8 @@ static bool blk_zone_wplug_prepare_bio(struct blk_zone_wplug *zwplug, { struct gendisk *disk = bio->bi_bdev->bd_disk; + lockdep_assert_held(&zwplug->lock); + /* * If we lost track of the zone write pointer due to a write error, * the user must either execute a report zones, reset the zone or finish From patchwork Mon Dec 16 21:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910562 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 0BAEA1F63CC for ; Mon, 16 Dec 2024 21:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383001; cv=none; b=CCKhvzYVTjx7zmbOYL8FM1HlwpzMyWwABjVhFeyCl51hixrTrWlDG0xkOg9B2jWHX728pyhrLPmoG8dsYhwfHGl4NwhNlaMhxikJfh3jmTNTG6m9H02d162MyCSTFA7k0d98PROV9kQpio51R5civIZz3H59NxurS7IQjBwg7Mg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383001; c=relaxed/simple; bh=VUeOKj6HZr9/fJs+KOeqwtbg6S/1QHBiTNXjgw/6DcQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9vp80HvTHPUMzjX6NL6qI0w3DZWIm/2pfsZjbVbkGxjxJGcCZQPP5sjHO4mCqwFUTWzoYyWTqCphPEkbKIVH9a69J8Z4E8P5K0Xt2YXMXT9P4h15124x7hyAHuB2MPGSU0MG4Z5vAfdFEDLStTqriQ74zP6QkcJaZt3T1YsBeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=J5/6zC6g; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="J5/6zC6g" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsqC3r2Cz6ClL9F; Mon, 16 Dec 2024 21:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734382997; x=1736974998; bh=oqtFk XX96EFCrVmhT1/SQ1yFceo55p1jUK2XK3s8VHw=; b=J5/6zC6gphOIyVWE0INh2 kheKAwAre9Ky3a2BL0tklArK2HTqSwZutW+mnEIj/D2CbVtuFt6TPT8KsHFSMTeZ rPIcW05T10t0JHM5Ow9b980hFOXcRvjaJDXm9PKEyLicUSOJbjb/FC6pv4HSOATS 1AKPB4865SaS29U/miyu2m6dUaMcjoG0T0QyRijaQd7lK5rhbohVEk8rfWCD2MAO A3Mmn0XCHXEXtzo4wTLU8JCDdcGkM/N/TGxC5JJRmb/Kp3ucbT4cX/BVNr4m9lgB NfNFoQuf/kghSgvJRalY27tZ6Kl5oZh/GcXqmQE7+ZfMWC1P4vPUnuInQudLX1Mp Q== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id EJ9Vza-OCLiy; Mon, 16 Dec 2024 21:03:17 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBsq71xBgz6ClL92; Mon, 16 Dec 2024 21:03:14 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 4/6] blk-zoned: Improve the queue reference count strategy documentation Date: Mon, 16 Dec 2024 13:02:42 -0800 Message-ID: <20241216210244.2687662-5-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the blk_queue_exit() calls, document where the corresponding code can be found that increases q->q_usage_counter. Cc: Damien Le Moal Cc: Christoph Hellwig Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- block/blk-zoned.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index ca44b2d6727c..0f7666441fe1 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -583,6 +583,7 @@ static inline void blk_zone_wplug_bio_io_error(struct blk_zone_wplug *zwplug, bio_clear_flag(bio, BIO_ZONE_WRITE_PLUGGING); bio_io_error(bio); disk_put_zone_wplug(zwplug); + /* Drop the reference taken by disk_zone_wplug_add_bio(() */ blk_queue_exit(q); } @@ -894,10 +895,7 @@ void blk_zone_write_plug_init_request(struct request *req) break; } - /* - * Drop the extra reference on the queue usage we got when - * plugging the BIO and advance the write pointer offset. - */ + /* Drop the reference taken by disk_zone_wplug_add_bio(). */ blk_queue_exit(q); zwplug->wp_offset += bio_sectors(bio); From patchwork Mon Dec 16 21:02:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910563 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 7A2CF1F63D5 for ; Mon, 16 Dec 2024 21:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383004; cv=none; b=c3ECmo7abBl/u5TBQkj5k2dsSxUUZswJq6PE3gzKQZICTFR9DTbX3WAOAeMA0SDkwIbbaggSyc+8PSt04AL1z50od+AWVK93l+r2rZVIlE5kR8N6QhxZKyDysR5kNp30l0HsNxp9ZvVsWgyy2Y9aDInBIZlav9RyDVCYsVOARWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383004; c=relaxed/simple; bh=VACA2ecG33bUQrgFylNRnrD3Pd+WfwlZMeNrvbBi04g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cRGON06Xft6/Wix9w33odKAj+TOyJuXtHb7jS1Gb96su/67HB/e2v/SPShajcZK7hTotsBkiMt795KZvd5QJAOhkwl6L1N/fmzRLdhF4xQ8NtC3EVLZH25383qR8efPQh6Ct/J+I0ZsqOHfmMqmqo2+35HtKyvOmFh8nEYc14pE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=T3DSW/Xw; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="T3DSW/Xw" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsqG71srz6ClGyv; Mon, 16 Dec 2024 21:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734382999; x=1736975000; bh=/L/Hm MFqqbZ+RCYLMJhKCmZR2Q+fxYlsaf2qmBBxSS4=; b=T3DSW/Xw99fRHXQHhkPW8 oKav3ogLa/D2l+B+Fql3WRy5Bb7KUh19Y/MnE0FgCfRYaC0MPxpwau/tShLeduw6 GwUQTAdwfbCpT7XzL/jRweN4wfN0gyssmWpVPSVg4CPkiUdXT5/2sTanZvdz6S3D zsTQvVJws2vWvrVc5n9N2Rn0LBdcSTmPf6EAVYSh1AYvjld7btaXlaWyEKTLgv3H e75W0Ly0Chax4hjUUN4ikhm0HMh992VBaDP6/wNZHUSuQN/CnB1r6owNzqn2ares sK9hTqa1sj/tguTL/nJMpH4L4/kSKfLnH9I68C1kfdDFL44ZgCfrxNV4/RM+Weew Q== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id Bu2aufGzZ-nb; Mon, 16 Dec 2024 21:03:19 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBsq96Ynvz6ClL93; Mon, 16 Dec 2024 21:03:17 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 5/6] blk-zoned: Uninline functions that are not in the hot path Date: Mon, 16 Dec 2024 13:02:43 -0800 Message-ID: <20241216210244.2687662-6-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apply the convention that is followed elsewhere in the block layer: only declare functions inline if these are in the hot path. This patch makes it easier to debug the code in blk-zoned.c with trace_printk(). trace_printk() only displays the function name correctly for functions that are not inlined. Signed-off-by: Bart Van Assche --- block/blk-zoned.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 0f7666441fe1..046903fc6030 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -575,8 +575,8 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk, return zwplug; } -static inline void blk_zone_wplug_bio_io_error(struct blk_zone_wplug *zwplug, - struct bio *bio) +static void blk_zone_wplug_bio_io_error(struct blk_zone_wplug *zwplug, + struct bio *bio) { struct request_queue *q = zwplug->disk->queue; @@ -1389,7 +1389,7 @@ void disk_free_zone_resources(struct gendisk *disk) disk->nr_zones = 0; } -static inline bool disk_need_zone_resources(struct gendisk *disk) +static bool disk_need_zone_resources(struct gendisk *disk) { /* * All mq zoned devices need zone resources so that the block layer From patchwork Mon Dec 16 21:02:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13910564 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 1FA791F63CF for ; Mon, 16 Dec 2024 21:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383009; cv=none; b=frnJhnH/mHBmKikpguLsWvh2e4Fs4SgmOre8+3D7tC8O9sZOHOTXENvW5ct5BncH3OZbjhkoqhXDZJH94+d5aEViN3EilLzzdz69S6iPqxDt4y7XXoFy36M6aAoLf7EsQ2ki4iRqsPSqeG7W5UVqID94vy1AbdxC+8NT7DxkNHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383009; c=relaxed/simple; bh=1vQduErAgDe6IEAGwdVO7lU1DJvAIpoGcCI/MpLKfeQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adtwBPm91mce+Bm0zZYH2pFgjJ30A88beFO3Pga85EoDU79gLQ96oJYd8Bn7iodzfINTxQ7N7ZRVtOICnIuwSUN9ymO1kI39EyRAm+l8ifHAmLEVUNKc4pRpcC4fGPL9rZ2U0pB/MHY4sTOOcQ6roDJDoI1JtJoGCn5Pa/6EbFY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=DiYad5vN; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="DiYad5vN" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YBsqK4NPqz6ClL93; Mon, 16 Dec 2024 21:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1734383002; x=1736975003; bh=pMaIv TXyz2kjxfcqw1nCs7Jsla/POgbqpj2J3wxOBHE=; b=DiYad5vNbYxd3W1aAj3AY k7l7OgR19XdUAZVrsgNljpbECatEUB2FER2UV6yUZfzEm/oyDQKAVEoEO5xdwK36 Kf/D2hAUA956Z6QxDrG8Wl6hTulRLkhn0V6drzMCLMTacD8KbiBUJifdhH19arBB G1o0JuIZ6Y35ywt67Gi2fLTFKPzuf0Zge+pZBwtCZ1gA8bgLqb30MwggkgSInWAK Gvmo78kcTlOl9jfD8Jt9d5+lHuXOhHDVme3YJ1eZE/hqrHjUE18ziZ4R8E5K9+d+ A9bRXpH6lUdsOzDd4Zc42MLgPmuNyuLtphWzvJkkCyGDNLrneJjH0uURHNHhIXz5 w== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 41cF3vFBZHRk; Mon, 16 Dec 2024 21:03:22 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YBsqD1tRpz6ClL92; Mon, 16 Dec 2024 21:03:19 +0000 (UTC) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Damien Le Moal , Bart Van Assche Subject: [PATCH 6/6] blk-zoned: Split queue_zone_wplugs_show() Date: Mon, 16 Dec 2024 13:02:44 -0800 Message-ID: <20241216210244.2687662-7-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241216210244.2687662-1-bvanassche@acm.org> References: <20241216210244.2687662-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reduce the indentation level of the code in queue_zone_wplugs_show() by moving the body of the loop in that function into a new function. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- block/blk-zoned.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 046903fc6030..775ad7016659 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1775,37 +1775,41 @@ int blk_zone_issue_zeroout(struct block_device *bdev, sector_t sector, EXPORT_SYMBOL_GPL(blk_zone_issue_zeroout); #ifdef CONFIG_BLK_DEBUG_FS +static void queue_zone_wplug_show(struct blk_zone_wplug *zwplug, + struct seq_file *m) +{ + unsigned int zwp_wp_offset, zwp_flags; + unsigned int zwp_zone_no, zwp_ref; + unsigned int zwp_bio_list_size; + unsigned long flags; + + spin_lock_irqsave(&zwplug->lock, flags); + zwp_zone_no = zwplug->zone_no; + zwp_flags = zwplug->flags; + zwp_ref = refcount_read(&zwplug->ref); + zwp_wp_offset = zwplug->wp_offset; + zwp_bio_list_size = bio_list_size(&zwplug->bio_list); + spin_unlock_irqrestore(&zwplug->lock, flags); + + seq_printf(m, "%u 0x%x %u %u %u\n", zwp_zone_no, zwp_flags, zwp_ref, + zwp_wp_offset, zwp_bio_list_size); +} int queue_zone_wplugs_show(void *data, struct seq_file *m) { struct request_queue *q = data; struct gendisk *disk = q->disk; struct blk_zone_wplug *zwplug; - unsigned int zwp_wp_offset, zwp_flags; - unsigned int zwp_zone_no, zwp_ref; - unsigned int zwp_bio_list_size, i; - unsigned long flags; + unsigned int i; if (!disk->zone_wplugs_hash) return 0; rcu_read_lock(); - for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) { - hlist_for_each_entry_rcu(zwplug, - &disk->zone_wplugs_hash[i], node) { - spin_lock_irqsave(&zwplug->lock, flags); - zwp_zone_no = zwplug->zone_no; - zwp_flags = zwplug->flags; - zwp_ref = refcount_read(&zwplug->ref); - zwp_wp_offset = zwplug->wp_offset; - zwp_bio_list_size = bio_list_size(&zwplug->bio_list); - spin_unlock_irqrestore(&zwplug->lock, flags); - - seq_printf(m, "%u 0x%x %u %u %u\n", - zwp_zone_no, zwp_flags, zwp_ref, - zwp_wp_offset, zwp_bio_list_size); - } - } + for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) + hlist_for_each_entry_rcu(zwplug, &disk->zone_wplugs_hash[i], + node) + queue_zone_wplug_show(zwplug, m); rcu_read_unlock(); return 0;