From patchwork Tue Feb 13 09:37:10 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: 13554792 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 73111C4829A for ; Tue, 13 Feb 2024 09:38:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01D828D000A; Tue, 13 Feb 2024 04:38:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0E9C8D0001; Tue, 13 Feb 2024 04:38:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB02F8D000A; Tue, 13 Feb 2024 04:38:03 -0500 (EST) 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 C64478D0001 for ; Tue, 13 Feb 2024 04:38:03 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 985861A0156 for ; Tue, 13 Feb 2024 09:38:03 +0000 (UTC) X-FDA: 81786279246.21.37540E1 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf20.hostedemail.com (Postfix) with ESMTP id E8AB91C0002 for ; Tue, 13 Feb 2024 09:38:01 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=LJLR6r+3; dmarc=none; spf=pass (imf20.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707817082; 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=MO0EI8w5WbkUQtm6TaQ0DQo1nNqS6QPeZXjuQJSUGbE=; b=zccjDZM0IA8A5Q+xFCQgnLvkBioFDAdjc4EsBr5D1ST9KH2SSKWGVjZFnWHAIwjcwRpX2r DO58/djauSs9ikCO9MwqV32AEWmZBCa08jSRQZtdrRPn/WtMUbcJPr9NPtIQd0l+R3RQER pX88BzpQpzCTTlCNNarhpkNx9dA8YCc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=LJLR6r+3; dmarc=none; spf=pass (imf20.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707817082; a=rsa-sha256; cv=none; b=ML6P8eH/zLgyNyH+7+ZAkK2rpawW4mskxezZAa9VRcGNabbcKRMxXVISRQC0gSjUERB6k2 VKEl2ZZ5ZiO0mwmhpJ436IIUG4eyE1MqRr+eexVh1MNMKD0Dc2uF1sXLUR0Uv1Yr3KBGS/ NogY0Bv7g+g44ndjci0xv4juekVE+HI= 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 4TYx864DCXz9sp2; Tue, 13 Feb 2024 10:37:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1707817078; 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=MO0EI8w5WbkUQtm6TaQ0DQo1nNqS6QPeZXjuQJSUGbE=; b=LJLR6r+34CoFzdv2J3qP5MfDOQ6MMnj0VOgb57gkDihAt/g5yljWgrPF5I+ZK4MfCqdLSi vBMvmgP3hTSxUlA4ch0+pC0vjX+MdsTWc5PiIjFGjau9gw7S/J33U5ddWn4cjiM6DlMG0W Ur98/ltE05ZvGCzVpgYzQrW3OcQxJZP+oR1H5YbatkY+28PnDdNEeZSZ2gCzVWtzSnF5Q1 YJGWDOj6+sAm2G6B++jG9Yh5Hun13hydNfMq8aFAgAB9nouxcBdVpJXDifnxYLgegAPikF o8MBpLKXTY6q6zwboZzhre51ySyXG0YGTKSCzYXVfa+9HC40mLev/vudl4ahOg== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: mcgrof@kernel.org, gost.dev@samsung.com, akpm@linux-foundation.org, kbusch@kernel.org, djwong@kernel.org, chandan.babu@oracle.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, willy@infradead.org, linux-mm@kvack.org, david@fromorbit.com, Dave Chinner Subject: [RFC v2 11/14] xfs: expose block size in stat Date: Tue, 13 Feb 2024 10:37:10 +0100 Message-ID: <20240213093713.1753368-12-kernel@pankajraghav.com> In-Reply-To: <20240213093713.1753368-1-kernel@pankajraghav.com> References: <20240213093713.1753368-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E8AB91C0002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: xfoapy13fyptseims97pnmwdkdfqiyqx X-HE-Tag: 1707817081-298741 X-HE-Meta: U2FsdGVkX1876hDCv3tQorznHmauKfCqlm2faBpaP//BfUoVZIY2VHGya+JMfHFlOEapBOqS2T10/bkUK7v869Ss3MAMHxGK0cjkgWHbz0Nb+iKroUYF8PhbPtvQtyd0N/33e9JYkMu6vxYT2PrwhbghDDxl8Zn0o+Szf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iF9DqFm1jZFFYfLSLYl39izBOtSY5W6eKudbScsuYDeUdhGoC0Mw/txnurMel2jwyk9QBJbiMlSRgu2j7aOzw33Po/UFYaagfLfbhWLQ1Sbk1kjWLUO6+zvJdQWXbF3S31jg== 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: Dave Chinner 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. Signed-off-by: Dave Chinner [mcgrof: forward rebase in consideration for commit dd2d535e3fb29d ("xfs: cleanup calculating the stat optimal I/O size")] Signed-off-by: Luis Chamberlain --- fs/xfs/xfs_iops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a0d77f5f512e..8791a9d80897 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -515,6 +515,8 @@ xfs_stat_blksize( struct xfs_inode *ip) { struct xfs_mount *mp = ip->i_mount; + unsigned long default_size = max_t(unsigned long, PAGE_SIZE, + mp->m_sb.sb_blocksize); /* * If the file blocks are being allocated from a realtime volume, then @@ -543,7 +545,7 @@ xfs_stat_blksize( return 1U << mp->m_allocsize_log; } - return PAGE_SIZE; + return default_size; } STATIC int