From patchwork Fri Sep 15 18:38:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13387482 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 358C4EED61E for ; Fri, 15 Sep 2023 18:40:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B9D36B03D7; Fri, 15 Sep 2023 14:39:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 644276B03D9; Fri, 15 Sep 2023 14:39:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46C796B03DA; Fri, 15 Sep 2023 14:39:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 292486B03D7 for ; Fri, 15 Sep 2023 14:39:56 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EDB04140773 for ; Fri, 15 Sep 2023 18:39:55 +0000 (UTC) X-FDA: 81239695950.28.CCF048E Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf11.hostedemail.com (Postfix) with ESMTP id EB49840012 for ; Fri, 15 Sep 2023 18:39:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=mYMhQTCP; dmarc=none; spf=pass (imf11.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=1694803194; 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=yBandIomLcSEx0nPSvrcvRyAh/l4Pv1QDX49YB+LVO8=; b=vat8eZTDTODTLS5Navt9f04zrUUW7peoW67nyUnQd5dsp91lrB304cLpPSX52wZaJFz3Dp NHNO2+3GHMeAa8eQaZfR928FxVBPuhZJ/y1yst2VRBJp4F9UaVap/e2icxdrDB+fZyG4W3 K2hKOKthzO4z438KId89kVrR7t8D8F0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=mYMhQTCP; dmarc=none; spf=pass (imf11.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=1694803194; a=rsa-sha256; cv=none; b=epAffl4YoqVcRItS3ok6X+z1JyYuZyVj0YvNSreTKCS6C5Zumbj6MDMr20Kvm4Z3aQN9ra /kL0MTBmDLc8LuRtWMKce1ItBRdUMO/IgCe8myD+5w9+Ust3MelmvttC1jFktLiX6u0m8j oAbk0AEprW/wFGEsK248viNJloMvkqQ= 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 ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4RnNK30KtMz9scy; Fri, 15 Sep 2023 20:39:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803191; 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=yBandIomLcSEx0nPSvrcvRyAh/l4Pv1QDX49YB+LVO8=; b=mYMhQTCPSuTWWpI2a7DZoXA2b4Z2aKNhpG6QuCtm6/2AiRPlUnh5ztr81m0prSgYeB5R2N Ubm+xxqIg8F/FN+j3+bmMvc3lFgXMlwoMTJVlrwlxDrqWuSm2qLZyxjNlwSHqn/pZs5Wqv 4Ex7wSgqjRITqAxHX5nWM2terZrh1tp/A7U7RddsO8AguL/6WxFiG+uPzAnJusn8ziCa9d SQjJDxzA7meuf23dlFCDvgDHn4S9+cb3doEld4C/rY7esq1tecmimNp0kyvrO1IowB0WOO pbte7nFfRvCr28HTfjEYrVOMsJlaYLN0vE+DazB0umhH//atGpqlgDbXCGO0mg== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com, Dave Chinner Subject: [RFC 21/23] xfs: expose block size in stat Date: Fri, 15 Sep 2023 20:38:46 +0200 Message-Id: <20230915183848.1018717-22-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: EB49840012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: tndz9swpqwanp7d815ut61orcz8a3n84 X-HE-Tag: 1694803193-961418 X-HE-Meta: U2FsdGVkX1+CTfkNFascncd83cME8B4FtSKQNW5Mv785UeqlO00bu3Q+oWxTCmuJ0PZOIEmttEggJg1HODU56A7p+pFmgzyWDAAEiQW2rGm5RzqLy1Nynta/ehHe1ReXMMlG1X2ZdRasqTbReMLVnF8vDgWjkAMvDxOPtwLq71xW/X4P3E9xoMO8GtekGTQaDUYwbFYJDn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i3wm/A/h+XjVDO5xvL22UV7Q8glS0rcYtJbktL6p4LavPbrKS+xJ1r0mTzrMtUp4IloeZVZFP462/BNkMwB3l2aXJZEA== 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: 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 2ededd3f6b8c..080a79a81c46 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