From patchwork Mon Apr 18 04:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7701C43219 for ; Mon, 18 Apr 2022 04:53:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306872.522048 (Exim 4.92) (envelope-from ) id 1ngJOV-0001fR-QU; Mon, 18 Apr 2022 04:53:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306872.522048; Mon, 18 Apr 2022 04:53:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOV-0001fK-Mo; Mon, 18 Apr 2022 04:53:47 +0000 Received: by outflank-mailman (input) for mailman id 306872; Mon, 18 Apr 2022 04:53:46 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOT-0001c8-LY for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:46 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 859e67d2-bed3-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 06:53:44 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJO3-00FYha-FT; Mon, 18 Apr 2022 04:53:20 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 859e67d2-bed3-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ehhbXywWEInDu2MzhhcU8qyC2x202NRIVxnfV552fWg=; b=4+aRzQJYcjSRih3CAHHoWbQKH7 tpRyxCuoqoDD29J+mP/JD+tuOpLTzRf6tGAVyuGm1tGzqWiKw0VPI3Z//Ivegeb/zkkMfBF25uEJu 8o1KOY9vmrdu70v5p52qRPOvKYU/KO1j7AILK0X1SV3xH0zUNCBtjO5MxmPWDyB3FnDcknLf1/b8+ fYnEzGYeuBU14+X4y8DMlr1JmpgaZUgZLWvLmRML5UshcDri7muDpboKeTNp2VDYLGcnydDsZfdy1 EQTV6mqhUtxtdvZYv9mIEeqGcvXfbsOHMtH6Uny/9EHEwtxN5JNm1DCu1+PcS53QbmFNMsfc4uiGB S1uPtQoA==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 01/11] ubd: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:04 +0200 Message-Id: <20220418045314.360785-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by ubd is mostly harmless but also useless. Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 085ffdf98e57e..c4344b67628dd 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev) } if (ubd_dev->no_trim == 0) { ubd_dev->queue->limits.discard_granularity = SECTOR_SIZE; - ubd_dev->queue->limits.discard_alignment = SECTOR_SIZE; blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST); blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST); } From patchwork Mon Apr 18 04:53:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E56DC4167B for ; Mon, 18 Apr 2022 04:54:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306876.522076 (Exim 4.92) (envelope-from ) id 1ngJOX-0002Az-QR; Mon, 18 Apr 2022 04:53:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306876.522076; Mon, 18 Apr 2022 04:53:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOX-00029z-GC; Mon, 18 Apr 2022 04:53:49 +0000 Received: by outflank-mailman (input) for mailman id 306876; Mon, 18 Apr 2022 04:53:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOW-0001do-5T for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:48 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 85b226ba-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:53:45 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJO6-00FYhe-Hq; Mon, 18 Apr 2022 04:53:23 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 85b226ba-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=koCagwvOxhN7Shu8/AJxKzZVAKuzrO1L5//iYnC02Iw=; b=AfuHTR/V7lcr3zFbVv43aXi0wl 9BXiL1MXkRpqJBplwxZBu6BMXzKAwM3cLacngv6w9v/xu4r4wsZXJzUpjj8oykifbHGOdLOj9+cXd w57UeuYr1aXFL4KN5snqFZNRlx3/zg/as2hg/byKwuFPkRBWSqYCMgz6Nalf6bjYlUrYWYMFOg7lM VVtAyBmc/UB6YQDpwNy9RxJMNN3OFjU5UKmrw+vl4PuZd7vQ6hmG2jXje40n9Bl31/uUTw3g/iABO fgajCyxoKwPRp2bRxD9DHepUAQfpOnb0+QEai/a9nd+iaTwNGZ7XqT7mmOiN9r3r1T9l317vuoSmZ 0Zs1vSZQ==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 02/11] nbd: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:05 +0200 Message-Id: <20220418045314.360785-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by nbd is mostly harmless but also useless. Signed-off-by: Christoph Hellwig --- drivers/block/nbd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 4729aef8c6462..102597a4277b9 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize, if (nbd->config->flags & NBD_FLAG_SEND_TRIM) { nbd->disk->queue->limits.discard_granularity = blksize; - nbd->disk->queue->limits.discard_alignment = blksize; blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX); } blk_queue_logical_block_size(nbd->disk->queue, blksize); @@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd) nbd->tag_set.timeout = 0; nbd->disk->queue->limits.discard_granularity = 0; - nbd->disk->queue->limits.discard_alignment = 0; blk_queue_max_discard_sectors(nbd->disk->queue, 0); mutex_unlock(&nbd->config_lock); @@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs) blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue); blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue); disk->queue->limits.discard_granularity = 0; - disk->queue->limits.discard_alignment = 0; blk_queue_max_discard_sectors(disk->queue, 0); blk_queue_max_segment_size(disk->queue, UINT_MAX); blk_queue_max_segments(disk->queue, USHRT_MAX); From patchwork Mon Apr 18 04:53:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC88EC4167B for ; Mon, 18 Apr 2022 04:53:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306873.522055 (Exim 4.92) (envelope-from ) id 1ngJOW-0001iM-6P; Mon, 18 Apr 2022 04:53:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306873.522055; Mon, 18 Apr 2022 04:53:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOV-0001gj-Ul; Mon, 18 Apr 2022 04:53:47 +0000 Received: by outflank-mailman (input) for mailman id 306873; Mon, 18 Apr 2022 04:53:46 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOU-0001c8-Hl for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:46 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 854ca340-bed3-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 06:53:43 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJO9-00FYiQ-3d; Mon, 18 Apr 2022 04:53:25 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 854ca340-bed3-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QvtQsYVY573QihyBU8P2z12+bQQI/RcwQdA2DddKTiA=; b=LUQ5PRFm2GAJyoA/D+xu4w8Ii5 0paCHfyXTYDxbjypETMxwgir9bcwOwM4o4rWjUOpuxTq4I9Q4G/j7GVoJnIwTdVosqCyx9KlBfHHz GBr7tV+xv5gxPcKBzizKftU8Qv6ZFFPGtMjheiYrReTlWeRhvuhAaarOva0kSOa3erCllKH+TrqTE Z8pVWD52/LOaeff3ZAer03ApAz1EBAKLkUGDdVFxHrg+FnoIus0ydxQ8Xo+w5VHre+DsJ0CVzeJRd u4Ni5puCzFaEbwzGI41J6IW4XU0jzki6izerpFqhBoxMjIEwaBJMooUN/P+xSgYx2bCA+8qthvREk rDuUzWUA==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 03/11] null_blk: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:06 +0200 Message-Id: <20220418045314.360785-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by null_blk is mostly harmless but also useless. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 5cb4c92cdffea..a521e914a9843 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb) } nullb->q->limits.discard_granularity = nullb->dev->blocksize; - nullb->q->limits.discard_alignment = nullb->dev->blocksize; blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9); } From patchwork Mon Apr 18 04:53:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EEE4C4332F for ; Mon, 18 Apr 2022 04:54:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306874.522060 (Exim 4.92) (envelope-from ) id 1ngJOW-0001st-ME; Mon, 18 Apr 2022 04:53:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306874.522060; Mon, 18 Apr 2022 04:53:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOW-0001oP-EB; Mon, 18 Apr 2022 04:53:48 +0000 Received: by outflank-mailman (input) for mailman id 306874; Mon, 18 Apr 2022 04:53:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOV-0001do-CN for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:47 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 867b6edd-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:53:45 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOC-00FYj8-0H; Mon, 18 Apr 2022 04:53:28 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 867b6edd-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=KG+SgMW1cgxv4FiMP5E+75DsV8uftH+qG3p1TXEyEio=; b=WCY6skOHo4HAb9P+VnkeBFb0Wd 6HtmKYsZebjLRF7olS575CTUsYnepT6MLhQcw4sj2+aChzDYFdv2TJAkdt+xyZ1fXNBl7i0qMNjh3 atVTLApTQdVrJzkAw+e1xu5UI+XeibuBhpE8sdBqSRgmuc6LQWX7Gh+vwa6QmZwgL4o7wDhOkPATZ JJdiL4zj1+8ON5LJ5rpzrXXnZZ2Gt3WLli0Y+Kla+bD/xTw/zq7EpruzAfxZI9IfvyngDrwoC2oVp 27txs+BLBDIzzVrm7MMsfkvqKD3aBSqEiOBeG/1GG6jcIJdI2YJ/vneItfmtIQXQEFbm2vNa5lU9l aHTP8xYA==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits Date: Mon, 18 Apr 2022 06:53:07 +0200 Message-Id: <20220418045314.360785-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. On the other hand the discard_sector_alignment from the virtio 1.1 looks similar to what Linux uses as discard granularity (even if not very well described): "discard_sector_alignment can be used by OS when splitting a request based on alignment. " And at least qemu does set it to the discard granularity. So stop setting the discard_alignment and use the virtio discard_sector_alignment to set the discard granularity. Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support") Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6ccf15253dee1..d624cc8eddc3c 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev) blk_queue_io_opt(q, blk_size * opt_io_size); if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) { - q->limits.discard_granularity = blk_size; - virtio_cread(vdev, struct virtio_blk_config, discard_sector_alignment, &v); - q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0; + if (v) + q->limits.discard_granularity = v << SECTOR_SHIFT; + else + q->limits.discard_granularity = blk_size; virtio_cread(vdev, struct virtio_blk_config, max_discard_sectors, &v); From patchwork Mon Apr 18 04:53:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC515C3525B for ; Mon, 18 Apr 2022 04:54:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306877.522097 (Exim 4.92) (envelope-from ) id 1ngJOZ-0002l6-Af; Mon, 18 Apr 2022 04:53:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306877.522097; Mon, 18 Apr 2022 04:53:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOY-0002hT-Vx; Mon, 18 Apr 2022 04:53:50 +0000 Received: by outflank-mailman (input) for mailman id 306877; Mon, 18 Apr 2022 04:53:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOW-0001c8-Ey for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:48 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 87e10c8b-bed3-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 06:53:47 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOE-00FYjt-Uc; Mon, 18 Apr 2022 04:53:31 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 87e10c8b-bed3-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=jJDfNJ+noyJ0aQwSxPjfuM0bukOLXIlZdKOCCRo7UC0=; b=xuIkX7BaO7YLYo2xtforYUeJSz D4ZkceNgWZcqsdA4kKDR70kSEQCNujP+EuBqv6qBw0ZF92W/0/cEfjWOan0nETRKihTYr6lzIZlZl bBcwq/JHARHxWpbiEMaI9y7fhWsSop569zSNCbdEUmCgnceKeTdNHmdubHo2T02f4jZnDeMuy9YEp gX5Gk0YQFUdeh+lTgVE6905xov9XyUfA8uV/rEBVxEimHbnB03TXVy+Q+6Z3Gp8bR9szIE8Cp8Ndy rknbV4gm7RVldjeoTzmK+sn63+wAUNv9Myo89P/eXTHdhfPYO+SAS69EJRqWmwD6yqU/r8IFcrYqq /61rhfuw==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:08 +0200 Message-Id: <20220418045314.360785-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by dm-zoned is mostly harmless but also useless. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- drivers/md/dm-zoned-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c index cac295cc8840e..0ec5d8b9b1a4e 100644 --- a/drivers/md/dm-zoned-target.c +++ b/drivers/md/dm-zoned-target.c @@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits) blk_limits_io_min(limits, DMZ_BLOCK_SIZE); blk_limits_io_opt(limits, DMZ_BLOCK_SIZE); - limits->discard_alignment = DMZ_BLOCK_SIZE; + limits->discard_alignment = 0; limits->discard_granularity = DMZ_BLOCK_SIZE; limits->max_discard_sectors = chunk_sectors; limits->max_hw_discard_sectors = chunk_sectors; From patchwork Mon Apr 18 04:53:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84FFFC433EF for ; Mon, 18 Apr 2022 04:54:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306878.522114 (Exim 4.92) (envelope-from ) id 1ngJOb-0003PC-JP; Mon, 18 Apr 2022 04:53:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306878.522114; Mon, 18 Apr 2022 04:53:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOb-0003Oz-Ds; Mon, 18 Apr 2022 04:53:53 +0000 Received: by outflank-mailman (input) for mailman id 306878; Mon, 18 Apr 2022 04:53:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOa-0001do-6Y for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:52 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8a06660d-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:53:51 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOI-00FYkg-0o; Mon, 18 Apr 2022 04:53:34 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8a06660d-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5rcnJ83GrgSSabCav/BawazCovpIiEvHei2b2gmullQ=; b=CjJhpozaz3ZvUqlOlRhUG6HF0e L1k08qBdI7FjLxrC+2SHHoNWrKKNNyMlTyF4yTi95nmPu6QjzipSWH9TvaHMjTe8XoTWpzOf49Xwn /jTNmyPXW291lu9ai/kVpUcGZy0BEma/a+v71WBQptYeQK53Oa4G3wRCg1iH80jgNCDh+UkonCJTi b2hNWpI0YPpjBR+0L2Bg82wVndKnPmP8XXH33hc/RLegnrrgdomyqC3ANZRjwyzqph4yUIcfGGV1b 13e7GSLfhf8SaHCAofITijpch9zJ9GPiLs40aqk7qM6e7KoHhSnPrPVcNE2jwVOMrxC25OuZ8i44W kFZNgihA==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 06/11] raid5: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:09 +0200 Message-Id: <20220418045314.360785-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to the discard granularity as done by raid5 is mostly harmless but also useless. Signed-off-by: Christoph Hellwig Acked-by: Song Liu --- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 59f91e392a2ae..39b0afdf40d0a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev) */ stripe = stripe * PAGE_SIZE; stripe = roundup_pow_of_two(stripe); - mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe; blk_queue_max_write_zeroes_sectors(mddev->queue, 0); From patchwork Mon Apr 18 04:53:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F851C43217 for ; Mon, 18 Apr 2022 04:54:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306880.522124 (Exim 4.92) (envelope-from ) id 1ngJOc-0003ha-Sy; Mon, 18 Apr 2022 04:53:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306880.522124; Mon, 18 Apr 2022 04:53:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOc-0003gx-Oi; Mon, 18 Apr 2022 04:53:54 +0000 Received: by outflank-mailman (input) for mailman id 306880; Mon, 18 Apr 2022 04:53:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOb-0001do-RW for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:53 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8b1b7e18-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:53:53 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOK-00FYlu-W5; Mon, 18 Apr 2022 04:53:37 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8b1b7e18-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=rEun4CykQNh9XCzIn07hcf266lJSo8SoQFV5h3aZDN4=; b=Iyi59rQ8jx9ZFvYgDjqU1HKgI3 3ER3HIO6el0yfwsbhwUqMaebwGQMLJp2Ty8pfApDcdy/dox4NBRD0zlAwgVZHz3C//ttRe2EpMMpE TlYo85CuBa66xfYMYNTFqP97nYG9E4UMoh/+mq+XldHcgyiYn8t88j0p38CFlHyG1WnflGfc9N6IQ ALupyQSKl6Do9NriswZQgpSbmVhWvg3qZzOpBx8BeEjzA/SfHSRhmM03Xd44QDRw6m5kWouXbMQLj EsfQEvQ7/s2jVpOeH9ws1tRZrnKNo3KfR2dNjEk6WSbmEVrg/W3E52Bl0bOqmREpLbkSwxlK3mr9T SboayqTg==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 07/11] dasd: don't set the discard_alignment queue limit Date: Mon, 18 Apr 2022 06:53:10 +0200 Message-Id: <20220418045314.360785-8-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The discard_alignment queue limit is named a bit misleading means the offset into the block device at which the discard granularity starts. Setting it to PAGE_SIZE while the discard granularity is the block size that is smaller or the same as PAGE_SIZE as done by dasd is mostly harmless but also useless. Signed-off-by: Christoph Hellwig Acked-by: Jan Höppner --- drivers/s390/block/dasd_fba.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 8bd5665db9198..60be7f7bf2d16 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block) blk_queue_segment_boundary(q, PAGE_SIZE - 1); q->limits.discard_granularity = logical_block_size; - q->limits.discard_alignment = PAGE_SIZE; /* Calculate max_discard_sectors and make it PAGE aligned */ max_bytes = USHRT_MAX * logical_block_size; From patchwork Mon Apr 18 04:53:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D019AC433EF for ; Mon, 18 Apr 2022 04:54:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306882.522136 (Exim 4.92) (envelope-from ) id 1ngJOg-0004EI-Cm; Mon, 18 Apr 2022 04:53:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306882.522136; Mon, 18 Apr 2022 04:53:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOg-0004E3-7e; Mon, 18 Apr 2022 04:53:58 +0000 Received: by outflank-mailman (input) for mailman id 306882; Mon, 18 Apr 2022 04:53:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOe-0001do-9X for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:56 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8c8ec796-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:53:55 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOO-00FYn5-24; Mon, 18 Apr 2022 04:53:40 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8c8ec796-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Nwnahs8dGCrFyGqh76Osy38QIfFTcrX+bg/5w9K9Oig=; b=JeF0YY6h1iSEXtKIJVRU4DnakB iSag4ipYDNufx4HIec1J7pwr04yj7IlNVOtLFyn04Wv2YpFZQhlvsu33m0GRmsb3PkylahgmTcFWG A4k1DZepK4PC3rtyMOIt75ceY450AzbeQqmXxm+KLwXIuNpy9wB3M0Uxbj7eFeRU7NZgOrm9qsdNf A83iEm2C44aUr+gvbqtQjawIInyHUcvlGHqsANM4j5nbfMhu01wcMFNv2L5KV+vzWfSNOxp+gx01K hklzOClX07D/J1uBkeOOPeQzaPTilIo4n7FSI/fYdOVYYmtE3o12kxKv1emVZBbh+e6QSqMnFkRxM x9QqhNaQ==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 08/11] loop: remove a spurious clear of discard_alignment Date: Mon, 18 Apr 2022 06:53:11 +0200 Message-Id: <20220418045314.360785-9-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The loop driver never sets a discard_alignment, so it also doens't need to clear it to zero. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Chaitanya Kulkarni --- drivers/block/loop.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 976cf987b3920..61b642b966a08 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo) blk_queue_max_discard_sectors(q, 0); blk_queue_max_write_zeroes_sectors(q, 0); } - q->limits.discard_alignment = 0; } struct loop_worker { From patchwork Mon Apr 18 04:53:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 698C8C433F5 for ; Mon, 18 Apr 2022 04:54:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306886.522147 (Exim 4.92) (envelope-from ) id 1ngJOj-0004jW-53; Mon, 18 Apr 2022 04:54:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306886.522147; Mon, 18 Apr 2022 04:54:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOi-0004jA-TR; Mon, 18 Apr 2022 04:54:00 +0000 Received: by outflank-mailman (input) for mailman id 306886; Mon, 18 Apr 2022 04:53:59 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOh-0001c8-3i for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:53:59 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8df91ea5-bed3-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 06:53:58 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOR-00FYpT-19; Mon, 18 Apr 2022 04:53:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8df91ea5-bed3-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=p9kVzatrYS3rOQLSwSVe7hP5f0rChlSo2rdSBrIcPYE=; b=0FL1fru1SsYGhSt8FM9Hn5xwZJ EmQtcyxuckYmdCptFk4+/gbaxge3l3nq3kRFPBP2il/Rof09pxe6Ws2nfts4MKx5OwwmpIZVuaYn4 QeXpjkKcOgL+kIGAlsZf8TM3L2foTyd4yXmmcS+vpt95vjmJlLA2Izx3NJJBScVt157v41DjhjlqM L7UcHqXMheEW+Am7Onu8gXnRyneCudkfEE0daVhQvCm9moV6YBkxEJJ4GpFmY1uJvO31vQEX3ElTE DJMzx/mYKMVBU0H0c+NGX3DON4EMSxBXtNngeE5dikTPdCHtE3RUwtmqsEkdAx9DNdwjKW/ddgcK7 QLRmmVOw==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment Date: Mon, 18 Apr 2022 06:53:12 +0200 Message-Id: <20220418045314.360785-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The nvme driver never sets a discard_alignment, so it also doens't need to clear it to zero. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Chaitanya Kulkarni Reviewed-by: Sagi Grimberg --- drivers/nvme/host/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b9b0fbde97c80..76a9ccd5d064a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns) BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) < NVME_DSM_MAX_RANGES); - queue->limits.discard_alignment = 0; queue->limits.discard_granularity = size; /* If discard is already enabled, don't reset queue limits */ From patchwork Mon Apr 18 04:53:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816290 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD503C433F5 for ; Mon, 18 Apr 2022 05:02:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306917.522158 (Exim 4.92) (envelope-from ) id 1ngJWX-0000Wn-0e; Mon, 18 Apr 2022 05:02:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306917.522158; Mon, 18 Apr 2022 05:02:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJWW-0000Wg-U2; Mon, 18 Apr 2022 05:02:04 +0000 Received: by outflank-mailman (input) for mailman id 306917; Mon, 18 Apr 2022 05:02:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJOl-0001c8-Qc for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:54:03 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 910a362d-bed3-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 06:54:03 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOU-00FYrv-1m; Mon, 18 Apr 2022 04:53:46 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 910a362d-bed3-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=l98+JE7NsbGjf5nWv4p96TEYrrJUm3Xf8r7AJ/Re+50=; b=b3jjhl3NnpidTbS0yNml6BOTZ8 g5tAOt/e4fr16yh0hdRjlvIGx02REr0Be/uhAhfgcsNY4E/teSSgiM/GgyhOUQSv8IiRoSt3RzkXd 8ui/01VcFQfFGEsSUAyAx5STB9OojQQpAMNCVjttzU6nFKsO6z0j+D3KoS7MAvwWFyJEJ3mY3oIsB aTOMIweseDzyB/wuWieC2B/KurzoqX4uzoCO/b2//x4TSx2HhfzcfsLpYy6R0eW8NN3W7VB+YjfkW SzDEVVy4J5mGZoqCt2e5fSbZvWNFqqIYUzWtTTDJikCF+4YJ7f49HyVqAPAjNJ9U+5xHbqAhd2nPp Q4yHIWlA==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 10/11] rnbd-srv: use bdev_discard_alignment Date: Mon, 18 Apr 2022 06:53:13 +0200 Message-Id: <20220418045314.360785-11-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Use bdev_discard_alignment to calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Acked-by: Jack Wang --- drivers/block/rnbd/rnbd-srv-dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h index d080a0de59225..4309e52524691 100644 --- a/drivers/block/rnbd/rnbd-srv-dev.h +++ b/drivers/block/rnbd/rnbd-srv-dev.h @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev) static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev) { - return bdev_get_queue(dev->bdev)->limits.discard_alignment; + return bdev_discard_alignment(dev->bdev); } #endif /* RNBD_SRV_DEV_H */ From patchwork Mon Apr 18 04:53:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12816291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 290D6C433EF for ; Mon, 18 Apr 2022 05:02:40 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.306935.522169 (Exim 4.92) (envelope-from ) id 1ngJWw-00016Y-8W; Mon, 18 Apr 2022 05:02:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 306935.522169; Mon, 18 Apr 2022 05:02:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJWw-00016R-5W; Mon, 18 Apr 2022 05:02:30 +0000 Received: by outflank-mailman (input) for mailman id 306935; Mon, 18 Apr 2022 05:02:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngJP0-0001do-Qb for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 04:54:18 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 941fd8d7-bed3-11ec-a405-831a346695d4; Mon, 18 Apr 2022 06:54:08 +0200 (CEST) Received: from [2a02:1205:504b:4280:f5dd:42a4:896c:d877] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngJOW-00FYuM-S5; Mon, 18 Apr 2022 04:53:49 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 941fd8d7-bed3-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=FtH/TzYq8qAlMP8iMYBlGWDgAyvZ+dC0QKeXw0CO9iY=; b=BUsTo3zH0HXFlc2PINU8GKGh7x xOheprcMV4SR/Bv+uFwxwEEXQNbDYNV0dXmpOloJvszTTFIFrVWaZxvzBY3RFcl0N0jCpn4vw3nb4 mTGNcSlargn2+/9oPzLzWJrWP+vix6g0SW/61Ow0uZFQlb8WOgevrVuktiq9QO8aHLzYorKaOwQBQ CfxG3eR2YUokj3T01RV5d+uhBYCjSMPbPfvUkXoiOxJvCqf7RvI027xldIPQkqonm5kkPHmkKj1CY TNHlrnSp6mhzujyAzSdQ8dHMYyS7hxSExdUVN15TaHiISjHO2rUQKK97SneL+jfBatao0hyUgCdvx 1/5nIEmg==; From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Johannes Berg , Josef Bacik , "Md. Haris Iqbal" , Jack Wang , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Mike Snitzer , Song Liu , Stefan Haberland , Jan Hoeppner , "Martin K. Petersen" , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 11/11] xen-blkback: use bdev_discard_alignment Date: Mon, 18 Apr 2022 06:53:14 +0200 Message-Id: <20220418045314.360785-12-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220418045314.360785-1-hch@lst.de> References: <20220418045314.360785-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Use bdev_discard_alignment to calculate the correct discard alignment offset even for partitions instead of just looking at the queue limit. Also switch to use bdev_discard_granularity to get rid of the last direct queue reference in xen_blkbk_discard. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- drivers/block/xen-blkback/xenbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index b21bffc9c50bc..04c90cb8955f6 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info if (bdev_max_discard_sectors(bdev)) { err = xenbus_printf(xbt, dev->nodename, "discard-granularity", "%u", - q->limits.discard_granularity); + bdev_discard_granularity(bdev)); if (err) { dev_warn(&dev->dev, "writing discard-granularity (%d)", err); return; } err = xenbus_printf(xbt, dev->nodename, "discard-alignment", "%u", - q->limits.discard_alignment); + bdev_discard_alignment(bdev)); if (err) { dev_warn(&dev->dev, "writing discard-alignment (%d)", err); return;