From patchwork Fri Jun 7 14:59:00 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: 13690335 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 45535C27C53 for ; Fri, 7 Jun 2024 14:59:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DB136B00AE; Fri, 7 Jun 2024 10:59:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 761AA6B00B1; Fri, 7 Jun 2024 10:59:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 566036B00B2; Fri, 7 Jun 2024 10:59:51 -0400 (EDT) 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 33B896B00AE for ; Fri, 7 Jun 2024 10:59:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E15D3A15DB for ; Fri, 7 Jun 2024 14:59:50 +0000 (UTC) X-FDA: 82204402140.21.362CCDC Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf25.hostedemail.com (Postfix) with ESMTP id 40D5BA000A for ; Fri, 7 Jun 2024 14:59:49 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=ipibfMCc; spf=pass (imf25.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=1717772389; 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=Si+AaspsxfVPlRl2lS+XF/iVPhaV4Y/0cfkhGRX9a7A=; b=gubJveZk08hOuDXNj/9KAtxHPVdfdZigI8/ajr+oa69yL+aCBqhAck3NOdTNzjj2bz4BDC GiikYyKFtNKFBfopTwjzGVEGjcchQXYhH3eRqgerW2PWuab0GHbgjMBeV/Q4V3dZcTBYn8 zneZFWUzt4qvzW6ow2S69zoKOf3JBDU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=ipibfMCc; spf=pass (imf25.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717772389; a=rsa-sha256; cv=none; b=iYeByGO79TDd6a5eS1gcff9GNgZ1nNLbY6cfPqMdE+7ntKssxbwhNvDuIN+Km6Hkeuipm2 qVIvEFjsap9IZsR7Qa5Ur6csn0P9//ra/+Gwd3jvz8kW4SCZ7fVjrwyr1U4l7+qc9MGvT/ n2/HzIDY6QMDW4HOkw/z2zoV8eE6YzM= 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 4VwkrK5f8Nz9slT; Fri, 7 Jun 2024 16:59:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1717772385; 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=Si+AaspsxfVPlRl2lS+XF/iVPhaV4Y/0cfkhGRX9a7A=; b=ipibfMCcjAJSHX3K3J8PQnqGVKt9ACztRTpPrEYNtUQOBwkE5tuUBCkJ1NEhEbAIgX22Vr 8ZMBlDyAlLQOlxff6A6gb3CGFCr3npI2926nhh457x12GrYZ+5vuQTGvfBhUCb4MVIJJFP 6vLHCY956wJpI3OyKxVjlkj4YSIjNNCH0fCKRrKsZYyqUMda22pbi2Ze9Q+TliKg51buIE IVZjdpD45TfZGSvWF/o2Gc8Ou37qiBGaO77XkcmPrdVh6uzxEQw7z4Vhmx7g1chNrifJ3B 58zwc4kj6LfNQ1u++f2ihUmK8wbv6GteLXO4JjZayvOkWS/rL6gskNB5XST9xg== From: "Pankaj Raghav (Samsung)" To: david@fromorbit.com, djwong@kernel.org, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, willy@infradead.org Cc: mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, Zi Yan , linux-xfs@vger.kernel.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, kernel@pankajraghav.com, hch@lst.de, gost.dev@samsung.com, cl@os.amperecomputing.com, john.g.garry@oracle.com Subject: [PATCH v7 09/11] xfs: expose block size in stat Date: Fri, 7 Jun 2024 14:59:00 +0000 Message-ID: <20240607145902.1137853-10-kernel@pankajraghav.com> In-Reply-To: <20240607145902.1137853-1-kernel@pankajraghav.com> References: <20240607145902.1137853-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 40D5BA000A X-Stat-Signature: 93h1h3qxon5j17wc5bhqahjtse8gj51q X-HE-Tag: 1717772389-257270 X-HE-Meta: U2FsdGVkX19ucziSnuzcg8+TsNgM5cZuo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YS/cHdb/y1zghrtIsTI0XWFjlF3RMtVM8c+iYVfWFcWP9S9PgBcKefNLp7ZeBt2B97Kb/B6go+idKcGHwOp8EqckD4C0WFrWpdWOORIbtiWZvSQGAVUIaKhSZG+KVozHKFrJHJ1wJggy2b+Eh4HQGrixOLdGJn+xV8uShecA5MIQFSLqTPUHJYC2lOBLiqOOMzq8I8+gOa2B9YP/klo3hisZ7GPM09hQss2diwAdnzR 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/ Reviewed-by: Darrick J. Wong Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- 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 ff222827e550..a7883303dee8 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -560,7 +560,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