From patchwork Tue Jun 25 11:44: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: 13710927 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 C0EDDC2BBCA for ; Tue, 25 Jun 2024 11:45:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 584F26B02F6; Tue, 25 Jun 2024 07:45:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 534046B02F9; Tue, 25 Jun 2024 07:45:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AD8F6B02FA; Tue, 25 Jun 2024 07:45:03 -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 1A2896B02F6 for ; Tue, 25 Jun 2024 07:45:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C42D71414D1 for ; Tue, 25 Jun 2024 11:45:02 +0000 (UTC) X-FDA: 82269229644.25.E62305C Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf02.hostedemail.com (Postfix) with ESMTP id 289D18001E for ; Tue, 25 Jun 2024 11:45:00 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Fe81Kwt6; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf02.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719315889; a=rsa-sha256; cv=none; b=BlpWf2/+aG6sd/lTC1urlEf+hF2N/8W/VhaTE+KIt/zbcMk1jdrt9Ajc20HXoZR5y57VWE d83WtOCSplEnoVGINMHVjd10XaUp+U411SDI7Dux4Swqa77kQuBXD1czg778VQhZlzAi4E jnFaDWkh/bbZoXD/yupDPMvwUCV7qZg= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Fe81Kwt6; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf02.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 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=1719315889; 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=ZPgRCkuUCpyOtqJkbk+wuiLppcoF4MzwGnJJC5c2ZmU=; b=GQeSvjF67ET8iRCzSB3mOaNE2swP4nLv09XC1M1uPENRePzD6B4XePU1wbkIe7hUDH3my2 YzEaqHDJUPfmFGMpi9/I4quNtx8fNRfovN5LGKI8+G7lQWlCMGEh2nKLT3YdUxb6l7VU0a ahMY0yApN1yZCdLwwLRKiAKklz1vpUI= Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (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-201.mailbox.org (Postfix) with ESMTPS id 4W7jgD5q1Fz9sSN; Tue, 25 Jun 2024 13:44:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1719315896; 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=ZPgRCkuUCpyOtqJkbk+wuiLppcoF4MzwGnJJC5c2ZmU=; b=Fe81Kwt6Af5fMxMJiq/2qofMmiyDbAdqQBxAjJKvZTgpRyA1GbhEOaXfqHeN+MBNMjxyIk h4FOGgYu2BZYLLS87eNULxWmW3qwiNPnurXlZBLkbjPhsMt0YsZlvaWgru2OSdYOxAFyex lEHc7rEpuSRR/h4W23j5fB7kDEMDtDhgNvLabR8JssFB2MO1KcSYQoteqUfygD88+OfXho pim21mKjg8k3xJW1IcKjFWb8ZFw5VGBaqE+MJ+L2BMmocd3CRXhnIm4yIntoxsIagmc+sI IychVXiMupepFH89+MgO+fXxTrjeV74yKU68HTPXmmRgPBJ+20d/2Tfb1enx/A== 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, hch@lst.de, Zi Yan Subject: [PATCH v8 08/10] xfs: expose block size in stat Date: Tue, 25 Jun 2024 11:44:18 +0000 Message-ID: <20240625114420.719014-9-kernel@pankajraghav.com> In-Reply-To: <20240625114420.719014-1-kernel@pankajraghav.com> References: <20240625114420.719014-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 289D18001E X-Stat-Signature: smkuxwhf19rkdhm1pc58bk7p881985sh X-Rspam-User: X-HE-Tag: 1719315900-422398 X-HE-Meta: U2FsdGVkX18cZDpMTn/RY2G3EF0GRu9+17dEo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CKJPaB4EO6qcJYvmQT59hw3sw7F2tTx9BxdmgATIQh75+PZy0aAQlx5l17bLU4wmc3O6PtqJBayV6bkRcEnJMTkjj8xN0DRYROLBYnw47UeVSRwsipuM8ovUiRqYh8pg2N/wHe5Bzd5K6U2r+gPeFGIordVOEuidghDWyOgZPGSuw+hZxfB+8VaVNBMO4FaM1St8SZmjjgk9giHNKWj7/GSgYupAPsR3p+28rPpqJYZo85uvfy1jlF3AlIgL1PFxmO+D1kXbf7fEYNQjafuQG351Nhy4UkuOzdu8Gfs/2zoZhfzRTxG3LpmSMviMS/sBXTgkL3 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/ Reviewed-by: Darrick J. Wong Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav 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 a00dcbc77e12..da5c13150315 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