From nobody Sat Nov 30 07:43:57 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 31B1057CB6 for ; Wed, 11 Sep 2024 03:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026228; cv=fail; b=TFUnXlyScGyLTA6x8Lp3e0LYC/7rsROKU1PpSFycLO/VH0UJGslVa6AM1C9GrJuRcfPlvWl4ESskUQVTzyny3h6Lq0X+jQVFG8E37d7PrHyjZEbQPDbh0SGSNJ0m9N1DVvQBKLy+y0DaL51JkGUlXxqzFpGjcgr8TfMT8H1eRq8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026228; c=relaxed/simple; bh=YO5xm9kM+JUxiVSOy2b2HtbKh1mAEMmvzlAM3XbWudE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ecvr2UuueGbgIcbe9ZzEX7/yq4hc87NXjwgNQBNr3/lkNZ8KbmGCWHAIHb/v2Ip6qr7GSMS7bOkP4BBuudU0SEatZ6QgmgzbOdkvqGw9bxODZ3DraB2iP6PSApYUHEEyMgG7OOYSvM/ykliGVc7YvygaxyIEDOXM6M2KZB10mjs= 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=iEJ2EqAI; arc=fail smtp.client-ip=40.107.255.86 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="iEJ2EqAI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aIxkpg+YhJm6uvIQ+QnU8vjzAsnBgTYDMX6d4BXI8NN2RrKU4CY5qZ3JGH4A7u4FDfggS3xdTtJU9BEadgjkpFX0tjfH7/qQQjDFlPctXYMcf5HdeNElcYX/+R1Uvuz4eUhEifbtK1cMHtswZN4FWMIQYNMvyVQJkhWUYhuNkcNAo298YvGBOK+8IUDi9xkvmKE35F9eSEfiem6fHpi/JHlBiTIx/wJQ3PS0eqi9QB4PZY+mYUJ42exCMCB+T+HWu5URlzNS+oXJ//qMs9owzNnjHjA6YRGKrjnhUThwbFYZw3QjWSRIa26SMUBhxFtadr2J+3ew4JHdK2Mc0WwZzA== 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=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=JiyVneVtbne/KCJpYar4AixLMzGeLxLl96PAarDo2JjVNj/qHvXNgd++Zlkf+0JQSxZ4tjXJFy75qlF9nxEYnvvc2voRWlFwySpQ7ulZ5874Oy51MjiGcSzbVkIa93Sk01stVhk/kaFVM+bQ6S+vhQkfrkisegTqPj/MIH2RFUThWSiAeAz+1LdMPC6k7MpY/IBDhppJMhMHcD971r7FsRyouKtoKTPdhTHpJ24RtBqpQDTo21yuUdPCIhAqPijRnORuYKQ+remxdNiscvi5bOya6xcF0O0Ym1WOLvzQswYBapvFo9vJ9d01WDPnBCohoZIWMaenO80Pg+2S0HL6nA== 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=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=iEJ2EqAIe8ROgadflNx2K4Ge2OxaCb1Vuhk9X8BFd1JGW6UetDyPY8pvKpkjwExFAJGPxcEA2zwu+YKwg5fw+8pkBt9sbbOPooI8qkmuX2XYX9+Oy4DZTdv7Gawimb/AyTE5yjEgv6z4wPDUTzDMQljBtzrcBAFmWsbHkbc8w/DC+Isiy9ezqkxrYWm15vB+0WswgGUpU/hjR7KlXn5L0kRk55iDbuK0qvPhqgz1lQyjQGXCfU4bQ3w7lcAsn4Q/+ecgnOhfbnsVx9jyTB6cg53JUQWjl3c4RmU4iRdzOTlsChL5cFTsrNX2NDmDXlxQQy7PqRI+A1q8iCVUeGtC6g== 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 JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:40 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:40 +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 v2 07/13] f2fs: support seek for inline tail Date: Tue, 10 Sep 2024 21:57:20 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) 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_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: e3acec04-7dd7-48a3-0c64-08dcd213ecc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YquSbgijNL6ZGSUMgB1ft10kpSyyhbzQo82voq35V1jENQPX0JYpTpo23Tmz?= =?us-ascii?Q?1J/3B7lUZhPRsPersbBhYMip02FfnQLgUEyX2lQQgz4aQ/n9R2Lfq9P33Th+?= =?us-ascii?Q?tuIFiZ4l7oO8KMRKxSTKuhye+z/OpdeVY5QpS5YbhS9gUhJQIgyic+HG63Rn?= =?us-ascii?Q?eq/3vqsEaFxp8Sj30WqZ1qkGqpdc7JxNRBKxUCIsSuIMMineUIhbAIC0lEMv?= =?us-ascii?Q?4PVd85NFYz8HmelViAFImeu/mykCf1IgGZoSYoSFRKNECG9+0eK40czwp2a4?= =?us-ascii?Q?dNzL3ngmE3fkOjEtqhJZ7cg8Zoq1x57bkuC9j9qDoxUoPBTSmGzQN+Hm0Nym?= =?us-ascii?Q?moQ7DR2To2LQJwZDcohztT7CxKdwvea/xTix7gJOnJeaKBSDMYFCQWH+lKl4?= =?us-ascii?Q?yrSICY02uIUpYlmV/R7LAG2YDQC7XhDxDOZXRMcnEpCAsX+GuU9Wy/cx4N+w?= =?us-ascii?Q?9p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MgGmuvNnKGx66feyH8f?= =?us-ascii?Q?yPu547ecd/JVCYiQnH7TI2U4XQs8m56TQysVlWew2u02pnaHiw=3D=3D?= X-Forefront-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)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?PyE0ylNESw7V3dgni1J8WSSyCv9wBTB+jaDiWVav2hT9YKv+zGAdLTVMFpjG?= =?us-ascii?Q?dpItUgTDW1rUnyS0EVc21/jWwqxDwVzsHYisDA4cqA4Z5l42gXrbh0VR2TNa?= =?us-ascii?Q?hYYHWYCM4ARXCWSE1+fRMp9t2po3bXNAHQPjssQgv/o3ovzs100ThLYJSVBW?= =?us-ascii?Q?f6BCwQ13V332qRUVAfWf/0Zirp2ZHEvu2AiOxvcROlkM/fE5+G10I0E+gP4l?= =?us-ascii?Q?3jOFjASIt567LYDZ1D0qde8QtgdTN+HV7UtnuOvDTYjHt5kGx7co6UxRbC3O?= =?us-ascii?Q?jOkdJzHSYdRwHRKxp73VmZ4XlYQuTBwig2fIaBxQuCaXDaGi7At2IJK48YOS?= =?us-ascii?Q?LHcSwh2DBoUak2z3CvgQWDDehndnBMVHfG5Sq06mpVu8yoqXnPKpSE6w/Xyg?= =?us-ascii?Q?SDa3Zg34Q1kkmQZw63MtR+mNZFFQm+LJx5MS3YYbCxKLSrANgdW77s093pJ3?= =?us-ascii?Q?kvbBlyQLktC+Iql4wdbAhT1sRSrBr8mCnUKoGeePNK2mOzy93Ng+kVgq3Jvu?= =?us-ascii?Q?zaR1liOmcpUFtFcbS83uEVhZ2/JoHetdHxDKhsIBpKYT62lmjTn4Cm2BCt32?= =?us-ascii?Q?jS9Em8PAC9FU1tYxae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=?us-ascii?Q?Z/X/FgQspJlZe2ItHxUMZirj5s9mi0EYSyy8+DOfIw6vwgf/LovmbguqRL7D?= =?us-ascii?Q?9l/cgWSU1gBlfjTGACDHFVLuyWq0OhJn4HztpuOz?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3acec04-7dd7-48a3-0c64-08dcd213ecc5 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:39.9833 (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: pPnfvxbyiQsDKuCHh2ET1gtYeGOGcb7yEZyocXB0suH/DOyWMvKe3x1AAkay+4xsIIWhDYw3NzYbD3mOfgQ9SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Fix to support seek for inline tail files Signed-off-by: Wu Bo --- fs/f2fs/file.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 957d1ff55350..dda4cf6d7325 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -400,6 +400,7 @@ static bool __found_offset(struct address_space *mappin= g, block_t blkaddr =3D f2fs_data_blkaddr(dn); struct inode *inode =3D mapping->host; bool compressed_cluster =3D false; + bool inline_tail =3D false; =20 if (f2fs_compressed_file(inode)) { block_t first_blkaddr =3D data_blkaddr(dn->inode, dn->node_page, @@ -408,6 +409,14 @@ static bool __found_offset(struct address_space *mappi= ng, compressed_cluster =3D first_blkaddr =3D=3D COMPRESS_ADDR; } =20 + if (f2fs_has_inline_tail(inode)) { + loff_t isize =3D i_size_read(inode); + if ((isize >> PAGE_SHIFT =3D=3D index) && + (f2fs_exist_data(inode) || + xa_get_mark(&mapping->i_pages, index, PAGECACHE_TAG_DIRTY))) + inline_tail =3D true; + } + switch (whence) { case SEEK_DATA: if (__is_valid_data_blkaddr(blkaddr)) @@ -417,11 +426,13 @@ static bool __found_offset(struct address_space *mapp= ing, return true; if (compressed_cluster) return true; + if (inline_tail) + return true; break; case SEEK_HOLE: if (compressed_cluster) return false; - if (blkaddr =3D=3D NULL_ADDR) + if (blkaddr =3D=3D NULL_ADDR && !inline_tail) return true; break; } @@ -473,6 +484,8 @@ static loff_t f2fs_seek_block(struct file *file, loff_t= offset, int whence) } =20 end_offset =3D ADDRS_PER_PAGE(dn.node_page, inode); + if (f2fs_has_inline_tail(inode)) + end_offset =3D COMPACT_ADDRS_PER_INODE + 1; =20 /* find data/hole in dnode block */ for (; dn.ofs_in_node < end_offset; @@ -496,6 +509,8 @@ static loff_t f2fs_seek_block(struct file *file, loff_t= offset, int whence) } } f2fs_put_dnode(&dn); + if (f2fs_has_inline_tail(inode) && dn.ofs_in_node =3D=3D end_offset) + goto fail; } =20 if (whence =3D=3D SEEK_DATA) --=20 2.35.3