From patchwork Thu Dec 28 07:55:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505659 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D05694401; Thu, 28 Dec 2023 07:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sIUUno5s" 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=yBEmKZVlehpTfMsqJcs5UrNKZT7aMOCpSurlpZlFZsk=; b=sIUUno5s3ItA0BiHZh1mp4seJb FmI2ePJmNtv2r8PSBvIL1KHUuJ42E75ZE/2/Q6/Nl826tMfpbyNEyRYkVRgpVmATvwdObOknGKjM/ /RBJZIFMyY+sk39NISUwuPsK7yRXnlMH+l+u5sh+cMQbvZcs9Q52YKHlVRnP5Xp43mLkGlqdgjGok b6CpuM6P/HEdvcBMV4aW0D0oA7uJ3Lb/wDPdirDwTXJ3gWYTDzNQjyIoOin+FUQ3KwsQZKJfJP1Ut CSGvByXXdI230c4HlDDykOLsTLoTzUs/orkn1slOE6iCVlBipVBwuPuO/3sxYlBU5AH0qNoEI9UE9 9EDTx7vg==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFE-00GMqW-1v; Thu, 28 Dec 2023 07:55:57 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 1/9] block: remove two comments in bio_split_discard Date: Thu, 28 Dec 2023 07:55:37 +0000 Message-Id: <20231228075545.362768-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html A zero discard_granularity is not treated the same as a single-block one, and not having any segments after taking alignment is perfectly fine and does not need a warning. Signed-off-by: Christoph Hellwig --- block/blk-merge.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 65e75efa9bd366..2d470cf2173e29 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -115,17 +115,13 @@ static struct bio *bio_split_discard(struct bio *bio, *nsegs = 1; - /* Zero-sector (unknown) and one-sector granularities are the same. */ granularity = max(lim->discard_granularity >> 9, 1U); max_discard_sectors = min(lim->max_discard_sectors, bio_allowed_max_sectors(lim)); max_discard_sectors -= max_discard_sectors % granularity; - - if (unlikely(!max_discard_sectors)) { - /* XXX: warn */ + if (unlikely(!max_discard_sectors)) return NULL; - } if (bio_sectors(bio) <= max_discard_sectors) return NULL; From patchwork Thu Dec 28 07:55:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505660 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D05924402; Thu, 28 Dec 2023 07:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="X5x8LsO7" 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=VWcP0rXhfX4Tpyx1C2oTgUUfvY4Ov9XACS1uYCYkWFQ=; b=X5x8LsO7IbK30BlWll4bAl3Yu2 Nnr3tA/pxO8vsdt95yX0T0Q8hK8zlKjtyIne9PfNa/QpFv3DxlYmaw0dfBNLve4dcBqemC24gFNC9 13KjhR6yKGz38gr4V7JnC3VE0UK5BRuY2ihthkLKu1L9p3OCoU5XPux906ciahlC8CQe6IWePcLzK N86XdM/D8Bp+bphasOmls48841EPT5uTfur6iAjw7teAqGFPyM/vJssNVlfQtS/oZKUfKlT+JwNbl GLzxCHVQOCxvhIgcIN5zpuDd2/4yBRvkbQ8RyQLyK3IetO4EH/aY1zgjN5/A+KOF+sjJx1I4u9N8m toSELIfw==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFK-00GMr8-11; Thu, 28 Dec 2023 07:56:03 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 2/9] bcache: discard_granularity should not be smaller than a sector Date: Thu, 28 Dec 2023 07:55:38 +0000 Message-Id: <20231228075545.362768-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Just like all block I/O, discards are in units of sectors. Thus setting a smaller than sector size discard limit in case of > 512 byte sectors in bcache doesn't make sense. Always set the discard granularity to 512 bytes instead. Signed-off-by: Christoph Hellwig --- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index bfe1685dbae574..ecc1447f202a42 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -954,7 +954,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, q->limits.max_segment_size = UINT_MAX; q->limits.max_segments = BIO_MAX_VECS; blk_queue_max_discard_sectors(q, UINT_MAX); - q->limits.discard_granularity = 512; + q->limits.discard_granularity = block_size; q->limits.io_min = block_size; q->limits.logical_block_size = block_size; q->limits.physical_block_size = block_size; From patchwork Thu Dec 28 07:55:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505661 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D5AD63A8; Thu, 28 Dec 2023 07:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="q0Q0ryNe" 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=q/HlW27opIlbbmmp83fWxmA7/2zguajj/Xv/HUI85Ao=; b=q0Q0ryNe8UapoNJP1iv256wXB7 AKKH1RzReJIql5mHIaDlcciH6hppE8XQzYd0b7I9z9ta6uVqPGlp7jeJje6FZefhf6n8UwS54/DRk k7hRoAcxq6Nt2j4xT8CddN59KcRFFFbh+xwES6UEc08OPH78AWblWsWmGodSQ14+JMhc2IfAWfXdL /Yjk7FaIeZMs5pDIXvEpaOPq/Z1MhrYNAqtc0NlPsba4XM77DfklCf/8S0ujSbPlHhFzb971QjDAz CUnxm5D0UuGnR68fNPqhoFYG0jx9nOiqQ5/uzRnGS4gdEk5n6YtCfPh+uCGHDEigqL9s1axdxKMXB TXlGzQIQ==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFP-00GMsI-1M; Thu, 28 Dec 2023 07:56:08 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 3/9] block: default the discard granularity to sector size Date: Thu, 28 Dec 2023 07:55:39 +0000 Message-Id: <20231228075545.362768-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Current the discard granularity defaults to 0 and must be initialized by any driver that wants to support discard. Default to the sector size instead, which is the smallest possible value, and a very useful default. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index ba6e0e97118c08..d993d20dab3c6d 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -48,7 +48,7 @@ void blk_set_default_limits(struct queue_limits *lim) lim->max_discard_sectors = 0; lim->max_hw_discard_sectors = 0; lim->max_secure_erase_sectors = 0; - lim->discard_granularity = 0; + lim->discard_granularity = 512; lim->discard_alignment = 0; lim->discard_misaligned = 0; lim->logical_block_size = lim->physical_block_size = lim->io_min = 512; @@ -309,6 +309,9 @@ void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) limits->logical_block_size = size; + if (limits->discard_granularity < limits->logical_block_size) + limits->discard_granularity = limits->logical_block_size; + if (limits->physical_block_size < size) limits->physical_block_size = size; From patchwork Thu Dec 28 07:55:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505662 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B92363AA; Thu, 28 Dec 2023 07:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ibxzL5lN" 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=YnZwpgW+A+U7sHEyEvT+XJdmhYJP2QlSIUrM4OF+rrI=; b=ibxzL5lNVlHOPryuLBd8aNfxKL B2HEnDHaXk9gwWu02Jt3i+2cipsv7SEe63EtkOlGo9Ld0loMul/FAG3LvbyaWJE9/6y75wt6oaewm dLLNl4oIIqjndKeDbIWfbO0CZ43XBzNqO/BSdQtMxnMw3/84ECbu7wuzFgStIcnnnqktXwnKElETz HdlnCx4GEDVxLOfE1HELsw8k4NSsQuB30fXW6jc7DOO4Wat0SofP3y5lg/xy58uO5F27m2UDflVOj /9Ti7YwMD2w0JIj3wFYQVfja3lCGoJAC5Ve66rdELdm92YIXiaul6ONXhnufil4JjhXOsQ2J5AXwt ZESfYwAg==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFU-00GMtf-1k; Thu, 28 Dec 2023 07:56:13 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 4/9] ubd: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:40 +0000 Message-Id: <20231228075545.362768-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Signed-off-by: Christoph Hellwig Acked-by: Richard Weinberger --- 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 50206feac577d5..92ee2697ff3984 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -798,7 +798,6 @@ static int ubd_open_dev(struct ubd *ubd_dev) ubd_dev->cow.fd = err; } if (ubd_dev->no_trim == 0) { - ubd_dev->queue->limits.discard_granularity = 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 Thu Dec 28 07:55:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505663 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6515963A8; Thu, 28 Dec 2023 07:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="h+Oyfw7R" 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=itdVUuZkm0LZ+weCUcEbxBOsHJ+rlR6exlHXpKSCP7g=; b=h+Oyfw7RYjWrkcTN2ba1o6EmFf zZ1BqSX5hlE3Q3lGi2pIkJn+HHR2Jigaci2ap0d1mJmuEBORpqUJSPvoCBApTo0QFlEFzzt90Culh 4WjaZp8N9tOuW2aV3D68CYbH9eFdVvXw1xnRMvJr8leIYQ+qjVA4W3W8yk3VthWhU3J4D70XMpgvR vjQ+u1RxROAiQaM2LM5C9KhUHgHI+MAvhfkWkJ9Q1+lNgANNbKaS5dV8WtaeEmyPgXsDhYwpQ5K1A iwBEmV+2ZT/xZ3aB2o7KyOe3Z9fnwSK6CcCVYQA+2VcymmPF457UuJDTbV6TXbtUZDZv1TyjTGx5H Gk4aqomg==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFZ-00GMvn-2n; Thu, 28 Dec 2023 07:56:18 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 5/9] nbd: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:41 +0000 Message-Id: <20231228075545.362768-6-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Also don't bother clearing it as a discard granularity without discard_sectors doesn't mean anything. Signed-off-by: Christoph Hellwig --- drivers/block/nbd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index b6414e1e645b76..4e72ec4e25ac5a 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -334,10 +334,8 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize, if (!nbd->pid) return 0; - if (nbd->config->flags & NBD_FLAG_SEND_TRIM) { - nbd->disk->queue->limits.discard_granularity = blksize; + if (nbd->config->flags & NBD_FLAG_SEND_TRIM) blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX); - } blk_queue_logical_block_size(nbd->disk->queue, blksize); blk_queue_physical_block_size(nbd->disk->queue, blksize); @@ -1357,7 +1355,6 @@ static void nbd_config_put(struct nbd_device *nbd) nbd->config = NULL; nbd->tag_set.timeout = 0; - nbd->disk->queue->limits.discard_granularity = 0; blk_queue_max_discard_sectors(nbd->disk->queue, 0); mutex_unlock(&nbd->config_lock); @@ -1850,7 +1847,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs) * Tell the block layer that we are not a rotational device */ blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue); - disk->queue->limits.discard_granularity = 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 Thu Dec 28 07:55:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505664 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D89E5380; Thu, 28 Dec 2023 07:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kVsyUeuh" 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=/h0qPLS5GksMisZ4y70aYJqSTUpd/uwxKnaJuVcN1Ds=; b=kVsyUeuhRShTtVg84BvhP3mqwR klXDPBxFV4LE+k+Oh1BygZkzfCmTDK9VTogI8bMyExaAiAvs792bfQKXC6jNX8dmtWol77Wc+Y5Ly BaKf+6KmEKZ/O6to+WunPWU4GGtTwgR/8/0lmMs0ZSpwzBIefTH9XqeAyX7Q+SQGdqufuEwssLRja aaajcchJyC9YpwUJov0uYa46SGaUOOqz50l2BubMDnTlmfscDYpaRTbM6Y/3XpJqaLUvgiMAstlTT LZD48mck8LHdJBIt3ER3AN17xTV7pFpK2aBCqR7vEmGQqdANFgA1EEJOXf24wCE+ZRzYjw25l8Qi0 PH0fEz6g==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFf-00GMy0-0b; Thu, 28 Dec 2023 07:56:23 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 6/9] null_blk: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:42 +0000 Message-Id: <20231228075545.362768-7-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Signed-off-by: Christoph Hellwig --- 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 13ed446b5e198e..9f7695f00c2db8 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1880,7 +1880,6 @@ static void null_config_discard(struct nullb *nullb) return; } - nullb->q->limits.discard_granularity = nullb->dev->blocksize; blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9); } From patchwork Thu Dec 28 07:55:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505665 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEB226129; Thu, 28 Dec 2023 07:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Y49WPhuj" 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=hX9CA1F/gZTSSUEPUcjUUVKeYYM6YHvLgIrnJbMOHpQ=; b=Y49WPhujPsQGPIbmImVmP4ADcj XUgG243FeVpoCRp4PjZTzFz24B2O5wIWK5OaUdIid+1L9JR2bbYN4+p+1ItqSmNzh0OCgyY8vzEDn AG59xDdyNMk4ypzuhlbgDKkwRRh9gSbxLp8lvslLyEHsParQEm5H4z/q7fF6qFqmnqZonRfmFR4O/ JdUU8txaV0hQtfEvgLTH1mL/1Bzm1KaHW8zHJxVmVFcOpu3oiDTUraHRcQdPXcykxwzfycRuKHSPU OUHbY5nAZ6Hdlh9p5l1o8oVw18ZuOujrPCOkbYfcE5SuQ5VP8aDc8r8WFmF5B3amXbgWZLqu+1SGV CEPqSkMQ==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFj-00GN0p-2v; Thu, 28 Dec 2023 07:56:28 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 7/9] zram: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:43 +0000 Message-Id: <20231228075545.362768-8-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Signed-off-by: Christoph Hellwig Reviewed-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index d77d3664ca0805..e1dec0483a012b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2227,7 +2227,6 @@ static int zram_add(void) ZRAM_LOGICAL_BLOCK_SIZE); blk_queue_io_min(zram->disk->queue, PAGE_SIZE); blk_queue_io_opt(zram->disk->queue, PAGE_SIZE); - zram->disk->queue->limits.discard_granularity = PAGE_SIZE; blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX); /* From patchwork Thu Dec 28 07:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505666 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E4B96129; Thu, 28 Dec 2023 07:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jyfAgZsM" 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=HkpcWKQTIPI7GkyZeehGy5v+hhspknRU+JppGoiJJYA=; b=jyfAgZsMcb6a2gLtPG5M0l55w/ 8qsgzUL7o1Z2AlXctu0haJvQ8KcAuoc3OwNfmpQ84a+dBEr/gsd1O+QQ4RPLye0xjLHhyqwAGjPu5 fHvw4kEnc6/Di98VmcPv3Pt2CW9Hevz1S44EVBQvFQMdhHpojpjvlpprqCPdKPTKZ2qxMMHJvigF0 RlWDlvB16ZVwsYiL9vmZnz5VMBFSZ3k7id14Oka+1MEY3f3bYMye33qG8IeJTHJK91MahyIbTtfa4 OvdcgunJZdIqqCGwdxPVtyZReR9yL/zIGaYxTwWZODjFVO02kbLGAVwYv7wigd9Uwtv3FE/AIK9dJ jjoRUdXA==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFo-00GN5Y-2d; Thu, 28 Dec 2023 07:56:33 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 8/9] bcache: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:44 +0000 Message-Id: <20231228075545.362768-9-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Signed-off-by: Christoph Hellwig Acked-by: Coly Li --- drivers/md/bcache/super.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index ecc1447f202a42..39ec95b8613f1f 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -954,7 +954,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, q->limits.max_segment_size = UINT_MAX; q->limits.max_segments = BIO_MAX_VECS; blk_queue_max_discard_sectors(q, UINT_MAX); - q->limits.discard_granularity = block_size; q->limits.io_min = block_size; q->limits.logical_block_size = block_size; q->limits.physical_block_size = block_size; From patchwork Thu Dec 28 07:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505667 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B77D63AA; Thu, 28 Dec 2023 07:56:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="wZTk26BE" 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=qL8kHS1rYh+gv9hkwoDZ143zco7FsB0lPosLn/FG0m8=; b=wZTk26BE8oHrKqHwNc/Z2bI7Wk oopEdonQrTp9hk6Wb4pU9nbU/BWFRdyiy/uJkyjBeXrcvXRI5DYQHlTz7I5I+myV7Xu9KXEOPl5ZO zQf5kwRXAuDd8sAF7BREbQ3BkNVUA0wYrLvkzKRv9Aw8/ZpKgEZce91fPHfMFK7ymsfPbLX3Izw5C h93vxOKQ9kZhxL17pARvrnAer+RRYMDq+W6jNFEebGYyRG7C/CXISiUGa3K6o47CNn0cIpNQ1ZhiP 0hAr6rWtcep1izxj4auMpdTzyehww/YHWhBdpyoqZCUpUWm1gMs86ePI3i6phnbUpPDn6KnYMpK2I Xqz1c2uA==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFt-00GN9z-2s; Thu, 28 Dec 2023 07:56:38 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 9/9] mtd_blkdevs: use the default discard granularity Date: Thu, 28 Dec 2023 07:55:45 +0000 Message-Id: <20231228075545.362768-10-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 granularity now defaults to a single sector, so don't set that value explicitly. Signed-off-by: Christoph Hellwig Acked-by: Richard Weinberger --- drivers/mtd/mtd_blkdevs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index ff18636e088973..0da7b33849471a 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -376,10 +376,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) blk_queue_flag_set(QUEUE_FLAG_NONROT, new->rq); blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, new->rq); - if (tr->discard) { + if (tr->discard) blk_queue_max_discard_sectors(new->rq, UINT_MAX); - new->rq->limits.discard_granularity = tr->blksize; - } gd->queue = new->rq;