From patchwork Tue Dec 17 21:03:07 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: 13912492 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (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 72783208CA for ; Tue, 17 Dec 2024 21:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469425; cv=none; b=ctHUB/9ZG0O6nDdF17QdkcfTEsxRBSIoCziCdgZn0aZi/Scz3gZIwhfDJ6aNuuyohqqotti9QF4UMLtjck/Yi1g8R2DKL6EMkVjqDLTIBApPvcADmMfrOGYPKgHUNd23LPK52d22Uh0QvLfMxmT0HOwQp5sAhn8KvoJ66R35qP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469425; c=relaxed/simple; bh=b6XxMoqKPRqzA41Ihhuy4iSUUqw7rjt1XG3TB7PIE6I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o4fYI60aMxNU9qfJGZZ8rv/TI1065AuRvH9N4BSje4oSC8MbGbin45rE7rq0zXPQIMBlYKwDXQWsLIUUpu6P/C7pAY/toyCtffsLYNOg+AiNA0EimPu7dD8praqI94Y6DBOJAsF+G9knW/zN6K/UGCnPzWXz3s9mGJ5Xyc2IdYw= 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=dH+M+e7l; arc=none smtp.client-ip=199.89.1.12 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="dH+M+e7l" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4YCTnB5R0Bzlff0R; Tue, 17 Dec 2024 21:03:42 +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=1734469420; x=1737061421; bh=23bQf w34nixb5IIDjji7jV9sgJ/RP3Oy+qWdQwnjyGc=; b=dH+M+e7lrMYZxaN3qxYPo +kouhwYkiEZnFItZjL07sz8ksImAcx+I82qLiUPQhWhA8bbycyhoLTJVh3aOl4M3 LB0RVorIUKvOU8NPPz7FVLgaxR3XwVU1YeepVAwG/fD5a/4ZhEbZ3lJIRL4m14bG kyl5Sih9kjdq5J//ysv+upQW1o9gPJ2HTMNnrmTpaYm/XRYXflYntWttxYz10xtt cNQq6LE5Ojc3jOchukwvvXe5c8STy4BkXxXLd1EwSULV7znAOI+ZF92iCxCZt4gE C2Ud9hJ16I0GVaXkO+tw7urWMr3VxRgtC03FvcFa8+d5GkF4jsq+jFHWlCjQ0lK6 w== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id GKwTLJ0JXGr4; Tue, 17 Dec 2024 21:03:40 +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 009.lax.mailroute.net (Postfix) with ESMTPSA id 4YCTn65xMXzlff0H; Tue, 17 Dec 2024 21:03:38 +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 v2 1/4] blk-zoned: Minimize #include directives Date: Tue, 17 Dec 2024 13:03:07 -0800 Message-ID: <20241217210310.645966-2-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241217210310.645966-1-bvanassche@acm.org> References: <20241217210310.645966-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. Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal Signed-off-by: Bart Van Assche --- 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 Tue Dec 17 21:03:08 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: 13912493 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (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 8B67F1F9EA1 for ; Tue, 17 Dec 2024 21:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469427; cv=none; b=fYJuCDGL7r6MnErxdl02kE5+fnSORCMf94Z3sSLUSbdDDJC89dfNWnoC+7HlV7i08atap27Q/Vsw0HOdM7JnqpMmo4gGCjLyFcTWmaKsKaA9JkxkBxH/Eu0TOxPHqrpjFuucVpjaHNuzO8iib6icwewREsBX9IHIz7SW3UehxGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469427; c=relaxed/simple; bh=sTayVdxLAbxgn0NmFyaOeA70Tcd2ToblYi/CduPewTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ozoDy3mQEyQ7kLY2aCTz7ZpjT6GfoESqDACAF6wy0VZ975gKLBpr7cqylzgIxP3QJtk2aNRupLh5Tm9lmYkge9bUfpIWXHLTaWQdwVeQvXgAK4xTam8L8OHRz1RZyoqNmMQNDmEzCW6E+28tuSzAv714IXW15wJLpSvygiT99Ns= 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=pa/FmH7p; arc=none smtp.client-ip=199.89.1.12 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="pa/FmH7p" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4YCTnF19dtzlff0S; Tue, 17 Dec 2024 21:03:45 +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=1734469422; x=1737061423; bh=zNdUO ZJ5W1ph3lRZzM6Hvq55+6hVqNbBrqFuHqEsgm0=; b=pa/FmH7pm1d2YrrrdIRlA Rkv4jLe1SOuObECEfexjAjnB3FpcB2CmeUslsg7lk4PRgl81to0RZbMuBNO3dJ0o 8kY1jS1ypRglbsljKy6yplxeVYB40C/rkqS1aX9Wafyf2vXPPuLSU0auSfdwUHic Ig3I2+ztc+6k/YMqpMEmWxqI3iJ3gBG8KPoSpLimeUM86tjirald1yCwP+iPkqK1 Jtw/gtSLl27TjIuFSh4wiax/dbx4qObj6DG2+zvP9QcldD1Fl6u73g9e0oCVNQLz JmVfpHzblgaqttIk83m7M08WYOe4vRDV8+ghUE8BMmo/EXsY6Wn7qdz4iYJS93lq Q== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id p-z725pHn53B; Tue, 17 Dec 2024 21:03:42 +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 009.lax.mailroute.net (Postfix) with ESMTPSA id 4YCTn90NFdzlgd70; Tue, 17 Dec 2024 21:03:40 +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 v2 2/4] blk-zoned: Document locking assumptions Date: Tue, 17 Dec 2024 13:03:08 -0800 Message-ID: <20241217210310.645966-3-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241217210310.645966-1-bvanassche@acm.org> References: <20241217210310.645966-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. Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal Signed-off-by: Bart Van Assche --- block/blk-zoned.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 1575b887fa38..954724a2e3c6 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -459,6 +459,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; @@ -913,6 +915,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 Tue Dec 17 21:03:09 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: 13912494 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (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 A5D091F9EC8 for ; Tue, 17 Dec 2024 21:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469429; cv=none; b=U1isJg9SGmn+QWrVX34O2BfLzW9RGRL/KxmwupAEw1ohwDWRBGQco879WN4X1saQYnp7n/1pacqT5wWyDbjxPHhGpKSyVhtHcxwcHJCFBl+p3k4Nzr2jXSF72DruU6l2Jq4drbrgs20dH6zFp8KfnzfefzLpBacD2rsB8Ut/gas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469429; c=relaxed/simple; bh=DuyLsVnWhrzYYdDZAEtQCNUwRrgzHgenWRbdrcmjqG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IUOp3gWQe8IbxQFweckwFsBfANvkUBlyqYZa1xoHfg2vac0s1Qje2mbpXUlId3/QXqpjQb7vFYUBxw2QdbATyliUZRMpS31REaCWhxy44iXsmPVp3mL35TFpzOMjT2ghdtWb78h0bfQZKkDBZG/jA96MAjrQhoctZ41kJIc3ozs= 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=fneg1bue; arc=none smtp.client-ip=199.89.1.12 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="fneg1bue" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4YCTnH1775zlff0T; Tue, 17 Dec 2024 21:03:47 +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=1734469425; x=1737061426; bh=hQh4h lwBz5ACefTfyXmFGa8/l1NyschLJQ2aetxmvvE=; b=fneg1bue2aWa3ktSUpHra v96YVWMGvhO/6omOmAWQsE46S2JIFyzbpdbRLrxDkcMEmeomDEc5f6WYb6XiSxqx 9CMlBoiyFfoGGMNdbSvQm3uhLqFtxLVd5PoCYhKky/9U2MWOnCzWDJNcznRrvvZn E59EfXKuPgb8zsvRBrIFoempQQ5s6Vc117DEgzJvaKYNEMtZyYIwqF7g+5dAgvq6 vtzUh86kHngVq710DWRpgxjtfTpo1MTHjnM053SrqiozbDSr3/FHk0roLUzCuGxK 2WvjVMm2upNW5nJCmNLpubsuWlHknS40MEZiB5eKv+lRfKf/8o4WQD1CdRCK+AgY w== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id asMXGCIReAfU; Tue, 17 Dec 2024 21:03:45 +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 009.lax.mailroute.net (Postfix) with ESMTPSA id 4YCTnC2YrPzlff0H; Tue, 17 Dec 2024 21:03:42 +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 v2 3/4] blk-zoned: Improve the queue reference count strategy documentation Date: Tue, 17 Dec 2024 13:03:09 -0800 Message-ID: <20241217210310.645966-4-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241217210310.645966-1-bvanassche@acm.org> References: <20241217210310.645966-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. Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal Signed-off-by: Bart Van Assche --- 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 954724a2e3c6..7876a6458022 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -582,6 +582,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); } @@ -893,10 +894,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 Tue Dec 17 21:03:10 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: 13912495 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (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 AE7631F2395 for ; Tue, 17 Dec 2024 21:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469432; cv=none; b=frZ3gLvyMDF0mjgUVnRVsd5kd7lI7KBW9l2ycN78ZRFaDR9zfiD5vvaFqVFQaUn8CdqnNctpFk/7Jg9nluiH2Oj0ca3I9zhi/2fc8MDOLh8kW0IFUDmf36pURxaM/dN2y4F9oVq1A79ORd13XgnHW9mmdiokDcphIkHQ0Q1w1qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734469432; c=relaxed/simple; bh=djPMCH+oULT72tbh1LSngF8eVCrDX/VPC8ayX3TD+TA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MDhWtLcS2c/H4r96UWVIahR6umhP1x/1M70KOBp2Zb7WfcuOj+XWHJcbHfw65ARYwnhnL7y1c0x6lz6s/cD34P3sS5gOIIXKt6uBmr96nKNtJtZj83YosZvx2N5kR1reGExOieUKK1W8FrOw2RyhvvBwH1XGFU0tIMYpVl8GOEU= 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=XGbg6lhM; arc=none smtp.client-ip=199.89.1.12 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="XGbg6lhM" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4YCTnL1KcHzlff0H; Tue, 17 Dec 2024 21:03:50 +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=1734469427; x=1737061428; bh=IBZ7s 5zPdP/QT6Oqx+UuKyMEnWDh3S2vG5NKG/Zejp4=; b=XGbg6lhM54wszEDpVIam3 hSskmuyaIXzxvs9HHN2CdK+Qv82nvEV2LlhO+XOEnDc86ty0DvATolHifjyZ9oUr zZTe5su3vtI/VvEiG/QOsimsqWY1xIdy9OrfcqJjXmBv67Bp+9Lw4Bsp0Xal2R1m teb1O6m8zX5+tLWIp2C1qD4UM/3eCaVGibV/w7NrQDf0HLZCVoC76TrLyUcGocMy 4gbmz7rnMENOfDsBBPINvb+vGKnzDo/pEm5cmTVeKgYlZWhhbwRfmwZpPM/twUDf 2gmptObW+HYwwj0XemKvsvCbTL8OM+BJusNZXFM3hiuwLmad16tlpXSJxGgwLAyK Q== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id hqrNUJangEYV; Tue, 17 Dec 2024 21:03:47 +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 009.lax.mailroute.net (Postfix) with ESMTPSA id 4YCTnF461jzlgd70; Tue, 17 Dec 2024 21:03:45 +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 v2 4/4] blk-zoned: Split queue_zone_wplugs_show() Date: Tue, 17 Dec 2024 13:03:10 -0800 Message-ID: <20241217210310.645966-5-bvanassche@acm.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241217210310.645966-1-bvanassche@acm.org> References: <20241217210310.645966-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. Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal Signed-off-by: Bart Van Assche --- 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 7876a6458022..4b0be40a8ea7 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1774,37 +1774,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;