From patchwork Mon Jul 15 09:44:55 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: 13733201 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 5B29BC3DA59 for ; Mon, 15 Jul 2024 09:45:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D93486B00A3; Mon, 15 Jul 2024 05:45:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF4166B00A2; Mon, 15 Jul 2024 05:45:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B46236B00A3; Mon, 15 Jul 2024 05:45:50 -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 8AC706B00A1 for ; Mon, 15 Jul 2024 05:45:50 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 445D8161543 for ; Mon, 15 Jul 2024 09:45:50 +0000 (UTC) X-FDA: 82341505260.01.DF5ADBD Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf07.hostedemail.com (Postfix) with ESMTP id 778C340013 for ; Mon, 15 Jul 2024 09:45:48 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=msd62TWL; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf07.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721036706; 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=rKzp8q2egCAH9jCCBjAH7ax9ldrTEZmtAF8pDpPH8l9TNqVRVeM99sSre9nvFbyCzcilPE p6/E4dfspjkm1hTeaiXbOlmoUeAdi6iDFjxrlX/LEDIKO101sIHdUfq7S+YlLlTXmn5QPj fU/JaG8uIDBCtY/JhYPkc5N4RBde6dc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721036706; a=rsa-sha256; cv=none; b=5W0ObzWHs/yWZva1vF3oQuYglxGJjduJVuw3yvUnQaFx/FqVzRnfhIgSyFznBmoXSjBvoz tTlY0bz3lffgtsp9cl6AOHboFsOxLcpikciJa3qY436+YD4Cz72//M79UHB9ypYLCMxyjD R6iZ80y37r/MODUNazk9CR4PqvYmwT8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=msd62TWL; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf07.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-102.mailbox.org (Postfix) with ESMTPS id 4WMy4T0mnhz9sZh; Mon, 15 Jul 2024 11:45:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1721036745; 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=msd62TWLIbtBTLRUrgcXf3EX0hzuGpPV9F+MXYWQ78XHC/Tlf/hHZ52/3glcG1DFe5XDPa OVnhu6hV1GVb3AsPUFx2gkCBHLPdESfZ+a4K/mzJwjrehq1PnKbZokOE5SglsDQFEE50z4 TaPX0ZGrCj5gJaKQebeqz+mGBAB8ftqHOYwX3dX7MA3KjtL/wtEEZYrc5kcHNrIROd+6MC 5My8oLMbTZV1yn94kPyzVBuTbJCKIYohb0PoX6+SXKLD7Dp1nB+9QPvWBvW5sONyhJMqdg zr7Jjxi2G6ZeK7N6QUwxIKbTua4Df+/d+If464wK0BPXQdryKQKXmTuf9dkA4Q== 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: linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, 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, ryan.roberts@arm.com, hch@lst.de, Zi Yan , Dave Chinner Subject: [PATCH v10 08/10] xfs: expose block size in stat Date: Mon, 15 Jul 2024 11:44:55 +0200 Message-ID: <20240715094457.452836-9-kernel@pankajraghav.com> In-Reply-To: <20240715094457.452836-1-kernel@pankajraghav.com> References: <20240715094457.452836-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 778C340013 X-Stat-Signature: pndjoxpaf4639z9mjxj5jy5r7iqawazh X-Rspam-User: X-HE-Tag: 1721036748-130229 X-HE-Meta: U2FsdGVkX1+3W/u7WkhkTy83HSa+Jree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TcS8wG1mF4pFren/g/831YJ2ERAb1y1TkEJc5jRbUKvYULfxAnzc17FtFfJ3eO+6lJLV4cZ9rVTEALpMe5i9vuw7HSyHON7Ggppk2SUUkBd4/nT+z32CJ3aILk+2+bpJpOR2RF9SYy1e5YrABfv5GwXXPZbhbvhEPLZeCli/w60DlHH4BPPJltBU1bra+PTiW6Bnu7guDawcFL/Oqf7bYCD1fcjpXAWe4kqcTDMxc/AfErLFHSWNihU4DEZ3e61mpU6G3hEGYrNBzqxCwz8wLVWyl3b4xwSdJcU9NrASbuavLxnojCuiqwInNe2qEB7t2rA== 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