Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1257814lqg; Sun, 3 Mar 2024 01:51:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXceOvhSvS8KBOqwVTzxsyKJvOR947fCH9zFVTyE3mzVjydfjmWsO7ANE4Q5KgQxB2/bRuZNtlkylevb5AbJgoqOuDH0hfyCdjywg2+qQ== X-Google-Smtp-Source: AGHT+IHrm5HFAZ99cG2/IkgsRV+g36jgHp3QApcKvuns+WkbIRlVjuHo3l1c1E2scZYR6GpnAU02 X-Received: by 2002:a17:906:f2d2:b0:a45:3308:5612 with SMTP id gz18-20020a170906f2d200b00a4533085612mr252393ejb.57.1709459512050; Sun, 03 Mar 2024 01:51:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709459512; cv=pass; d=google.com; s=arc-20160816; b=XdmUDliz7U1XEQKmelpj1pwTFYaKB253dcfzCg9bUxRbG2V2jei/aQOIHn3ubBDIl/ 8my61uzK0RoRyg8wymEkl7roDYyX5CDgeTUOWaP5AZiZ5zGW5hXfFya7v4ThBOypwDC6 QjLmc6SlQy8LZTNy3aFSisEq7i0g4HcQJ9PyawowxLhs/Ur1zAQ+FPgdryX2JTgVpXEM UEhLohz70AEiiR8VnG+axqiymr8W24fBS5lyuO/QLESbTswiO9H0FPvxA+hjU9ZaHWSX GhhhKS5JN7ukaFUiAj28fSfmb5IrB5RD5Ack6j1pmWcHbQyPScTIUtuNb/f/HW0Le+Zs MFag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hTTuIiANd5kCHMpVIcnhOGjU1SgMYOpCUNpWo+aN5OQ=; fh=XNSrRUwVTzpEiSup2LruPjXnnBE4qDGoPoS5h6R7xQ4=; b=mAbFGNd6AwXg5/nXsg/64UH9TGsBtprU9C3BLqKcv/meqpZAVWKWTe6oJPE72ndY2U +LwWQLtDhfGPP9MQJI7d1+X0Sau4L24lrTy4hDST6zy28hGGqFOkcXKd5jg1QNj+RRFN Prtxvte0sqUFn3W0dfIW1s0JN4O/8DXFoj+wjaKQQW1cXC7Ga250PRJIrJknXxicVgmJ Op+zTeE11lim/39P+3n/D8fOmmBYMBRJuWhvERSuyUSVfLEjdP07Q9PcYwYz0+i7+UIU VUC3OkXCMzxqDfgDOhPrsvW5GpIjE2YMJ057yAF5PXgp3vJkD4Xr8j42zsrgxgQnL7Yi bn6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=0NCEvPJd; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-88766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qh22-20020a170906ecb600b00a3e909c9772si2977544ejb.288.2024.03.03.01.51.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 01:51:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=0NCEvPJd; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-88766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8D2F31F2871E for ; Fri, 1 Mar 2024 16:54:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F28A174C1D; Fri, 1 Mar 2024 16:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="0NCEvPJd" Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5AD774C02; Fri, 1 Mar 2024 16:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709311531; cv=none; b=E0ls2pnJUttuENSxR0IfKClPNOzythm8YrNakLDkvnIRyouYyuwPnW7wjbkIqWvvavxYB4AhGMfjKxq70Ai7W5JUCDdpj5YPjIfU4Pu0OOLkg5l58yTprGC/U8xENTlf4Ncl2VAzYsKfRNTKKNpxbxClmqd9+ijla4ajKG2Uncg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709311531; c=relaxed/simple; bh=8h2k716LEkRXj/j4QF0KIKvbMa13OHXZcCU5xl00czw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JaEFrJMuYv0qZjCBagpirGeDaW41aBseMhiKHXZHTA3d3w80voY6mdO2Hoi6Zz1zmDjiZgNAf1flhIq4qr+tI8cEvOvMZ+JmCRkus99q/74TW1jPwmOPEe25biU/gaqEY6gGAfVvUjFYSskQh9odv8OcpifC3s/YMf6ZAmogBYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=0NCEvPJd; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4TmYqV0SbKz9tWG 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 -- 2.43.0