From patchwork Sun Jun 25 16:06:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunlei He X-Patchwork-Id: 13292010 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64B6FC0015E for ; Sun, 25 Jun 2023 16:07:17 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qDSGf-0004oo-0c; Sun, 25 Jun 2023 16:07:13 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qDSGT-0004o0-9Q for linux-f2fs-devel@lists.sourceforge.net; Sun, 25 Jun 2023 16:07:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wpLEVI6/bI32qr0raUjTydbTK5PnWSM46q9Onm8g7hM=; b=KELCaRmnjBbplHl+UXH+KB648W BKMWx5yFL6zY5x3bGIAKhtthucXlR90way7S9PP70tbv82+FJzr1l3+hKuCgjfcvk1eESi/4o8ScR i5BWoTh1zdCFIp7tDzj3oY8JluGFqdDu3ofR+D/Pnb4R59ju7TooCPaaOm5fhmaeuXd4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=wpLEVI6/bI32qr0raUjTydbTK5PnWSM46q9Onm8g7hM=; b=f T58NSmGKVhHG5lbtPkKTia+jXjhrnbSD9oX3x2bssPUVTVDq4BZRnKHRgwn0YT3qzar9h23Isc2dR KEopUHbC2HaDyuCajteftOxWzWtwT5XPLTnMjFPfoGEMg8FrYw+34lEdYurbfN6ByGnJKWqeW8Azn DOMKp9wE6L4KH2Iw=; Received: from mail-sgaapc01on2077.outbound.protection.outlook.com ([40.107.215.77] helo=APC01-SG2-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qDSGL-0004T4-MT for linux-f2fs-devel@lists.sourceforge.net; Sun, 25 Jun 2023 16:06:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZKa+1LIkkct3zhtELEucrFyJ1ybBNBffugidS6x4MaXFphyyUGUlHU4N0wVgNug0cI0qsbdoTjG5S8KW82TX9qhCVQ/tJYTd5xix7jhSAEqGly+XV2QiDTdv1Jvsf6WNflDc+oV6GLxZGlrqgspQFMbalWmzGD8cXTZLHtNRutPJMuUpfYaBKKcYEQ1QycfJ+BH25WktUjhCMenLOeNmfOsavHwPlRCFHS2cmGqBt2gChkkw3wW0NEsz1t23ergXsoIZro04Tp3q0iVrEzDn+/i84TrlOX9VqJPJuuRXk/6KYtrEjitJPHyotAIwktqDs5O4KztBcAY9KLa39bGTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wpLEVI6/bI32qr0raUjTydbTK5PnWSM46q9Onm8g7hM=; b=cAAAKR6tA0Y4PDhSvYm92OnpwpKhh0Eb22KY+rz3Oi075raowshNmOmMkRlYdH1a1dqT+413fcGFKlHn6IJfCoiIzk5r6loUeD64FqE2isE6YTpob6Ix0rl1NPa6Qm0mArjdb0HS3p8pt8eGI3EESzpT43SHmbj/RTNw9nsW8mXYl7jWf7YxbFynSRjr3bO8Lj5JUlrDusPJ4n5uYMU2wCukVf+IRN9O3Hk2zaBwriZm+eZp7lCtQnMt6xBeM+RFllZo0+dYxuWJw6CzODukMNrx6o3RDZAQvE3CHN2AymsF0NnZeAGK/mQahhsnIGuTL7o17qrTgVlZ8RK6SYkCxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wpLEVI6/bI32qr0raUjTydbTK5PnWSM46q9Onm8g7hM=; b=viFf/3+AjjhOZfSNtV0Nfz3S3kiLhVdwHBbQNWX6zAn6Pru2Xjvyl9RQERwEJqgcqVtF7JOAYQC4OWlGCF8bBqzW+FN34dif8Q/VXeTUrdiGXeyO+Z/IAO0SOY/5KXeBxW6HiVhrhpi72EMN2SM+0Fu7EAXariDAsotkslSEHfQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from PSBPR02MB4471.apcprd02.prod.outlook.com (2603:1096:301:2::12) by TYZPR02MB6524.apcprd02.prod.outlook.com (2603:1096:400:363::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Sun, 25 Jun 2023 16:06:43 +0000 Received: from PSBPR02MB4471.apcprd02.prod.outlook.com ([fe80::8d7f:e42e:6212:882f]) by PSBPR02MB4471.apcprd02.prod.outlook.com ([fe80::8d7f:e42e:6212:882f%4]) with mapi id 15.20.6521.023; Sun, 25 Jun 2023 16:06:43 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Mon, 26 Jun 2023 00:06:26 +0800 Message-Id: <20230625160627.4112651-1-heyunlei@oppo.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: SGAP274CA0006.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::18) To PSBPR02MB4471.apcprd02.prod.outlook.com (2603:1096:301:2::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSBPR02MB4471:EE_|TYZPR02MB6524:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d50e506-7da1-4927-3f49-08db75962ae9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jTcsE+Ehe3EcNCAQ5gwk1MEo2Ewzw4wox6ZByascAsrpF2yfV7U+GNm/1ts0kWNfXfDFp424Wg2vLI8uQmjY2dCUmHj79tQY1qe6rOUprg2QCQY7j2xP/xkFZPIHjkSsOHhXf4Budbb45ur3z6qZnIUHGhnmfw7jbNmA+1IQ0bOQr7NiQkeLFQPc4K3ITnvW6zIZPhVFqXBmfMqnpNdj4qHNZ7Hi9aCwMQvr9vetCElLFvZFmPCUFC7DCUM/u9B4hBNkVFJMu3cgb6s+CaM1p13rmKKWlz7AyNSOxN77xNBFT9Zeybe6bC4hJLo1wThT13ZdXY7t2jXG7jWAoe5DoqRng9jAHncJWL1jze0dCCAQt/OGbRIvJL7H0vfuvJ76Kj2RTGXNTw0nzOmxUugtSr8wPBFY8/IjuNdFDcY476taYFuo2igZI2fLfXfa3AQS7c1/FSrXOntkhv/zbHo8txxG5/hQpzKTFI3ifgf+EjsTpAmaT+A867nX8wamSTwv9gZ28WyzBdiCEU8juYWoysl9wt/ld6qtzk06lKeMkMEi2jPsZqE5sj2oFUoqBRMXCcChZGuQAFqDmb0XHToVNVuO9Mh9BbwI7PihETOEXCxmF37iLcDQl1UZUeK9BKti X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PSBPR02MB4471.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199021)(4744005)(2906002)(4326008)(15650500001)(41300700001)(8936002)(5660300002)(8676002)(316002)(66476007)(66946007)(66556008)(478600001)(6666004)(52116002)(6486002)(107886003)(186003)(6506007)(1076003)(83380400001)(26005)(2616005)(6512007)(36756003)(38100700002)(86362001)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X/S3B9AhWLWGc7XXKOWJIRa2cyIXSGF5vKNePbN8a8w3tahFgxSqrJDcdHf7/IZa31d3eTJGr+/ZMqMZ2fRvpMVYK7VD3qHFf6b1YfYymu6r86zMWsqAR8o95x/pxjWv/98Ifk+1YhSw7dXWKXbEZRlTRjRgeuSsZKMqpSmurGu9otRzLVZUbxfVh6F/mJhAZuBle8tL2JOeXP8E9n+d32Qk6c+99RRRnPFrg/qeHbyYw4zelS/Od9EgzPR2EmSDEk9wDpaALJ14vDEEjy8i3TnwWhSccJJoTMR3/z3iUd9NuH/0rUBlfXQsggjG3fV9POSzm5a9dK2RVnKUmSxVCHOpxPd7dji/toU+QiIqz9lwoKT8Ss7mKzlOC4CpdNs9DuXC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CEsGeOZ9yBIXo+Ph87VcHbpeSly1CJrwGKu5wedYZ/45YgoXyTn1KLfsUSRXj8PJWDmZYaYjtrH4kdIrI8pinYpkWFyolAnZtdTcrZf4rOlahRB+ocRvG09 X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d50e506-7da1-4927-3f49-08db75962ae9 X-MS-Exchange-CrossTenant-AuthSource: PSBPR02MB4471.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 16:06:43.2791 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rSMWmgA4tQzlfoZLDhCdD6553yz/4wve27NXFzDbHNn8hxRef2It4QS7A+9zC+Er2lxbrrqqIN11V/CyQOIEJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR02MB6524 X-Headers-End: 1qDSGL-0004T4-MT Subject: [f2fs-dev] [PATCH 1/2 v2] f2fs: update mtime and ctime in move file range method X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yunlei He via Linux-f2fs-devel From: Yunlei He Reply-To: Yunlei He Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Mtime and ctime stay old value without update after move file range ioctl. This patch add time update. Signed-off-by: Yunlei He Reviewed-by: Chao Yu --- v2: -update both src and dst inode fs/f2fs/file.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index cb42d8464ad9..5af7e57b6140 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2886,6 +2886,17 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, f2fs_up_write(&F2FS_I(dst)->i_gc_rwsem[WRITE]); out_src: f2fs_up_write(&F2FS_I(src)->i_gc_rwsem[WRITE]); + if (ret) + goto out_unlock; + + src->i_mtime = src->i_ctime = current_time(src); + f2fs_mark_inode_dirty_sync(src, false); + if (src != dst) { + dst->i_mtime = dst->i_ctime = current_time(dst); + f2fs_mark_inode_dirty_sync(dst, false); + } + + f2fs_update_time(sbi, REQ_TIME); out_unlock: if (src != dst) inode_unlock(dst); From patchwork Sun Jun 25 16:06:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunlei He X-Patchwork-Id: 13292009 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CABE4EB64DC for ; Sun, 25 Jun 2023 16:07:12 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qDSGZ-0004rX-IK; Sun, 25 Jun 2023 16:07:08 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qDSGU-0004rQ-4o for linux-f2fs-devel@lists.sourceforge.net; Sun, 25 Jun 2023 16:07:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iNBihyaceJnXBqNKlZm3oWM9ToYbC2/QSty5I7E97ZI=; b=QofelY4rpyixj5Dv96oXKmk2oS aW4ZRmBrgrhTGsN8QfJ8X+uiGhmCvyfF+1A8+PglyShS8LK5LLkO7+jUSJKBGOREtGv3V+vRCKjo6 nf0XhUVhMmtBz1LOluLxxVA0GndiD8i3G0nEXyqlQX69tsH9PQDakDhYOACLCHdDiCU4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iNBihyaceJnXBqNKlZm3oWM9ToYbC2/QSty5I7E97ZI=; b=jcTCCyoY6zUlD1dcLky9GIy0tU hXUVeWLc4bRAU/vfxKgEqI2iW8yr+d5PNwf6grVA5hZ+DgR1YUZAmS0tij8JwelVMp0K/kTHvKTDk zsUFHfP2LX7L8xb45+mObluI69pDXpokuk/MQ/hsTZqu/Dx+nqqqUp8G891hTeZi2WAU=; Received: from mail-sgaapc01on2077.outbound.protection.outlook.com ([40.107.215.77] helo=APC01-SG2-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qDSGS-0004T4-UL for linux-f2fs-devel@lists.sourceforge.net; Sun, 25 Jun 2023 16:07:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFKSXBa7NBcweyZgwls7l//EqSO/zk7jlStkrnSDelgrtHTkPFDnFQv19fbFHTOb8M9hq6M3XiWqzWtcjiITqarSUrtiaWoa4H25zTC8mRBzLy7F3HA36TNhzkhUy0hSGOqUFS517ABER32N9Rfau0rY8MSJNXEpGECXgLFCRdrrv06PWY9Iu1BAZ4goIpEB62CNY5L2cl7bjy/388LBuHp7Ne7r3VmUwQcjclzXbWkij9ugQliZvHxOTTX9bq3ICjZp9A+47BPFZj75B55ET0wBlqTInHsLHzuu5bREpL5G20WleuYi6xQrWoomu1RkzXKDq0sdNzsQo/nc1gfCKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=iNBihyaceJnXBqNKlZm3oWM9ToYbC2/QSty5I7E97ZI=; b=KgVivBV88tLX9TeHHTnUI7qjOfPmMoNHEMcrGONAIJuMLAnjCgZf07L2xnAxnIbnrsBe7HSUCWFoJGFk2Ojb5u9I9MJkKBbZgO318JP+M8uaSdaca+25c0qVFRfvGCXOIMf38l6opQM/oD3s91dkshMKK0zIC78phFcjFw8FYImau4LdGv66dI1WdH+cEnY/ji/cZbky4K6ssinH4koDkuC/W0cMOXs0nk0FZJUYFUbGVp2EVhdF5bhHe+IxSuj9mlyIjult45rgVS+x2zaB1zSko6tA6hHT/XZGYFLJm4lyJtU8E1XUvpTS3YzvgL3l1fXGZ2d1NYXm/k3KcRpLuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iNBihyaceJnXBqNKlZm3oWM9ToYbC2/QSty5I7E97ZI=; b=OS3VLcncvy98/OazcyHH+vV1Rma3WPxPISbQ3D9hwBqIoJL1cDKSn4e4hTOeTcn0JkXH9kEr6K8Ku2ESi/w7MJTONECMQDxgEfD6M01pTurRDtI42RteSEKQ3JHBAUjagiBhlkavVLJkB7mdqUtlTI4Y0H01rLbm3AZFBPUT7LA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from PSBPR02MB4471.apcprd02.prod.outlook.com (2603:1096:301:2::12) by TYZPR02MB6524.apcprd02.prod.outlook.com (2603:1096:400:363::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Sun, 25 Jun 2023 16:06:45 +0000 Received: from PSBPR02MB4471.apcprd02.prod.outlook.com ([fe80::8d7f:e42e:6212:882f]) by PSBPR02MB4471.apcprd02.prod.outlook.com ([fe80::8d7f:e42e:6212:882f%4]) with mapi id 15.20.6521.023; Sun, 25 Jun 2023 16:06:45 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Mon, 26 Jun 2023 00:06:27 +0800 Message-Id: <20230625160627.4112651-2-heyunlei@oppo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230625160627.4112651-1-heyunlei@oppo.com> References: <20230625160627.4112651-1-heyunlei@oppo.com> X-ClientProxiedBy: SGAP274CA0006.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::18) To PSBPR02MB4471.apcprd02.prod.outlook.com (2603:1096:301:2::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSBPR02MB4471:EE_|TYZPR02MB6524:EE_ X-MS-Office365-Filtering-Correlation-Id: e886c4b3-6b5e-45aa-3ecc-08db75962bd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jZu26Spd3t3mQaNs9JPNJoaW8o0clAuEgbxVQ4qoLz9E//0CkipzgWLK56bd3MAjxy1b23EG/1k49weBsIXeFXT0iKEOibEx9qsRDvWXLNxS7qrUf4Qd4cbIWvKtid9+gIcJc6QrCZzSotcYTciCEvNQXk8nqzgKmLfq+N09TDCBHLAoi0UqYFzpZtwQeHtnG/EhZZvJG3a0V5Nz1veD/q3SJi+fSZd5fHGNzcMZHQkg5CcOa3z1CTcVc8Y7yVJUfV97G+SK1z4fx1gst9fhPOFmDSszr3McphQ4Wf1zADYNHOxmxfwt8Tybkqz1BgK3xj+iWVQTlNvoaMAQzwcgldjewlZn2mJqHRsaIhOVN3d2J5Ehwq48Zt+QUGaZo2Xkt39mc9PK2TzP2zb8okpNh2lY6I4kMsU8fb3A6H3soKkNtfLeRiLPqpizzvRk6Bm4HA5Ox21D8TAwXNgRs8ODMOaD+CCWsu/wN7Tsr2YAxnFBAt82JMpU4OWfSHv7epBZsmIs0xEuyn92HC+iOuMyPIdvxUVIt/wnb7UqU+fhIarZdZZSEdARe4WxQPUmYrfQB66T4a2DvUZ2BJRYT3yksVwkcw9KG8cwUA7lwIBSEYdH74gJT7GJvNeOOyEOVuAJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PSBPR02MB4471.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199021)(2906002)(4326008)(41300700001)(8936002)(5660300002)(8676002)(316002)(66476007)(66946007)(66556008)(478600001)(6666004)(52116002)(6486002)(107886003)(186003)(6506007)(1076003)(83380400001)(26005)(2616005)(6512007)(36756003)(38100700002)(86362001)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: scQZtEya1H9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ghHnisyZw+c4uwnfElLUVfk5xFaAu4qDzE6KcJk6Gx5cEpomYX9QTCKXx2xHxdTkzO0p6e7hF9vpoFAMlSAI+kI3PQFFgTNrSSkUkV+51aZGd7P6uXUS2XLKZMGjjrwubBhgdV4LbTSpLS6A6YHju66SOddRMPZuP49Yl+j3GiFsRX0jm3q220QBahRZ2FJ366T7h0n7VyTywiX6PyYd0mlT4ShpWy20vEz6p/ZKY/jk8gHk96riWrO+a34aA8m/U3Fygf7oSRbe8Mbzo9EyRpud51W8SUzkjcgX2O0O9XUJ5mAfHUS12DNCoeQyS/drp/p6Z64oexcUtf+F3eUJUexq3HIuhB/Df/AYwIp35I4YPzZdJB2vK+Xf8eEXX4u4457oj4oVoFsNPvhLjqkg7Z7TlbD2UGjOnjdjg6NdpjCUBZ7ZA/m6RX/djFczjsdcpiJ0Twv9HhzEO8Y3bkiW0gmrtFMpEWAwohzzm2VyAMh2Jb X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e886c4b3-6b5e-45aa-3ecc-08db75962bd5 X-MS-Exchange-CrossTenant-AuthSource: PSBPR02MB4471.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 16:06:45.0158 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YfUCXUDZuzWvCZs/bf/qVDyNyy+1NXf+fTq8NCMtUZDILwi2JKSTNuiObxIco2cdkd9X2lWVW8ZKsxRPRtdsFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR02MB6524 X-Headers-End: 1qDSGS-0004T4-UL Subject: [f2fs-dev] [PATCH 2/2 v2] f2fs: truncate pages if move file range success X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yunlei He via Linux-f2fs-devel From: Yunlei He Reply-To: Yunlei He Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net If move file range success, it should remove old data from src and dst page cache. Signed-off-by: Yunlei He --- v2: -truncate pages with filemap invalidate lock -should drop extent cache fs/f2fs/file.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 5af7e57b6140..7b3b333f96f5 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2869,7 +2869,13 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, goto out_src; } + filemap_invalidate_lock_two(src->i_mapping, dst->i_mapping); + truncate_pagecache_range(src, pos_in, pos_in + len - 1); + truncate_pagecache_range(dst, pos_out, pos_out + len - 1); + f2fs_lock_op(sbi); + f2fs_drop_extent_tree(src); + f2fs_drop_extent_tree(dst); ret = __exchange_data_block(src, dst, pos_in >> F2FS_BLKSIZE_BITS, pos_out >> F2FS_BLKSIZE_BITS, len >> F2FS_BLKSIZE_BITS, false); @@ -2881,14 +2887,24 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, f2fs_i_size_write(dst, dst_osize); } f2fs_unlock_op(sbi); + filemap_invalidate_unlock_two(src->i_mapping, dst->i_mapping); if (src != dst) f2fs_up_write(&F2FS_I(dst)->i_gc_rwsem[WRITE]); out_src: f2fs_up_write(&F2FS_I(src)->i_gc_rwsem[WRITE]); + if (ret) goto out_unlock; + /* write out all moved pages, if possible */ + filemap_invalidate_lock_two(src->i_mapping, dst->i_mapping); + filemap_write_and_wait_range(dst->i_mapping, + pos_out, pos_out + len); + truncate_pagecache_range(dst, pos_out, pos_out + len - 1); + truncate_pagecache_range(src, pos_in, pos_in + len - 1); + filemap_invalidate_unlock_two(src->i_mapping, dst->i_mapping); + src->i_mtime = src->i_ctime = current_time(src); f2fs_mark_inode_dirty_sync(src, false); if (src != dst) {