From nobody Fri Nov 29 08:43:59 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2046.outbound.protection.outlook.com [40.107.255.46]) (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 AD19B10A3E for ; Mon, 23 Sep 2024 06:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727072523; cv=fail; b=HJqrl53oSDcrvb+BMKW12UqdciH6LmAvXtdN+KkJZiQ57+kcCqv2Yd7zAy1jCxatRdy5RMiDSbsa2XjkuY+v+SWhXc8OU07PY9T0wAaiqbWsQhE7x88ziiCqQTU43MmxR0QA8Kz+Age6uZ7xNu51B9D0H5udL80GRrSwVuJttKg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727072523; c=relaxed/simple; bh=07i1Y94hA/V3brUMBr6vBwNMw1MJuk6NGAYLNFbhkQg=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=YmM9NYJexljwCxzSfGb0k1j82PdLPNb7jtEfrIFEpl4GP8fOoN1ZxZFd933KAm673+i1CoGk9nRrOmRVVgM+7+WKAwmqnxh/rB/ve7sb3VYkv0QNwuVyEGmMaFnQOxKVKmJAVgb/fjOdiLGcPsXz5gh121UQpK2MjfPFIYXr7nk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=JwiuYy+2; arc=fail smtp.client-ip=40.107.255.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="JwiuYy+2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t1oV1Q6QycdNMC+qA1poWxsI0//lcb2XOpIHeXfzxoVdt4zhH3I5xBcFmHzXq40JROjjvasV1DE/XJOa42VPMxakD7Saqj9p56LXxVzUJ7f73yUKbG5kqTBYmismGbhWu1kVABVWmFhQ1m+EKuuHgtAZ5TnSwNHHr7TJXG1+P5InjQLgVOAH5V7w2EJdWrzOBsG3qnO61R+/91hwNGltgLmAWqTdRNDlHdR7QjBsIoD8ALmYnYwCaEMGpZUmICTshGaZtzXFPEg6c+TRvyt5d3h4fjO9m283I+WxhcCIWX4Nm0gN/bnIJu34TeRW/Zfkun26qe/IOm6Fwycq6hTq9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N8i4d5da9yORPmkip5timpzrA2WyEM4mn5EMx6DjBug=; b=qFFmrYAQ1PRKa/lFLRKahdYOqYZpSaTgoI/0+DfewInfJlO8rUY25DgW7TgayPFuY4huo410Rm9yc50q9od7p8AiJDkPSnNfU/AynTe2QdIk5UoADEdxVG1xH3md9rfzV854CwutJT+81GUoW8n8OZY7GLI0anvLqBbugIqWN7iJBPuHKbSMurls4E99FmRSbqHdI/490mlfRw4iZp4pdNYRlX6duYaSOhM52B7a16alOwBD0KLMlTy8YC5XoXFGdCxb7eTS67reztsWsq3+T2KeL637mUIf0RLhvMqQqSeqUbcBwNYTEVjll8CRQmp7P6ZnSI5Zt1nRPi+RYmKoWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N8i4d5da9yORPmkip5timpzrA2WyEM4mn5EMx6DjBug=; b=JwiuYy+2ksHuZGhGeBuCXfBh8gNCTxASlZSag6PgaBk2VbcEzcXoFwxa4Zz0IS9FFLH6jFxFWYYkagxmbu2DoPauD7N8r3s7NJBmRx+3QPN5bqimiCXE60duFv0qdAwyyFav+Bmr+VUbDiKNr+aThMRnWdz7cSM1quPoPq+HklSA4jno4mZY8YoXvS60Qj5lMqcMmQNFY1yRXLhHSF+5Pe/dzFB9p033LxlWzSKphBwCZWzFnVuQ4zy+pNyS3oB2Lu9iK4cvxfQ5152SBndeLm0hiUJZqWFLTm7F3ylttEAM2xNOjwyXJfKSKQqGaAWHrdhYMqDpmAP26SpPx4z/Tw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by KL1PR06MB6273.apcprd06.prod.outlook.com (2603:1096:820:ec::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Mon, 23 Sep 2024 06:21:56 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7982.022; Mon, 23 Sep 2024 06:21:56 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported Date: Mon, 23 Sep 2024 00:37:32 -0600 Message-Id: <20240923063732.2730521-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG2PR01CA0179.apcprd01.prod.exchangelabs.com (2603:1096:4:28::35) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR06MB6273:EE_ X-MS-Office365-Filtering-Correlation-Id: 37f6ef91-d6ab-496b-d0ae-08dcdb9805bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?XjM8xb6WfSpjqSGJGNO5xtAywNEC6YDeK+U3aLXWfpFPH51CHaYybVnw624B?= =?us-ascii?Q?pq2SqopJ+3K/0ix+4+tSxSR4TCFtu/txvgFJMRUaeWFUnAYBLOofyCXXIN55?= =?us-ascii?Q?UMSsdn8cHju7dLffMKvVYVjp+o+Y+9LVxINq1segol7ehKL0FWpBYWeBtDiy?= =?us-ascii?Q?VVoI6ibqXALXhtXe9Qv0y5t/OePjBoOumDG2G/8yXwfxtt8JyKJGbJYeYVSm?= =?us-ascii?Q?awvxr6UIyYQ5zPC+YuPtpzmJ/yIeCkWzbglLjnT5HLN2NKt6UsJDMqQ38HMg?= =?us-ascii?Q?j1YI+f+d7mCsOm4RVMNmvSgBFGQ8xMl4GRgGJhxE3pir3ex20I+1AYCsSW6c?= =?us-ascii?Q?y/hNPDpqMxNfnPgKs/EGjo3DlhKdGkaiWUUBIkAwGEsM2tvvTnVE7Tk7GCly?= =?us-ascii?Q?ork2eLspj1wPm1ztvM6+YzT4k6eYoJ2tPNEpClW6ll7axrpcxsklDxTKcI2W?= =?us-ascii?Q?LijliMd2IL2nWy91yYsGN4YY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ront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?i7yL8/+yyp8/vaixGEw/rFADmhJKbgskRFeNH9WTreHSrcxuValRRSi8TyJR?= =?us-ascii?Q?s+AoxdjU+nySduH8JqpLvP2qE6Uzd1ar1ZEmC4sRgowBTsDouR7XPE3YsKx7?= =?us-ascii?Q?bqxdGsbSX0G7tmQbY5IFdODodecXoPN4jwDUegjal++Z/8UEKef2aoNBulFA?= =?us-ascii?Q?3Oet56Q9if2zf6cVVOy0e0DKPnm1xGttUpvL3F69e5Sw6wIXcU5Zzjqou/ck?= =?us-ascii?Q?Rrcup+IYVto8HXcS2WILPbMTk7wm3JnZo/szewlBADC5jHfO0z7toePq2ZcB?= =?us-ascii?Q?hEbahbC1fzzpJhibj6y07TP6tB0HH2frFRAqvlfPJ8o52cNurU9vQ+vFCcyo?= =?us-ascii?Q?kfhyJG8xifPEL1jvgA86Rlsw/g6RA7cnZY8dfVhZfSZQK9Y76BEt16BBMydL?= =?us-ascii?Q?YK6l/botA8pRcdlBk5hhZb5/9kUztDz0T5/oQCDJ2dNPno77ktuLR/ZaymRU?= =?us-ascii?Q?+LYBWx7QXW1CAUJNUJZUlmPeKQXuYQbXcb/+XBG9kQXEBDAHGKPdx3n3X/Qj?= =?us-ascii?Q?LwYCxo58toJ5Rvi7X6MdU9I1iD4R3mw143+1EAfFJGBgRlg4Nc/8wVyjQOEC?= =?us-ascii?Q?efIE89+bdr8Ly9t8UAjOZ2lFIVLYP3gYTMDKmnBP76o8OkERHdS59jnF11e/?= =?us-ascii?Q?t4LUypUhc5x1j3pXTr012cgyFLo89mzIQusTBRVW+7V6y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qQNs8m+Mgd3Ae+NNu7M2/yzeNAJVkEo?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37f6ef91-d6ab-496b-d0ae-08dcdb9805bc X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2024 06:21:56.0695 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pWFMALCb7guTiFUkInIniPar17634EufSGZ0TTA5C31QsDoYB56fsGr/NAk4a9DiYYCk7vLGBk1VhdVjnM9cHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6273 Content-Type: text/plain; charset="utf-8" According to the definition of statx.stx_mask: It simply informs the caller which values are supported by the kernel and filesystem via the statx.stx_mask field. (quote from the "Linux Programmer's Manual"). Therefore, if the filesystem does not support DIO, it should not set the STATX_DIOALIGN flag. Signed-off-by: Wu Bo --- fs/f2fs/file.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 168f08507004..bbb66be0deba 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -908,14 +908,13 @@ int f2fs_getattr(struct mnt_idmap *idmap, const struc= t path *path, * f2fs sometimes supports DIO reads but not DIO writes. STATX_DIOALIGN * cannot represent that, so in that case we report no DIO support. */ - if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) { + if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode) && + !f2fs_force_buffered_io(inode, WRITE)) { unsigned int bsize =3D i_blocksize(inode); =20 stat->result_mask |=3D STATX_DIOALIGN; - if (!f2fs_force_buffered_io(inode, WRITE)) { - stat->dio_mem_align =3D bsize; - stat->dio_offset_align =3D bsize; - } + stat->dio_mem_align =3D bsize; + stat->dio_offset_align =3D bsize; } =20 flags =3D fi->i_flags; --=20 2.25.1