From patchwork Wed Mar 13 17:02:51 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: 13591607 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 316EBC54E66 for ; Wed, 13 Mar 2024 17:03:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B25A08004C; Wed, 13 Mar 2024 13:03:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A87EA940010; Wed, 13 Mar 2024 13:03:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 900F78004C; Wed, 13 Mar 2024 13:03:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 77BA4940010 for ; Wed, 13 Mar 2024 13:03:44 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4D6CBA1180 for ; Wed, 13 Mar 2024 17:03:44 +0000 (UTC) X-FDA: 81892637568.21.255F2C2 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf11.hostedemail.com (Postfix) with ESMTP id 80B6E4001A for ; Wed, 13 Mar 2024 17:03:35 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="mZa/2rNz"; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf11.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 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=1710349416; 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=hTTuIiANd5kCHMpVIcnhOGjU1SgMYOpCUNpWo+aN5OQ=; b=0TjCUDzT8riefGxTkWxd8HWHZ7CmAMMqM3ypJqRFEqwlbzc8/7W5K+cvCiWZn403hyAiD6 HyI5/GQl9qIyPGyfeVpQZT3y9pLGMrRx2lYPwC7osAT2klvTC51bl+6CtvnYH+MEAdPTFb BCuknx0L1QLcrUJDqwpEMFD9Zeze6ns= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="mZa/2rNz"; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf11.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710349416; a=rsa-sha256; cv=none; b=DC3eVUU79ZdKk2gY0elS5OzoIJPF0cEHGca2N4QglaUhJaGDIlR8K0H0wLYYwwbobBxCeF 8FUxGIEP033aHRuTX+BgJCONAIFn/Aazt3e7RqAL9YkOwqm9IU406qAr18QRxGo9l6hn0u SVV74kO2+UbS03Duiynt0BzxydhLIiM= 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-103.mailbox.org (Postfix) with ESMTPS id 4Tvxfr5XYdz9svD; Wed, 13 Mar 2024 18:03:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1710349412; 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=hTTuIiANd5kCHMpVIcnhOGjU1SgMYOpCUNpWo+aN5OQ=; b=mZa/2rNzUk5ItRGjmpFKbIx/e9/B2IW9ObJbSGaxYPcM6/REiNCqEk1WTvXyVIEg1IRLvo diMbHNgV0MF5F7anhDmyOFyn+elkV53QF7ODdqxDx3aNbteQwUgYMBNmP0FX6xERwETv8v J09mtYXdl9rfRkqC58xp6gSWM+i40fSvzFOJP+TdAu3FZq0m5EC1qZoNbnrd7jm1YKBAHd +vribik6eOON1VvDG9qzhVhSqph3+50/mkKuElzubYMNsOZc9lddHkPGrZzxIO+BWa9plt dDJmdXsM+i/9cSpi6ibNvk1ucveXD2OXrIf9fZ21iljyuGKrUV+HA1m+kDNgfQ== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: gost.dev@samsung.com, chandan.babu@oracle.com, hare@suse.de, mcgrof@kernel.org, djwong@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@fromorbit.com, akpm@linux-foundation.org, Pankaj Raghav Subject: [PATCH v3 09/11] xfs: expose block size in stat Date: Wed, 13 Mar 2024 18:02:51 +0100 Message-ID: <20240313170253.2324812-10-kernel@pankajraghav.com> In-Reply-To: <20240313170253.2324812-1-kernel@pankajraghav.com> References: <20240313170253.2324812-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 80B6E4001A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 7eu4ajc6o6kxfr4hrdxsk51t8joac7c4 X-HE-Tag: 1710349415-782677 X-HE-Meta: U2FsdGVkX18mUkUaU6AZnpVF9SiRcikqXMg8MVHND/QM5lv6ahoGkXgEyJ6y26tNeAMNgHcnCbmsLa0S3w/msIjfqrBXm5SaosTy9/MIbFwpRSkdQVuVob/t/nY0i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zHq4lGIuTuGPJu6MCHwaLBnsDzZQZ2humU35SjnAuAIrcHwta9YWzCCucVLDdqm5dYCp7IsMIm6G/QGCo1JZBYcvd42qwn8R/MdJcBK1cX6lyitelNjJnvmxm0Ile68NJcl/lhPk8T3joKCiZu1HWl8ZE1nEw8Gz+UIvmJ0n0HPiOJIwYze2f+ybcLckzNqiQA+L9tNyA1SrH1T6qwNt7TXpeSZAnXbOFmq05UEsRv4K+Hnzofg264xb2aTp6kDJoe0Vu+GAP9O2XLejpAw8P3mTuhLyYfPalOxHM51PTK92Bq41XBeWPxjFdyVhuyACt6wqbxwfBx9GFh4MnBdoYGZXyX5NrS/avv7GBtRjKZA== 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 --- 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 a0d77f5f512e..7ee829f7d708 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -543,7 +543,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