From patchwork Thu Aug 22 13:50:16 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: 13773529 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 80B87C3DA4A for ; Thu, 22 Aug 2024 13:51:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 142046B00CC; Thu, 22 Aug 2024 09:51:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F0EC6B00D7; Thu, 22 Aug 2024 09:51:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED5318001E; Thu, 22 Aug 2024 09:51:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BDA146B00CC for ; Thu, 22 Aug 2024 09:51:13 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6108C1A16B1 for ; Thu, 22 Aug 2024 13:51:13 +0000 (UTC) X-FDA: 82480018026.17.82FA5CB Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf02.hostedemail.com (Postfix) with ESMTP id B4E4B80008 for ; Thu, 22 Aug 2024 13:51:11 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=QSmqQrxN; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf02.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724334612; a=rsa-sha256; cv=none; b=2c5DPU8peoxF4bDoBUl13rUawbk+0DrnkN+sBwa09aRnMaKIBLtHMGBs3u4iz4/QMTH0ES wTcRjUD0FHD5L93V3pc9xody9FkI+bCxNrcq03xhFVbaNQQehTshQGVsMjssfNNPhHCOgc Y0dLQUEqgjXYyPtbLaVlTn/95+x4R70= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=QSmqQrxN; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf02.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724334612; 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=OFCQeRoYKCpIwc/V7VVfVT8xrzJ1wqzaVy/cCyGH2d4=; b=Zuj7auW99irp322Mk+Cztf1gkirMBg0u+8CbFaqMTTGQ6hRiWZWMUka9vWEgfO3lbRSkq3 BimLNSuzoAXvhXJw4ph0dg6l1Gu+HedazMj6gPiFuEQJudLnEY6ciHy9ZSdWfD8YgbN651 bhjE5NO71miOw8ihzp+56tQ/M/ddFOQ= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (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 4WqPk42jmPz9t4y; Thu, 22 Aug 2024 15:51:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1724334668; 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=OFCQeRoYKCpIwc/V7VVfVT8xrzJ1wqzaVy/cCyGH2d4=; b=QSmqQrxN/St3SlPpugnj/7VLtEgFH1rnm6MAu+uf+ewxUpJh1ieYAOC0IvJLtJMtB95I+E 5YP8PRjKedI61w5GTNc255JZOUFU86S3qu8aTpRUvPPBcdQCpmKjR6xQNo46fbdX9t3e4a As4fA4lrcqRmBTZXiywIKfveS7VCsXBnAnH9v0VMBfSE9vzo5IaXoq9t7YGtb9JMSyXDQa 8WOwwovh4ymZA4ygmCo87eXqRdYvQW9yuZPqAalL2vJa8Hk26WoNS6MJ8Cxq8B+SzFaI9y bt1uOGaxPJKuhni6YRaqdR4eP42qXtReewloa616gce2nIiz59bL++/23JWx/A== From: "Pankaj Raghav (Samsung)" To: brauner@kernel.org, akpm@linux-foundation.org Cc: chandan.babu@oracle.com, linux-fsdevel@vger.kernel.org, djwong@kernel.org, hare@suse.de, gost.dev@samsung.com, linux-xfs@vger.kernel.org, kernel@pankajraghav.com, hch@lst.de, david@fromorbit.com, Zi Yan , yang@os.amperecomputing.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, john.g.garry@oracle.com, cl@os.amperecomputing.com, p.raghav@samsung.com, mcgrof@kernel.org, ryan.roberts@arm.com, Dave Chinner Subject: [PATCH v13 08/10] xfs: expose block size in stat Date: Thu, 22 Aug 2024 15:50:16 +0200 Message-ID: <20240822135018.1931258-9-kernel@pankajraghav.com> In-Reply-To: <20240822135018.1931258-1-kernel@pankajraghav.com> References: <20240822135018.1931258-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B4E4B80008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: r4gf3yoger1j8awna6kqowxgpw694wkr X-HE-Tag: 1724334671-911486 X-HE-Meta: U2FsdGVk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FznCAejkeIJCn+J/6t6di750toWz4KsBlxFyx2pRekL46JdazQyqMBQrT+XpH3yQxzoyQex2ddYjMM330HZsBbMLv/uIvWpEag45fnKzlTd7TRVIsc4V82z8FNeky/YlcANMj0h1bQw4jOoyPpiKShAHtz4/DKLjLAvqD9/B+cNSuWfXQbxQbr+gnYCVESrvcIW3HtFpMi2bFU/kdCEvJ0SIwkEAsRM39rXrKNk7edDqhX/LqVDkaw1BqFJ+HxNMZ5+UpXx4MJ4PSybtOdw3eAWtdDp9jaxMQSZCW3Sl1rGY+qjgM0zS1bMS0rzVduoMyCbKB2qtZ8Xqyj+I3yinDRn8pnNJFzj6RI8t8A05w== 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 Reviewed-by: Dave Chinner --- 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 a1c4a350a6dbf..2b8dbe8bf1381 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -567,7 +567,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