From patchwork Fri Jul 26 11:59:54 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: 13742707 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 80139C3DA7F for ; Fri, 26 Jul 2024 12:00:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FC746B00B5; Fri, 26 Jul 2024 08:00:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ACD46B00B6; Fri, 26 Jul 2024 08:00:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E67F76B00B7; Fri, 26 Jul 2024 08:00:49 -0400 (EDT) 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 C5FB76B00B5 for ; Fri, 26 Jul 2024 08:00:49 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7B18AA17B4 for ; Fri, 26 Jul 2024 12:00:49 +0000 (UTC) X-FDA: 82381762218.08.D257B29 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf08.hostedemail.com (Postfix) with ESMTP id 8FD9C160033 for ; Fri, 26 Jul 2024 12:00:45 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=RpBM3Xd9; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf08.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 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=1721995190; 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=ndnSuxu0rcgI+ZEpYzFfnAXwgKuKHjCIUBMGSEb9FZY=; b=A1E91nSDoKZG8ACHZpxpz3ZVJzUE0Q1JxU9jR1618VGKleyXt+OKZd98+suj6hRmhUsWkD 3+ZXHIaFET422iBw7A0uTbgqNePfa8e1/qOwJ+qxjJ49nl8BFxUutsGWqQESsK/h+brppC B+jcHxvIC4Q3ZkJilGN7vVoDFoERajI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721995190; a=rsa-sha256; cv=none; b=bYAXsMsULcsl3SPOrGs9v0e6D1bw140aAkXyFX3kMb9uvibChopKw4DUgipiFL4HMl02h+ LGX/Qarz9Mc3/hOI+PjBTquTb8vVdkGxo1W5GZAFHy/wz1w6YbYFv1a7OiRKwputIjqqu3 xIJiUuU3wZ+KqQPXAN14k8EM9GsiOm0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=RpBM3Xd9; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf08.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.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-101.mailbox.org (Postfix) with ESMTPS id 4WVmY60pGjz9sbL; Fri, 26 Jul 2024 14:00:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1721995242; 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=ndnSuxu0rcgI+ZEpYzFfnAXwgKuKHjCIUBMGSEb9FZY=; b=RpBM3Xd9hnXdfE7erL4HrWZmKKBLxwOcMTt3SFH3QB1WFE0iLXt34fNrq38jDaAE+2vQo5 8OJ8H4Ko0fAuOd9NV3+1GdbOqIpJtMxhi2RAuhxGYqJ7NUkkn+IfO3o1LAwgNxNNde80SD psMGOYNGXTFTvWZO2Jr66T8q/sbZn6Cua/enZaGy2jn33nyW3o1gfHMYtYG/aV8eU+EWeu B2HAwF7XS6ocx6yL91QlXSF8ciD1u2bLJinHblTkKys02Xd4mPQ4QdDZBoxw9JI3KcymmJ EgTqVEKd/kfA5s/RnC9s0tbezcFFJ3/SlbwPr2hBfVGM6j/BwRHs1Y2I9feqUA== 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, ryan.roberts@arm.com, hch@lst.de, Zi Yan , Dave Chinner Subject: [PATCH v11 08/10] xfs: expose block size in stat Date: Fri, 26 Jul 2024 13:59:54 +0200 Message-ID: <20240726115956.643538-9-kernel@pankajraghav.com> In-Reply-To: <20240726115956.643538-1-kernel@pankajraghav.com> References: <20240726115956.643538-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8FD9C160033 X-Stat-Signature: sax3abeiajitig71kbhf3cajjbui1w3o X-Rspam-User: X-HE-Tag: 1721995245-128772 X-HE-Meta: U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3cIDJnlw3brfLvN03LO2kHCQUKcVzLiDRoCT/mKeKhjVAAyWMZpqKzcfYn6UAr3q51lh1zcJY+U+DeUyMba+p0yql6htOootQqOpvCPzjs7OVn7ZT2LtHig2IIAHo4RTlln3vpKi4PVele93wAMmPFaM2ha9o1YrgbDiDu+CnFxwoKX58HW5UoQ5vuCXlbPgAfFbhcTzjlH4KC4ZBrJpoTZ3/tBM2ar6ICrvmRy/u4/0ax2w17cvPjUl3muvHTK1N9msUAoDDjNbu+2OrJJ2eqTTbe6YfrAofVofjzic869AUh8W8DPIG0/BBBASl1S4vlXaUvax8ZkTQ037PerUxKIUU+Xk 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 1cdc8034f54d9..6483b4c4cf355 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -567,7 +567,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