Message ID | 20241214031050.1337920-12-mcgrof@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 209DDE7716A for <linux-mm@archiver.kernel.org>; Sat, 14 Dec 2024 03:11:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 690666B0093; Fri, 13 Dec 2024 22:11:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F8D66B009E; Fri, 13 Dec 2024 22:11:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE1DE6B0098; Fri, 13 Dec 2024 22:11:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 32CA56B008C for <linux-mm@kvack.org>; Fri, 13 Dec 2024 22:11:02 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E7B0214166E for <linux-mm@kvack.org>; Sat, 14 Dec 2024 03:11:01 +0000 (UTC) X-FDA: 82892086914.07.A34E8F5 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id 09D1340003 for <linux-mm@kvack.org>; Sat, 14 Dec 2024 03:10:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=rqjr9k1z; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf07.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734145848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QwW6+QbJTlSFLC3FzzKGoyGuJ59VODNiRzXn4st2nlY=; b=CW6hDPvul6EkiGtF2cYCTdG7YkNk3b5YDfEr60J4/cpA4k8KIUDjf+nDWc5W4v3H5Wnwfl cvLmyigF/60ybBUix2I2m4sVKzBJLVwpuixg5I5bowJZRFnXt3iIWi1PeEYUgujAMGi2t3 R9TGlYwSz6Q3wLjhILsOtSlbsF7YRoM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734145848; a=rsa-sha256; cv=none; b=T66tQVp8UYHIqJyH/wGmowo7+iApp6ySb05UuTPF9Z236WMbnTR1a8kz+iOTffS2Ru26kN h4ein6Ktn2g3UuB4alhhviRlmI82iw284yHtr5Y1GIeSZlYh5EepiWbfTBg5IU/cbClM+N SVrjlZlUClsHdWjp81gge4XFKwrpN6k= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=rqjr9k1z; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf07.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=QwW6+QbJTlSFLC3FzzKGoyGuJ59VODNiRzXn4st2nlY=; b=rqjr9k1z6khTpfp/RfwgO2EvnD k52jL8QOpAlYrZREH8RLqgl823+evliu61hP3EYJT2SyxbKDjFF6QIbCTLEXl6zNtz7rtY9ibW1XX 9G53kXlos5RYGUGI0eTPtAixrTTPmMTWq9gMwJOIXzq27iu+8EcpEKpwuV4Y5e5HX8Iu0HoNtW9Hh 3suyN6IBf1BSA7JSl8RBtjp2PWaw+GXqawh3KLsERTN1DmlWP7edWp622G5Pif3PYfCeqLljzTire 7wzDzx+BFmYz7jXqjtZF0ZogUuuKCv57HOKzkkML/yQwXYfR4DRqneo5wBLssOM58W7xyPgGpl+eg 8Qvtpm0A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tMIYO-00000005c3t-0MSX; Sat, 14 Dec 2024 03:10:52 +0000 From: Luis Chamberlain <mcgrof@kernel.org> To: willy@infradead.org, hch@lst.de, hare@suse.de, dave@stgolabs.net, david@fromorbit.com, djwong@kernel.org Cc: john.g.garry@oracle.com, ritesh.list@gmail.com, kbusch@kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com, kernel@pankajraghav.com, mcgrof@kernel.org Subject: [RFC v2 11/11] bdev: use bdev_io_min() for statx block size Date: Fri, 13 Dec 2024 19:10:49 -0800 Message-ID: <20241214031050.1337920-12-mcgrof@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241214031050.1337920-1-mcgrof@kernel.org> References: <20241214031050.1337920-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: 45ub1ibsw8ppzf3gn7r8zxfqt1pawnu5 X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspamd-Queue-Id: 09D1340003 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspam: Yes X-HE-Tag: 1734145826-883460 X-HE-Meta: U2FsdGVkX1/0urwOhep3VLxySccmlzQ/bsDwyaasfFmOBqEb4CddxKS88N27F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4YnqWJCFoAyYQik1/gQ04575XlrFdR3jWgjWdvKGya12pmXtoQE+jAIcOP/qYitKX6qYbWDv5YJGWHNNuUn5jLP7ZlqklNkSxW1WP74qARbT+UZT+jsMyI24kPC2ZULzMLQik5/O1WG639LUP9I9DCMou9LW8ZuGYmd4Omw2Du9+asxB8UAbc/zohbo/e2wQdu+qAp90QU7PjeiFErjCo+Q2GCwlE76206BmTG5K23aD0qf5qpFMcwtIsl5YC5RLe7CB04gbmxqcTDSeS+uCouU6O+qOEoXzFRvcmegJy/JUAyJRthfnDxNKrNZMdlPuw3h/fUlgXWC4kxt1Lln15QFmqlU6YldJpqYhxmRZM0ZSajZsOZs6QlhfWtrwlk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000350, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
enable bs > ps for block devices
|
expand
|
diff --git a/block/bdev.c b/block/bdev.c index b57dc4bff81b..b1be720bd485 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -1277,9 +1277,6 @@ void bdev_statx(struct path *path, struct kstat *stat, struct inode *backing_inode; struct block_device *bdev; - if (!(request_mask & (STATX_DIOALIGN | STATX_WRITE_ATOMIC))) - return; - backing_inode = d_backing_inode(path->dentry); /* @@ -1306,6 +1303,8 @@ void bdev_statx(struct path *path, struct kstat *stat, queue_atomic_write_unit_max_bytes(bd_queue)); } + stat->blksize = bdev_io_min(bdev); + blkdev_put_no_open(bdev); }
You can use lsblk to query for a block device block device block size: lsblk -o MIN-IO /dev/nvme0n1 MIN-IO 4096 The min-io is the minimum IO the block device prefers for optimal performance. In turn we map this to the block device block size. The current block size exposed even for block devices with an LBA format of 16k is 4k. Likewise devices which support 4k LBA format but have a larger Indirection Unit of 16k have an exposed block size of 4k. This incurs read-modify-writes on direct IO against devices with a min-io larger than the page size. To fix this, use the block device min io, which is the minimal optimal IO the device prefers. With this we now get: lsblk -o MIN-IO /dev/nvme0n1 MIN-IO 16384 And so userspace gets the appropriate information it needs for optimal performance. This is verified with blkalgn against mkfs against a device with LBA format of 4k but an NPWG of 16k (min io size) mkfs.xfs -f -b size=16k /dev/nvme3n1 blkalgn -d nvme3n1 --ops Write Block size : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 0 | | 32 -> 63 : 0 | | 64 -> 127 : 0 | | 128 -> 255 : 0 | | 256 -> 511 : 0 | | 512 -> 1023 : 0 | | 1024 -> 2047 : 0 | | 2048 -> 4095 : 0 | | 4096 -> 8191 : 0 | | 8192 -> 16383 : 0 | | 16384 -> 32767 : 66 |****************************************| 32768 -> 65535 : 0 | | 65536 -> 131071 : 0 | | 131072 -> 262143 : 2 |* | Block size: 14 - 66 Block size: 17 - 2 Algn size : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 0 | | 32 -> 63 : 0 | | 64 -> 127 : 0 | | 128 -> 255 : 0 | | 256 -> 511 : 0 | | 512 -> 1023 : 0 | | 1024 -> 2047 : 0 | | 2048 -> 4095 : 0 | | 4096 -> 8191 : 0 | | 8192 -> 16383 : 0 | | 16384 -> 32767 : 66 |****************************************| 32768 -> 65535 : 0 | | 65536 -> 131071 : 0 | | 131072 -> 262143 : 2 |* | Algn size: 14 - 66 Algn size: 17 - 2 Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- block/bdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)