Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4927646rdb; Fri, 15 Sep 2023 17:42:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAor1iyJLXtgvtylgnzbvIAzI/OqOZOAMVoSX0TgqcNvtTzj1KAV1QRJmrsBtmw64xg1/r X-Received: by 2002:a05:6a00:139e:b0:68f:b5a1:12bf with SMTP id t30-20020a056a00139e00b0068fb5a112bfmr3640825pfg.29.1694824947122; Fri, 15 Sep 2023 17:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694824947; cv=none; d=google.com; s=arc-20160816; b=K8jEkiInYy+ePwNThDSz5DsEUVHv/fG++iWgGpZNgQn+gLB2njhxQzQSvztahCCYRF WRpJ4Vs2p5BaRxl3X2Spmy28Q5UY92BF2+rVPsXk/Nfga5DdOK/F678gNQgkgXw1ZrQp MwUp5m0qplJ7TqOthgNO2C3GtKiKe/qAW4OV1OqpE4aT8ajQyU31tVUzPGnK/9EbQrtJ 6LHMv98KqiC6bCCQsNLT1WFP4eJEX8TRmQMmwJAq7oldASYUwaHth3ypvqbbTykzLeJe 50WIzQyyAf4vGzoB1pHCbuSkA6kdRTV6OKMwmHa5a0TuAIAtXvF6haZ5qxMLscs7t6E8 XIhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBandIomLcSEx0nPSvrcvRyAh/l4Pv1QDX49YB+LVO8=; fh=A31nGeIz890HlrBNJDNcjeVI5JTqXcrT7QG9RajOen8=; b=Qa5k+JFQX/2p8O2jQJA9U4FhbyZ3Di1A0qS81d1+a5MIVPWzhwKMakp0s8jiWzMbCe PdhmS40LJH6+INM5QPd0h+Z1U7OMKh7FLz16BbGeTR5cjfHQoSItuVJ+0/TpMXg7WfY0 SSq4TMV6ete2WcvseDCIx/6vOfvPvKgmnfT3J685X+AsO8QzlYNrTlRHb5fBhZUEtgNF C120F+8lvL8lfSluOGgSnKIoEIg4+E0p+6TnFzJNrOsf15RLJGDOuniMsIuw1qkcNOZK IImveyx0VNa8l9NCdBaEMi9DnVDaII354uuGf7YHUu5j0Mn6XuI8IHL5aLtrSQYxoiMB 3LAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=mYMhQTCP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ay7-20020a056a00300700b00689f19485ddsi4174603pfb.202.2023.09.15.17.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 17:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=mYMhQTCP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E5D95802D414; Fri, 15 Sep 2023 11:42:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236694AbjIOSmC (ORCPT + 99 others); Fri, 15 Sep 2023 14:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236864AbjIOSlq (ORCPT ); Fri, 15 Sep 2023 14:41:46 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050:0:465::102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926A64232; Fri, 15 Sep 2023 11:40:19 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:42:30 -0700 (PDT) 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 -- 2.40.1