From patchwork Thu Aug 15 09:08:47 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: 13764601 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 76E5CC52D7D for ; Thu, 15 Aug 2024 09:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 009786B00B0; Thu, 15 Aug 2024 05:09:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF7E06B00B2; Thu, 15 Aug 2024 05:09:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D99596B00B3; Thu, 15 Aug 2024 05:09:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B95D86B00B0 for ; Thu, 15 Aug 2024 05:09:46 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8260C411D2 for ; Thu, 15 Aug 2024 09:09:46 +0000 (UTC) X-FDA: 82453907172.24.79AE0C1 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf26.hostedemail.com (Postfix) with ESMTP id D60C3140005 for ; Thu, 15 Aug 2024 09:09:44 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bmHxN5xn; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf26.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723712926; a=rsa-sha256; cv=none; b=34dEEtuRlvTRZq1tpZGAJrAXJmTnhnHiXNLSNjV8aAHNOR/lqZDKgRAcwg3v8R2UYn/Q4V hfaeY2gt0U7oh3wH+vXrKxLwmoGjoL2bR4fUPSEhaz/krrGAiK7ENzqniFEAN9RLSQT2UR 3XnzTMdy//YQxuNcpnI4bDmtqfCr1ZU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bmHxN5xn; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf26.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=1723712926; 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=OFCQeRoYKCpIwc/V7VVfVT8xrzJ1wqzaVy/cCyGH2d4=; b=s2JcU9Qz9SkyZ8hS/yCPUFKzKeAbMqDg8BS/NZafXM+2RHDZOsJGO0oYOHX6PZvkiVy3Ka 3PsVM4T8a1hlcADRUfW/OgDINQjaLeI/DaTl7sDCs/iQaB2XjDoq5xCvj4O1LdbTyK/b34 WNNqNeR3BpVZ+3fxlZBYu+Rq7WZkjEU= Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::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 4WkzpY3KLZz9tHx; Thu, 15 Aug 2024 11:09:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1723712981; 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=OFCQeRoYKCpIwc/V7VVfVT8xrzJ1wqzaVy/cCyGH2d4=; b=bmHxN5xnLg35Iz86PnXix1HzhYebVNPB+WjyRU4E3jgDRG4++HgKyq6jFbdDZJ5G9DcfMx npD2ioepW1fqtg7r0lLJF0fudyKYiqkBvKa7Yi+unwvJD5rwOCuMyvg1L8uZ3JTQAoH+Qx ieLj0l8s6ki0jkk2Z6Elh2HLY8V4hqDrdq8TjaMG9lrguXfSLcL9oYNR6ZdRJX8WF3wI88 W+DTZGv97zZ5dZnVhePG6YoQmnz9SoYBBXNwIJN8Dq7m+kdH+nWX0Udc5RmmPySxtaofTk Bfy5kmT/sVmIsG1933qAxTMREHPS0yGV7y3ON1WyPtNVrAj7y+qto8+oiBTlBg== From: "Pankaj Raghav (Samsung)" To: brauner@kernel.org, akpm@linux-foundation.org Cc: chandan.babu@oracle.com, linux-fsdevel@vger.kernel.org, djwong@kernel.org, hare@suse.de, gost.dev@samsung.com, linux-xfs@vger.kernel.org, kernel@pankajraghav.com, hch@lst.de, david@fromorbit.com, Zi Yan , yang@os.amperecomputing.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, john.g.garry@oracle.com, cl@os.amperecomputing.com, p.raghav@samsung.com, mcgrof@kernel.org, ryan.roberts@arm.com, Dave Chinner Subject: [PATCH v12 08/10] xfs: expose block size in stat Date: Thu, 15 Aug 2024 11:08:47 +0200 Message-ID: <20240815090849.972355-9-kernel@pankajraghav.com> In-Reply-To: <20240815090849.972355-1-kernel@pankajraghav.com> References: <20240815090849.972355-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D60C3140005 X-Stat-Signature: e9kgq7d98d8zbq8azesg15jkt3auxhun X-Rspam-User: X-HE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X1cnWOQExKRiGQPQNGoFUH+NWcgazI5fsXNlNA+Ys2pVLAy+2QMu4ja28Ne9Dt7hjTPJhoWrmz5darG3T1o/0bIFHywJjJz+W50bNpxN0DO5arwWO1mx81jkDRDYBdlbdDxGqh34LWZq1hv+Q/ueShz/MQqBr+L5bV31ZDQ1q+eNWy9zj3cTiEhKe3X9yyaVTa1MU/zmQ8F2Jkj56jzO8DI6m0Of8xB80pSyiKyxJEF/NRvU0LsKqX30fqfmQXztv3VVP1u2EwOalcg0mfntac6IM/PBpRW5b8cArqyJwLhUzzOb+v872m1gTxP968qpqU5n+2CxnhUiA5T9znBqHzD+2os/s3jYH/NFK7W3+dOMJHDW+yMJmJhHE03Mvc5AeY8MHAQsIrX16BZl7zZnyVZmudya+LP6Zzg== 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 a1c4a350a6dbf..2b8dbe8bf1381 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