From patchwork Thu Jul 4 11:23:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13723628 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 B331FC30653 for ; Thu, 4 Jul 2024 11:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 461F36B00D6; Thu, 4 Jul 2024 07:24:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40FFE6B00D7; Thu, 4 Jul 2024 07:24:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2633D6B00D8; Thu, 4 Jul 2024 07:24:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 04DBE6B00D6 for ; Thu, 4 Jul 2024 07:24:03 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B6C5FA0DE9 for ; Thu, 4 Jul 2024 11:24:03 +0000 (UTC) X-FDA: 82301835966.15.288FE2A Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf05.hostedemail.com (Postfix) with ESMTP id CE7E8100027 for ; Thu, 4 Jul 2024 11:24:01 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=00kjlnBk; spf=pass (imf05.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720092222; h=from:from: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=1hpvVZhxiYoy4pHnc2n7weXG4jb43hSIPB2EVq7bVws=; b=WEC8sXeyx/6+UA6W5w43MsquqAxm5p4BOmS7Yc1/XO3rv4y3RNzGDgS9Ppn8T9qvQfbtkh stge9TIsm6sVCVx7ziYviLt79kX94kN0pqbR3UBZ5Pl8SuTjHBGsHMzlOqWPcHRLvFDiFs KWCpE9bZc3CghZ7MFxpTaYvOvmMGp7Q= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=00kjlnBk; spf=pass (imf05.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720092222; a=rsa-sha256; cv=none; b=yGbtMMcaBs3soJVeX5RHC/shns4FxzMWdqASjJpwdU8W5tKz4cqPEwje7aIK5tTrjL5dMr eenCwzLRYn1mB6w/lYUlr7g3dKiC5RYADEFw9jYQD63gDPoarG5PgJfZKXXKAILky5ycSh Jyj+A4mY0dsnoWa1edj5A2BUHMZNUVY= Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4WFDmt3YWKz9sTk; Thu, 4 Jul 2024 13:23:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1720092238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1hpvVZhxiYoy4pHnc2n7weXG4jb43hSIPB2EVq7bVws=; b=00kjlnBkN+LFlFpx4Eq52EeamnWssvWwfljypGOm40D8wTb6EFYbFsfO4ZTKtAU+tkUyLD imYXE7KY44rOVP91eM+h1IFMWXnWBKPm71KVJaME2OcNTGJAnYRtVHREDEwyK2/Ozp4AIh HGejFkLqr9Jh3YeQEVFddQ2fM53b/Aakqd7mMAW1yONbIbr3IYBwcBpb7ULEWNivySKijP dBMS+vcw0iEwr6ViD07vvA9/F2AzHkarFSpNnn2fgyWvMFK8N1/T/4AX26a8PJ2RkWRrVG 3q83gwfRzypqiqPaZxRQZga3SmyJr6cl0RP3UEebVQXHww4CBZ/FCZeVp6shLw== From: "Pankaj Raghav (Samsung)" To: david@fromorbit.com, willy@infradead.org, chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org Cc: yang@os.amperecomputing.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, kernel@pankajraghav.com, hch@lst.de, Zi Yan , Dave Chinner Subject: [PATCH v9 08/10] xfs: expose block size in stat Date: Thu, 4 Jul 2024 11:23:18 +0000 Message-ID: <20240704112320.82104-9-kernel@pankajraghav.com> In-Reply-To: <20240704112320.82104-1-kernel@pankajraghav.com> References: <20240704112320.82104-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Stat-Signature: 7kszsxu9odwdh1mrj9ckxnwq7mzcoxm9 X-Rspam-User: X-Rspamd-Queue-Id: CE7E8100027 X-Rspamd-Server: rspam02 X-HE-Tag: 1720092241-305043 X-HE-Meta: U2FsdGVkX19EE+0R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rElMl3lkXH/Y92Oo7HFbgnsHP7jfkcng6WGE1ycs4ekTQfhrOY01p8Ze3UT30dM7l/c4+H7Awz8ibRAVIEh7yFxzj2Cy0q1bb7jtRSVAYwOwSCqhLg/jrRQ5grob5V7yVBrtsQQNmUw4hjaM/9vslpU9KBLM/c11QLT/BrdOMWU+Kkj95hdpMDFo4uvsBI3M/cxYHbS5V+2EA+XI68l26I0CiQxGTzgLqDOvW8BgpHoQB5GtaIleJbznVtor4hgFnpT5zj1T6a6xERCQt7S/T+yyygNgbJJlbl6okNFkpkGwXXdkL3FlQpinEhcDN5ZHO0ndIbSrjtXGwFkhhtROWkwCN71b1ypii2zVgnyK1xog== 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 Signed-off-by: Luis Chamberlain Reviewed-by: Darrick J. Wong Reviewed-by: Dave Chinner --- 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 a00dcbc77e12b..da5c13150315e 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -562,7 +562,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