From patchwork Wed Jun 19 15:45:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704205 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 0534915383B; Wed, 19 Jun 2024 15:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811995; cv=none; b=dgGVEUbV7zjP0+B2iI3e4klXnZrwwiBxQezsm9eQCgseKkQzGHRnAnommOJo/vhb8awrhzqQzYFZPhij5XMbs6EkzA9L5taKC0Lyl3jg9qaAKZrzkHcLHphqMz2ZzsNbDM9af5YTS8oHNgJLcKPcY58Umj18SCL6lt6u5GD5vGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811995; c=relaxed/simple; bh=pP9E1Gydj41nYSOifbdT7gDEY73n7HhM/FdSWReedvw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rY8IT/NKyZnPVhP+WFj3TtRpuKBWYlJiuVAsOqzRWgzkvSuqw9bMvxsajMtU+HyWgpsYlHsSOROtglEr3W/bnB+CSRtGsbSKUlkaRGBR1kl5yCIYx0NMTInU6xOyIgojSlMRYQJMi52M/UWhFq+3QvnTKyc7THO52DJSdJidQFg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=zfB9Inlx; arc=none smtp.client-ip=198.137.202.133 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="zfB9Inlx" 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=ZFHW6cZmNbfyInrIJ+LfPJqUpG3HCHTXd6HTHWSG4Bs=; b=zfB9Inlx/dSUTBOS2x8DEIf7NI y8JM++BBexQBC03jI3bpQ1+48xw2DzM8wXBGqFMMIt9e1ryRKYTNe5mf5xJ4+UeuSYQIbA9MKBQTr nr4W39lNcxC7Ra5zIb4di3eEyobHa3JYniDwzrV4ndR3GnmnGhQzQUlNCOSOTFsvhtL6pPKXcZtno PBD15xtUh8Vgk+SjiHoMQ/EIeZvd/qsLTf6SrWnD1gxn02wsnugaEcJNnYPNSITgFzKuo1jD31//r YdXRZhYIlXLbjbzWXcs67yvxDZs7dag/mfvef5yr5vawryygDgcY4vxA8sOMy83AJ9ZL4GxRCFU6W WgZ5vAEg==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxW3-00000001smY-41aJ; Wed, 19 Jun 2024 15:46:32 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org, Keith Busch Subject: [PATCH 1/6] block: remove the unused blk_bounce enum Date: Wed, 19 Jun 2024 17:45:33 +0200 Message-ID: <20240619154623.450048-2-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 enum has been replaced with the BLK_FEAT_BOUNCE_HIGH flag. Reported-by: Keith Busch Signed-off-by: Christoph Hellwig --- include/linux/blkdev.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e96ba7b97288d2..f7d275e3fb2c1e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -343,15 +343,6 @@ enum { BLK_FLAGS_WRITE_CACHE_DISABLED = (1u << 31), }; -/* - * BLK_BOUNCE_NONE: never bounce (default) - * BLK_BOUNCE_HIGH: bounce all highmem pages - */ -enum blk_bounce { - BLK_BOUNCE_NONE, - BLK_BOUNCE_HIGH, -}; - struct queue_limits { unsigned int features; unsigned int flags; From patchwork Wed Jun 19 15:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704206 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 30A2A15383B; Wed, 19 Jun 2024 15:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811999; cv=none; b=N+sDfXNBadIByNDhue26EEiMD0uAWnrioiq73wwFOWTHHJYeC4N9tOY8YAoV8HzkuZmSqjWXF7SL4HZ5AoStIobnm3EfPGtjLD1trc1OeAxwJkRm0+ymm46asjrV6FiKhLmrW8fSEg7cr7QtZRI7R9G5YCtBlRQqW+d9FmpEIg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811999; c=relaxed/simple; bh=ojkOSgVCppJ3/huMkxkjU1q71hlb+ZZ0xAW4WiF7vug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D++SRa26oPPFZi2fIgP76cqbg/QUbp7LhM7N77SsXbOgzF4jLGQApe0aOugIkXpBENa0gFxmDpBUmV0QkLUMk3fP/JJjsLtzENF3rh0+ZFDSVCm4Kc8waMmAzv+0QU+c8oW2lu88VGgRh80RxkvUth7+fw+bg5cQKiylsV8MWJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=lg4vg5uo; arc=none smtp.client-ip=198.137.202.133 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="lg4vg5uo" 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=1Wdms+Xcf2ZNKk9teFhxm0lC2UVVmYWKAGgDHDGJh8A=; b=lg4vg5uoogT6YpyHRXz96b96X/ ez6++RGGHvLSPi5hdJaT3aDfbe93lfn+RVroO+BetRYlnE+ggtMuNSqLYSlfDLzNAcZt31evgs7kq 4qIiUIVwWJZ4AQaI360fq+a/tpvZ3EFSgLbr4eiKOihgLZOytmvNXNtnLlz8hd1msvjjag1mW95Yq iVFDxfaNBVaxYolyLY4ZuJA+Yc9nPsemT9xwgp+7XT3q/JfUg8noxPKLLSE+4J+1liUVagG05Usmi xmin3ukJqyFACxeYtDwcA1Xs9YIXlqK3b1WTx7aGW4rBhTnMUVQmVFCsIHEZZ+rD1ATK261Jl+5pD U1paAFvA==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxW8-00000001sny-0oRd; Wed, 19 Jun 2024 15:46:37 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org, Damien Le Moal Subject: [PATCH 2/6] block: fix spelling and grammar for in writeback_cache_control.rst Date: Wed, 19 Jun 2024 17:45:34 +0200 Message-ID: <20240619154623.450048-3-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 Suggested-by: Damien Le Moal Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- Documentation/block/writeback_cache_control.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/block/writeback_cache_control.rst b/Documentation/block/writeback_cache_control.rst index c575e08beda8e3..c3707d07178045 100644 --- a/Documentation/block/writeback_cache_control.rst +++ b/Documentation/block/writeback_cache_control.rst @@ -70,8 +70,8 @@ flag in the features field of the queue_limits structure. Implementation details for bio based block drivers -------------------------------------------------- -For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simplify passed on -to the driver if the drivers sets the BLK_FEAT_WRITE_CACHE flag and the drivers +For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simply passed on to +the driver if the driver sets the BLK_FEAT_WRITE_CACHE flag and the driver needs to handle them. *NOTE*: The REQ_FUA bit also gets passed on when the BLK_FEAT_FUA flags is @@ -89,7 +89,7 @@ When the BLK_FEAT_WRITE_CACHE flag is set, REQ_OP_WRITE | REQ_PREFLUSH requests with a payload are automatically turned into a sequence of a REQ_OP_FLUSH request followed by the actual write by the block layer. -When the BLK_FEAT_FUA flags is set, the REQ_FUA bit simplify passed on for the +When the BLK_FEAT_FUA flags is set, the REQ_FUA bit is simply passed on for the REQ_OP_WRITE request, else a REQ_OP_FLUSH request is sent by the block layer after the completion of the write request for bio submissions with the REQ_FUA bit set. From patchwork Wed Jun 19 15:45:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704207 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 6ED6C15383B; Wed, 19 Jun 2024 15:46:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812005; cv=none; b=Xn42oagl3W3Ce8VkuR4i23G6/9sehfvV2RSFadk/cARp6Qu+QcZ0G9AJjRbdZfJyCSVBIEvyNvyW28MRpw/xQ0ya4DCtScmpOS8NpXYzqGUHYnN3GuzjNKXM8eJjcVPGUW06osyklMtVjmayZik8sJ6r359ORek6W8K+rCUl46A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812005; c=relaxed/simple; bh=tiN2bRWunE40KIDbhYdpa981MaxpzGWujd7qj+moaJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rgUcJK+4icUTbLnQjygWfIxHngd+gmVrSgvaktgDRbsi2G2c6GcTMs3OrUKn2reQurCFpSvoR043mtIXlKhtBghy1qVe7sQbhCjs0mPQQKObF3G5t3zh1YPmAKTy/0soFwfC64uB/ZkFtLGDJvqLVMd6lXZeU/BRhPigioxYzRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=SUT5SLmz; arc=none smtp.client-ip=198.137.202.133 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="SUT5SLmz" 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=MdQOFX5KYJeMhVeQ/YizIUE44aJQZiKdG4CJwyN/tFo=; b=SUT5SLmzsCdYKbi48FKoCWCA1U +rRFosEuS7A5HT2Yy7blSwF1iz1DHvlxVVEDR6Gq0+AqCTLHTirOFN5LFhefxnoiQ8L+LpSpNsxZC eOWUIIJoFdyWn2lt07RM/eAd1GZFJFyB4JZitQKFd9eyLF5D5dxZzFjlwBhdVFpl7ILSH+TJM8pg+ NfaWaYalDrbwHLOLD6CZC2k3+/JVawyTvgrhb4lyBSRO+gW1rP+slZssRp6LizgwaExlq9A+Ru5qQ 7GYU0dlKAkzp7UBweKCYJUI7ycB2kKJ1cnFjNy9dia+YRlkC1V0rdlG7tN8bBKTc+MEK+ImT6Y1xl jV2nQwvA==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxWF-00000001spR-0DU1; Wed, 19 Jun 2024 15:46:44 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org Subject: [PATCH 3/6] block: renumber and rename the cache disabled flag Date: Wed, 19 Jun 2024 17:45:35 +0200 Message-ID: <20240619154623.450048-4-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 Start with the first bit, and drop the plural-S from the name. Signed-off-by: Christoph Hellwig --- block/blk-sysfs.c | 6 +++--- include/linux/blkdev.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index da4e96d686f91e..59e6d111ed059a 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -429,7 +429,7 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page, static ssize_t queue_wc_show(struct request_queue *q, char *page) { - if (q->limits.features & BLK_FLAGS_WRITE_CACHE_DISABLED) + if (q->limits.features & BLK_FLAG_WRITE_CACHE_DISABLED) return sprintf(page, "write through\n"); return sprintf(page, "write back\n"); } @@ -452,9 +452,9 @@ static ssize_t queue_wc_store(struct request_queue *q, const char *page, lim = queue_limits_start_update(q); if (disable) - lim.flags |= BLK_FLAGS_WRITE_CACHE_DISABLED; + lim.flags |= BLK_FLAG_WRITE_CACHE_DISABLED; else - lim.flags &= ~BLK_FLAGS_WRITE_CACHE_DISABLED; + lim.flags &= ~BLK_FLAG_WRITE_CACHE_DISABLED; err = queue_limits_commit_update(q, &lim); if (err) return err; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f7d275e3fb2c1e..713a98b6dbba08 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -339,8 +339,8 @@ enum { /* internal flags in queue_limits.flags */ enum { - /* do not send FLUSH or FUA command despite advertised write cache */ - BLK_FLAGS_WRITE_CACHE_DISABLED = (1u << 31), + /* do not send FLUSH/FUA commands despite advertising a write cache */ + BLK_FLAG_WRITE_CACHE_DISABLED = (1u << 0), }; struct queue_limits { @@ -1339,7 +1339,7 @@ static inline bool bdev_stable_writes(struct block_device *bdev) static inline bool blk_queue_write_cache(struct request_queue *q) { return (q->limits.features & BLK_FEAT_WRITE_CACHE) && - !(q->limits.flags & BLK_FLAGS_WRITE_CACHE_DISABLED); + !(q->limits.flags & BLK_FLAG_WRITE_CACHE_DISABLED); } static inline bool bdev_write_cache(struct block_device *bdev) From patchwork Wed Jun 19 15:45:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704208 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 008E215383B; Wed, 19 Jun 2024 15:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812011; cv=none; b=NS8NcrGLlXPReB+VvMVAnEqjM5ot4ai+L1Cioctj+mhWFB1rA0IrYD7CvnYmUW4QUJlqvya3Zrtvu6xOkxgg/46Q1ZdCND7px1ID6cooJOro3R9t9h8Wve+z6Ylp2jy8Cp/WdQqnclf1SXYrcWMzDxXRqpM9zhv3F6KUKp7ttmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812011; c=relaxed/simple; bh=9LDRQnDuLZaYOfnkh5YwocB6uMVv1z/6AIrboDOicnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VEp7oCcwM+aatR9cKz960BTBh4itJeZJrO4e26gGHS3DF5eO4wUt7bZFYn9v9ftKoOoxvFbMpMXP3j9zAjnjQPvKmZ0i83Dd+SsUD+ggXLu4ghPexsVw+kBSiOpD65jN3QkMFbV9pviHiJSsQa3EzsrdqE8tO0K4I69F0ZDvFgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=iFufIJSo; arc=none smtp.client-ip=198.137.202.133 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="iFufIJSo" 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=o+swq+VE7tcTXydHE94IhwxRJaN9RfBdvh/8jQkpoR0=; b=iFufIJSopVGoAVAETwBgojfrPv iZIFnzXRyTZxGKFWOjzdK+4qr/ENqegTxzx2dtSLM69bPctZxZvWz6OtQ/9E4Jtp9AaAZY2gpFdoQ 0CnVUzvocdlk9JXmmD2fCqTE+oE4owelIhto0y+uodw8lTQ5FvZcJ2j9owpB1788jJlntOOppPsEx zyXRIcFP4w9eF9ey5lMiHbzgkKgFTgnrWPkNCE25G8nSN/m6TJHKkEvug/+PbDvSt/nQdiRomn/Ro gsimG06IfeunCVTPR/AR+7pFXOSrRPjawNTwhLC8waeDh5DLL4li375sZtl7fDMnbzdKUiIm4NTWk 3MBCcBLw==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxWJ-00000001sqP-33s5; Wed, 19 Jun 2024 15:46:49 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org Subject: [PATCH 4/6] block: move the misaligned flag into the features field Date: Wed, 19 Jun 2024 17:45:36 +0200 Message-ID: <20240619154623.450048-5-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 Move the misaligned flags into the features field to reclaim a little bit of space. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 20 ++++++++++---------- include/linux/blkdev.h | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index d0e9096f93ca8a..a1b10404e500bc 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -258,7 +258,7 @@ static int blk_validate_limits(struct queue_limits *lim) if (lim->alignment_offset) { lim->alignment_offset &= (lim->physical_block_size - 1); - lim->misaligned = 0; + lim->features &= ~BLK_FEAT_MISALIGNED; } if (!(lim->features & BLK_FEAT_WRITE_CACHE)) @@ -470,6 +470,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, if (!(b->features & BLK_FEAT_POLL)) t->features &= ~BLK_FEAT_POLL; + t->flags |= (b->flags & BLK_FEAT_MISALIGNED); + t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); t->max_user_sectors = min_not_zero(t->max_user_sectors, b->max_user_sectors); @@ -494,8 +496,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->max_segment_size = min_not_zero(t->max_segment_size, b->max_segment_size); - t->misaligned |= b->misaligned; - alignment = queue_limit_alignment_offset(b, start); /* Bottom device has different alignment. Check that it is @@ -509,7 +509,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, /* Verify that top and bottom intervals line up */ if (max(top, bottom) % min(top, bottom)) { - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } } @@ -531,28 +531,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, /* Physical block size a multiple of the logical block size? */ if (t->physical_block_size & (t->logical_block_size - 1)) { t->physical_block_size = t->logical_block_size; - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } /* Minimum I/O a multiple of the physical block size? */ if (t->io_min & (t->physical_block_size - 1)) { t->io_min = t->physical_block_size; - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } /* Optimal I/O a multiple of the physical block size? */ if (t->io_opt & (t->physical_block_size - 1)) { t->io_opt = 0; - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } /* chunk_sectors a multiple of the physical block size? */ if ((t->chunk_sectors << 9) & (t->physical_block_size - 1)) { t->chunk_sectors = 0; - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } @@ -566,7 +566,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, /* Verify that new alignment_offset is on a logical block boundary */ if (t->alignment_offset & (t->logical_block_size - 1)) { - t->misaligned = 1; + t->flags |= BLK_FEAT_MISALIGNED; ret = -1; } @@ -729,7 +729,7 @@ int bdev_alignment_offset(struct block_device *bdev) { struct request_queue *q = bdev_get_queue(bdev); - if (q->limits.misaligned) + if (q->limits.flags & BLK_FEAT_MISALIGNED) return -1; if (bdev_is_partition(bdev)) return queue_limit_alignment_offset(&q->limits, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 713a98b6dbba08..7ad2b1240fc0bf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -341,6 +341,9 @@ enum { enum { /* do not send FLUSH/FUA commands despite advertising a write cache */ BLK_FLAG_WRITE_CACHE_DISABLED = (1u << 0), + + /* I/O topology is misaligned */ + BLK_FEAT_MISALIGNED = (1u << 1), }; struct queue_limits { @@ -374,7 +377,6 @@ struct queue_limits { unsigned short max_integrity_segments; unsigned short max_discard_segments; - unsigned char misaligned; unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; unsigned int max_open_zones; From patchwork Wed Jun 19 15:45:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704209 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 966AD15383B; Wed, 19 Jun 2024 15:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812015; cv=none; b=rnLHnYEwsBqTlAQAagjeSVh5Hj96fR1kTJgqQMcNkECk6qSaTSAkARjSSwzbzK6hNKBlWy/e+AYy2w6tlC7Q+0i7GRuwntol10lv2Sp+i9GhfoLX8+tsiU2ojyWBqwPnKBLK/9A8NclsFW/RtlJUkJ1W26CasnGgkWzyUEbmaEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812015; c=relaxed/simple; bh=NvMnrrKfqdRLFuy/f51opINNcaQ0mxp4/GAWN1SmY3U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ABeOyQF5tCRfdLaZBdw83peWQC4+Q8kZbWKDcc3sENF9gokrNmHY2DBYXkxQY0JLbhgBlTbx6mInedVHmoSn6mh5rkSQ5SMdSBoa0/wP6F+onQ1xtoEK3/rc04JaVCMH1cNd/Vy2Bsuhz69/kGqFqdoHcZmO0vZtTx4ug2+QJzs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=f+CfUtsT; arc=none smtp.client-ip=198.137.202.133 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="f+CfUtsT" 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=/d3QkhJqFjvc1iUq3mULIHu2OHzRCVURh4ddxY1Aw1Q=; b=f+CfUtsTKsEjFRG7U1xJN1e//e FUb3PPPE2S2EcA/frAT68MDhqmP2fYfw4XqnSrYm+3pdHKiYomK4waMfJL/lK1BBwlQxMiIWBq/Zd QiHVoh79CaZvhi1WXzymB5AaC+hy7t79HaswschMRktWyCjyo4JDsD/sPhrS1QrfjGnMBmU5O34Pq LGYiDg5BkQZM0/SAMQHlP7zejRGTAHd2LcFncNmKLN0Oan2e3x+vKmWzpifdg/ZI+3+Jnkjf9Fadd 6Lt7l4d+pBdxEengV/8BzhdSSWjUuMnHGkEn/AlWzR2MzDNQ0jl7zSd84Pyrn3fFPzBOKki5Fc0R+ mIlBYn3g==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxWP-00000001ssa-1Ixx; Wed, 19 Jun 2024 15:46:54 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org Subject: [PATCH 5/6] block: remove the discard_alignment flag Date: Wed, 19 Jun 2024 17:45:37 +0200 Message-ID: <20240619154623.450048-6-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 queue_limits.discard_alignment is never read except in the places where it is stacked into another limit. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 10 ---------- drivers/md/dm-cache-target.c | 1 - drivers/md/dm-clone-target.c | 1 - drivers/md/dm-table.c | 1 - include/linux/blkdev.h | 1 - 5 files changed, 14 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index a1b10404e500bc..62588d9a38e39a 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -578,16 +578,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, if (b->discard_granularity) { alignment = queue_limit_discard_alignment(b, start); - if (t->discard_granularity != 0 && - t->discard_alignment != alignment) { - top = t->discard_granularity + t->discard_alignment; - bottom = b->discard_granularity + alignment; - - /* Verify that top and bottom intervals line up */ - if ((max(top, bottom) % min(top, bottom)) != 0) - t->discard_misaligned = 1; - } - t->max_discard_sectors = min_not_zero(t->max_discard_sectors, b->max_discard_sectors); t->max_hw_discard_sectors = min_not_zero(t->max_hw_discard_sectors, diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 16884b5850532f..2d8dd9283ff4cf 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -3403,7 +3403,6 @@ static void set_discard_limits(struct cache *cache, struct queue_limits *limits) limits->max_hw_discard_sectors = origin_limits->max_hw_discard_sectors; limits->discard_granularity = origin_limits->discard_granularity; limits->discard_alignment = origin_limits->discard_alignment; - limits->discard_misaligned = origin_limits->discard_misaligned; } static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c index ad79b52ffc1434..b4384a8b13e360 100644 --- a/drivers/md/dm-clone-target.c +++ b/drivers/md/dm-clone-target.c @@ -2059,7 +2059,6 @@ static void set_discard_limits(struct clone *clone, struct queue_limits *limits) limits->max_hw_discard_sectors = dest_limits->max_hw_discard_sectors; limits->discard_granularity = dest_limits->discard_granularity; limits->discard_alignment = dest_limits->discard_alignment; - limits->discard_misaligned = dest_limits->discard_misaligned; limits->max_discard_segments = dest_limits->max_discard_segments; } diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index df6313c3fe6ba4..502ebc78d490f6 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1808,7 +1808,6 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, limits->max_hw_discard_sectors = 0; limits->discard_granularity = 0; limits->discard_alignment = 0; - limits->discard_misaligned = 0; } if (!dm_table_supports_write_zeroes(t)) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7ad2b1240fc0bf..86410ce41bf60e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -377,7 +377,6 @@ struct queue_limits { unsigned short max_integrity_segments; unsigned short max_discard_segments; - unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; unsigned int max_open_zones; unsigned int max_active_zones; From patchwork Wed Jun 19 15:45:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13704210 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 2E922153BDB; Wed, 19 Jun 2024 15:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812020; cv=none; b=mpN42/b8LCmt/v4TaKFQS2kF+Bv86WG4Ui7oY2Hl5hPJMTmaISGHa/W8yzatplA/DJ11kqaAnQrfSv8YF/BQxR3QCFBVBrnxqaNLupiJQLZT4Kg0ewnUPArEUNiSKRSeJzmtsUUYmK7jnmPYtdO2w0xFnA/Be0QREUim1B+ZTgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718812020; c=relaxed/simple; bh=dzy8FtS5ptyyjEg3F2+R5n491vJchLvqcJqx3tjkXJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nn+r8XD3FnVjOE37HCkDDEYRasxVZ+b3//eSpHlxS1Qt9ZWiaalo/EIIMzLlut/u5Y6ao+ollwOsMuPWziJVLab7hbUMZJ5LSu3HKqQH6I3+Y+xoG20HIh7VdT5AxsgaBc7+DQZRQFYiUKjJk66JkMhEZAHoLoOwcldcHkNvYMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=rM1UjcI4; arc=none smtp.client-ip=198.137.202.133 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="rM1UjcI4" 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=EFmCuyU3FDXod3wDEHBU3uceajQieBgAbma/lzHzBoI=; b=rM1UjcI472M5Qyr+SCi/ILajZy KkHiZBQ+cnq9ftp4IrwDQYAj51jL/7/Cse/o+kIfAAajZhcJO9ASvfVY6IzVl7UBcIC9tar5VNLqq uCrxsHgb3iAvo4v2r3/hrkzwghhdT04M3FJ+rKd0pE7rajavf0s9SRHrfW/3atnL4eXP22PygjED/ +dVHYnpY+zBSTEAz2K5w+rsi67zXjO3DUhbYFKxJtU8T6ZyLB7oaZuoqXehVVVy3OdQXQBczw+Aqf ZosZeIl0hZtNK1mJezMZ7up85kRigTc0nxaPX2BzjVNHBmeKy+mXDliUB+RHYHGT8KeZxmWonH/Ws J3rAi/oA==; Received: from 2a02-8389-2341-5b80-3836-7e72-cede-2f46.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3836:7e72:cede:2f46] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxWU-00000001suU-00Op; Wed, 19 Jun 2024 15:46:58 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-raid@vger.kernel.org Subject: [PATCH 6/6] block: move the raid_partial_stripes_expensive flag into the features field Date: Wed, 19 Jun 2024 17:45:38 +0200 Message-ID: <20240619154623.450048-7-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619154623.450048-1-hch@lst.de> References: <20240619154623.450048-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 Move the raid_partial_stripes_expensive flags into the features field to reclaim a little bit of space. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 4 ---- drivers/md/bcache/super.c | 4 ++-- drivers/md/raid5.c | 2 +- include/linux/blkdev.h | 7 +++++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 62588d9a38e39a..008fed84edb432 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -556,10 +556,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, ret = -1; } - t->raid_partial_stripes_expensive = - max(t->raid_partial_stripes_expensive, - b->raid_partial_stripes_expensive); - /* Find lowest common alignment_offset */ t->alignment_offset = lcm_not_zero(t->alignment_offset, alignment) % max(t->physical_block_size, t->io_min); diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index baa364eedd0051..283b2511c6d21f 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1416,8 +1416,8 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) } if (bdev_io_opt(dc->bdev)) - dc->partial_stripes_expensive = - q->limits.raid_partial_stripes_expensive; + dc->partial_stripes_expensive = q->limits.features & + BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE; ret = bcache_device_init(&dc->disk, block_size, bdev_nr_sectors(dc->bdev) - dc->sb.data_offset, diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e875763d69917d..72f91eaa3201c4 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7707,7 +7707,7 @@ static int raid5_set_limits(struct mddev *mddev) blk_set_stacking_limits(&lim); lim.io_min = mddev->chunk_sectors << 9; lim.io_opt = lim.io_min * (conf->raid_disks - conf->max_degraded); - lim.raid_partial_stripes_expensive = 1; + lim.features |= BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE; lim.discard_granularity = stripe; lim.max_write_zeroes_sectors = 0; mddev_stack_rdev_limits(mddev, &lim, 0); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 86410ce41bf60e..1fa2b148c20696 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -328,6 +328,9 @@ enum { /* bounce all highmem pages */ BLK_FEAT_BOUNCE_HIGH = (1u << 14), + + /* undocumented magic for bcache */ + BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE = (1u << 15), }; /* @@ -335,7 +338,8 @@ enum { */ #define BLK_FEAT_INHERIT_MASK \ (BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA | BLK_FEAT_ROTATIONAL | \ - BLK_FEAT_STABLE_WRITES | BLK_FEAT_ZONED | BLK_FEAT_BOUNCE_HIGH) + BLK_FEAT_STABLE_WRITES | BLK_FEAT_ZONED | BLK_FEAT_BOUNCE_HIGH | \ + BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE) /* internal flags in queue_limits.flags */ enum { @@ -377,7 +381,6 @@ struct queue_limits { unsigned short max_integrity_segments; unsigned short max_discard_segments; - unsigned char raid_partial_stripes_expensive; unsigned int max_open_zones; unsigned int max_active_zones;