From patchwork Fri May 3 09:53:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13652560 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D6FC4345F for ; Fri, 3 May 2024 09:54:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C010E6B009C; Fri, 3 May 2024 05:54:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAEC46B009E; Fri, 3 May 2024 05:54:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4FF26B009D; Fri, 3 May 2024 05:54:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8488B6B009A for ; Fri, 3 May 2024 05:54:05 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 14FFA80D7B for ; Fri, 3 May 2024 09:54:05 +0000 (UTC) X-FDA: 82076623650.12.14970BD Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf12.hostedemail.com (Postfix) with ESMTP id ED3D94000A for ; Fri, 3 May 2024 09:54:02 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=COdMT1me; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf12.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=1714730043; 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=XApKnwu8LyR2cXMBo5ju4aNtoRm6y1GebN0yQtoha8o=; b=SRpHxaWjXLKJ32QbIZ6wQlmcO3WCboGfgHxAC/tvRTwCe1o7L0LvBadt56Md2WQiGb0+TX WbxeYTuUa+WrCk6pyblALjXf/HThBqRSEYLnYsrEOVQ8G7jYu2QQrdhMUSlMkcjkQhSJUB wkosOY6s0FNjZUjZrbIsOITBvDAAVJ4= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=COdMT1me; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf12.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714730043; a=rsa-sha256; cv=none; b=ep6p7dKEhrlixJE2CAZMdoVBRvaeV9eCMG44LwV63wgfROoKlLYkljtW97nDTpAJZqoYCu yqF5kf8adG4rMC9IhiPPQoq/kNtro2eRk0E+llhJAl8wFi62zas9aeMBlvouUcvE3/DF+K +712okVKmcK+LX5Xthxd97YJjacLOlc= 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=XApKnwu8LyR2cXMBo5ju4aNtoRm6y1GebN0yQtoha8o=; b=COdMT1meCbcmT6rrdAwxF2B9vf /2R9bzfLhkvZgcFbGK1zuFqlRbJMJGtqUaXGb88WnXrn3zgahwe0cJTENiHkIEKctkAiV21i7N+7Q NFYpaN4VjyeXXxpCiLbP6l6hn9C3pT7pNkNuJwGySQDrENWufjUFqZANsNs/MLVE9TNK1P2KCiXdC Ec8ctGi6/95gJOe1uEJyZRu87USr10LvHBVnfnuOQzbOFjr6WqAW/tgSr1VZNxKLxqzauxEpnhFT3 QWgi7TikMC/TR7Q4QV1XDzNTpgWuPgEIc6xqb/+KJwEhjixn5Bq7nBiME5mLd/qU1gPHWVVHJJX6V KciIBaZw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2pc3-0000000Fw3s-21Aa; Fri, 03 May 2024 09:53:55 +0000 From: Luis Chamberlain To: akpm@linux-foundation.org, willy@infradead.org, djwong@kernel.org, brauner@kernel.org, david@fromorbit.com, chandan.babu@oracle.com Cc: hare@suse.de, ritesh.list@gmail.com, john.g.garry@oracle.com, ziy@nvidia.com, 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, kernel@pankajraghav.com, mcgrof@kernel.org Subject: [PATCH v5 09/11] xfs: expose block size in stat Date: Fri, 3 May 2024 02:53:51 -0700 Message-ID: <20240503095353.3798063-10-mcgrof@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503095353.3798063-1-mcgrof@kernel.org> References: <20240503095353.3798063-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Stat-Signature: ems3j3c8f58z97mg5soqatz4m6ehntxx X-Rspam-User: X-Rspamd-Queue-Id: ED3D94000A X-HE-Tag: 1714730042-947179 X-HE-Meta: U2FsdGVkX1+ohHu4sg06k0Tv6kK+gFBLyUzNqe858MA2SDvTRVvLAmNqnZ4wkehg7VbXDupBbj0bA6leTheh3K9t5TVq9hIbEojMsaRncZF8+bOdLyKFQx3Ob+4G46dbJDRbH8d2Qv/QE3G8sr6812PEoLt3D+KuQM2ovBpOVPbHc2w8IJg6a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DIMfaxqeRJPGR3iO7Hj8vgTa8jbbBVNu53aiWVs086a+hKtRNKt4B0fw3fdDt2n5xXOTjJxp2mAL+s54fstUdp6avLvqh9xR0I00dokuogUm9xBuQIaWLwm/B+4bwWdwotFX2/+dLV4sAQJgwR6lEZvlTOYlhtzA7556wuIxgdEss0UDzFLc0AWI7Vd11aueq4yBvT+FYC8mWMatE7VHO4jkdrak8/04sKWrFa2nsNJ74U87hej50h7upZN25tAzDRdq9f4mN1ibQxObA3/30qzNzpByBeLw1LOTzL3rGLNCxE56AEZ1y7S4mRfBsLe1OVPTuKwN6bO2fn2SIXv7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Pankaj Raghav For block size larger than page size, the unit of efficient IO is the block size, not the page size. Leaving stat() to report PAGE_SIZE as the block size causes test programs like fsx to issue illegal ranges for operations that require block size alignment (e.g. fallocate() insert range). Hence update the preferred IO size to reflect the block size in this case. This change is based on a patch originally from Dave Chinner.[1] [1] https://lwn.net/ml/linux-fsdevel/20181107063127.3902-16-david@fromorbit.com/ Signed-off-by: Pankaj Raghav Reviewed-by: Darrick J. Wong Signed-off-by: Luis Chamberlain --- fs/xfs/xfs_iops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 66f8c47642e8..77b198a33aa1 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -543,7 +543,7 @@ xfs_stat_blksize( return 1U << mp->m_allocsize_log; } - return PAGE_SIZE; + return max_t(uint32_t, PAGE_SIZE, mp->m_sb.sb_blocksize); } STATIC int