From patchwork Thu Apr 25 11:37:44 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: 13643187 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 988A4C10F15 for ; Thu, 25 Apr 2024 11:38:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 304886B00A1; Thu, 25 Apr 2024 07:38:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28C666B00A2; Thu, 25 Apr 2024 07:38:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106FF6B00A3; Thu, 25 Apr 2024 07:38:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CEBD86B00A1 for ; Thu, 25 Apr 2024 07:38:36 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B3D86A150A for ; Thu, 25 Apr 2024 11:38:34 +0000 (UTC) X-FDA: 82047856548.14.12072BF Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf23.hostedemail.com (Postfix) with ESMTP id 3FAEE140017 for ; Thu, 25 Apr 2024 11:38:30 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=f7jcKlQP; spf=pass (imf23.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714045110; 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=gIfjpeeNWGR8UToHGDXkOnyh18tKvUHuNUnl0OPj7BI=; b=iTFTxCr5uVJMnMDISjp1UsUK84OHLYH7pZlG4cHHJIVKsFdzb0Y2jYvKtJuDBurpr5jtvz lMObT/wljLZFp9jXHMS9mr1dMuBul/VrpcBe9GLL+xKkxeWam6CVWWMHbw72haz5x6RPtq QNzTEWuDQ0jaruwW2+IHVDKaCn4v9fM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714045110; a=rsa-sha256; cv=none; b=hqhFBWkqtmP1K9YXJUePjZUzUNPBRx25g4IBEYTK7524vuCpEZ8PUVH8EdhLoG7fOJMzkL PnxukixTaCoET/ft9zhDMYquwe0q5QMqGoLiCIHhD/+OVPO08coMBdbKm/dBbPkIsU4pYu eQKxFWTrdbmLQBOcP+9aKow2N4/42i4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=f7jcKlQP; spf=pass (imf23.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (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 4VQDPt54hLz9t5C; Thu, 25 Apr 2024 13:38:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1714045106; 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=gIfjpeeNWGR8UToHGDXkOnyh18tKvUHuNUnl0OPj7BI=; b=f7jcKlQPBfdo5JDYXYUH/c0DKe3CXWPCsikhLprRpyztxc8+iqGjrFBcNznlGqrPUwXRyx YTp848BJW14DQgetVXZGZZkTeXzlZAplKzBtUVlM5VtIGjhRth78SC/bFtY5audPmOVkJT ZnH3F4hsDAVwQJnu3cR+/wI1iEVhY2fq4GhjTek/n+/rmLF4gyj4ASTvHU9Jn2eD71W8Tl UMVSJSMo0ypnXW0grvP6XvCXs78G+Mg7PewCr9m/ZBJRX7pTzCJDU8eAHNf7ZgP41ltNd4 L+QempcsCIUIXA283kl/HsUM7k9QZbYJnfMBWfcPNBW7gXkVAHZI3eypTvhWmw== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, djwong@kernel.org, brauner@kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, hare@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, p.raghav@samsung.com Subject: [PATCH v4 09/11] xfs: expose block size in stat Date: Thu, 25 Apr 2024 13:37:44 +0200 Message-Id: <20240425113746.335530-10-kernel@pankajraghav.com> In-Reply-To: <20240425113746.335530-1-kernel@pankajraghav.com> References: <20240425113746.335530-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3FAEE140017 X-Rspam-User: X-Stat-Signature: sxqk5bzfrm6hap7rmd9bxoxpdbyc8j7a X-HE-Tag: 1714045110-273951 X-HE-Meta: U2FsdGVkX1/nf5WtI1ZuqfYMVgyINz7ow5Wu96WvQvCXBy0HIySPSK9Hz8An/kIWs9Ig4N7KQMC7eUUnjKPDXG8n8IBMoc60y//U01g9wTD22nGEkNb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AccMpksc/MSy4ne/ExP6DbSHIGaf4ESG3bVWWOoZAU4TEfJS1tyX2WMFgmnLVYQ0PAuqaDAeA5vswmkxmsbpSb13vzVn1mz628b+GTnhpKa4CK0xuolDynitTdm4GoLTu8kM68AR7WO8F45Z8SYfY0K1SebNmMKdalG7VWL0wSuz6coEQUFbdbV1b/bAn0s 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 Reviewed-by: Darrick J. Wong --- 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 66f8c47642e8..77b198a33aa1 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