From patchwork Fri Mar 1 16:44:42 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: 13578749 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 E4BDFC5478C for ; Fri, 1 Mar 2024 16:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77F9A94000A; Fri, 1 Mar 2024 11:45:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 71147940007; Fri, 1 Mar 2024 11:45:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5815694000A; Fri, 1 Mar 2024 11:45:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4475E940007 for ; Fri, 1 Mar 2024 11:45:31 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1A4AFA1CF1 for ; Fri, 1 Mar 2024 16:45:31 +0000 (UTC) X-FDA: 81849046062.29.21FDC90 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf25.hostedemail.com (Postfix) with ESMTP id 4D7BBA0006 for ; Fri, 1 Mar 2024 16:45:29 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=0NCEvPJd; spf=pass (imf25.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@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=1709311529; 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=06gyFpvSvxwjK6nm8V7lCCm4n5U3TfGPZtgMerxc/Vnb33UxKFI47worv1XHtHjJrRD7KG Y3XATe3G7wrG5vXwmA30XIQLxyKERJAoPTf6YQW3RGILeHyx89PQloevKe9qbqSK9qnpfa Buh79oGA/KJPeTgMGvMQlfFXnYVUbTM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709311529; a=rsa-sha256; cv=none; b=vgN/NNRKUUBCuK0neRB/l60zCAmCANT+tGm+HhMAnM7Y1VUR6ap+ecKgwnGsMRct1PXyxM e/lpO4M4rs719lnz2tHpmp8LNJ1N9YkqR3QHNvvZfiA5KKr7/ZgXT1q++OocylAZh8ZzWr TI4fo5hYUwDUHwPvLyoS69aNpaRXfDo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=0NCEvPJd; spf=pass (imf25.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::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-202.mailbox.org (Postfix) with ESMTPS id 4TmYqV0SbKz9tWG; Fri, 1 Mar 2024 17:45:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1709311526; 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=0NCEvPJdd4ZEm/pZAZuCWy9XIlnUOtlWaauKypZe9P5F5ntCE+g/+PjzImbecph0YYvig/ ERtH1tJPJuP+IrQy6srtTTxprCqpcpCGn12/P3rnfM+5AeV85UHGbuOkGW2gU1OVRKk0TS AaNkqKsh2FVbzE6I+1mHAdaQ0qoI6iY503orVDqX4dRohCWWfIns0Us+KJjTPSDrK9a3ds QItylujWub7PPZL3dHm41Z62PDEAIDyDdhyAJ7dFh83D7M1CeEJ3ubndtJYyVGAIPZnljT wEGdXx5kF3MyLmOY8wEKjccltT0TtyWGBJSpVeCtz1Aif3/oRTY6yUVQr+1oaQ== From: "Pankaj Raghav (Samsung)" To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Cc: djwong@kernel.org, mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, david@fromorbit.com, akpm@linux-foundation.org, gost.dev@samsung.com, linux-kernel@vger.kernel.org, chandan.babu@oracle.com, willy@infradead.org, Pankaj Raghav Subject: [PATCH v2 11/13] xfs: expose block size in stat Date: Fri, 1 Mar 2024 17:44:42 +0100 Message-ID: <20240301164444.3799288-12-kernel@pankajraghav.com> In-Reply-To: <20240301164444.3799288-1-kernel@pankajraghav.com> References: <20240301164444.3799288-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4D7BBA0006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: nxo8etoud8mnnx6siu4mfrx3fmc4xpap X-HE-Tag: 1709311529-990237 X-HE-Meta: U2FsdGVkX1/ujI0I42r7xbVVazxda6isQjzVk9b2SyBlEV4oV7RdViNA5KDbvljHKQiC/T/l1oeQx8gt7h5SfcGpm1ejpTP6RaTgmH80H3x14v1ebIuuflU6zzaww4pF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bmVS2vtCpx0z6ynQgYU6a1alh9zEU5OpRWFmudOA4nFL/1anKSB2MYVEHDmGcocZF02BEQ03O8UWtbe5OfkmXosOit2U2FRA7NJspWpm1AFJErDvDGXkqBWyu31FalprXKYuMUZBy5VCObYg7QPKmw/Z6eRmhp/sSjXa55jJQqw1oWzdcX2nEvEFHptUo7oUj4LgWARm8wsDWIZBjVKSgXS5RB7FG/hMbOCf3UrgMZ/hIdOjMzjOTLVYCpGS8z3Dk1HXm191DK/SnwQQqY3eXT8e843X0GQPngePAceAPEeoF5hz6J/afs9amXrSD00aRKNUGJ+dTft61uIWWNiwNA== 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