From patchwork Tue Apr 25 16:47:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13223523 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 11547C6FD18 for ; Tue, 25 Apr 2023 16:47:40 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1prLpK-0003u3-Gq; Tue, 25 Apr 2023 16:47:39 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1prLpI-0003tv-VY for linux-f2fs-devel@lists.sourceforge.net; Tue, 25 Apr 2023 16:47:37 +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=fOEMYFpnUf1+8VTxWdcAC6BmtS5NSP2nCuDrMYfzKiU=; b=amn8Uf4H+HEZUpnBjBun6c8tyI s7tfmi6l720/C2YlCp3RNCJN5y6DLV0dx5ijtSEy1ND68aHqWWBVl/BeZ0jTvebkp6fkgrRQFqQQT fkyh/lTXTywwpAQuky0Nte3IsAj+uMdMAxjv5XoBIDD5hQhri3KVP/JpBBjzpTxMRZ6c=; 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=fOEMYFpnUf1+8VTxWdcAC6BmtS5NSP2nCuDrMYfzKiU=; b=N Np4c3bTk/ANnib4kzFQZIE3PBJo+WekQii6CvLvQGxOd5XZ4nkv8wufBXwdQVWXAaBxwvdK0bV9Ww ++cRVZDHrFynZmnGyyS2t93po6o0u/eJonZ6kxPRwbNDECnY0VuLVYj1oVdiEhhjk4aW2vijF/49O DhtJwnmGMkJx7I4I=; Received: from mail-psaapc01on2118.outbound.protection.outlook.com ([40.107.255.118] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1prLpG-001LBT-Kg for linux-f2fs-devel@lists.sourceforge.net; Tue, 25 Apr 2023 16:47:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWRhC4Xi/gfMttPAoYCpCwIRRtIr8wls16dbrOBCqGJCn/5dX8sWODJffQUAWnUv6s7UKd6Q0dMZeTIdlmyJX76cymDGD5R5BN53ZcyB/ChI7GI0tgjBVPDEnxWl51pnHtn1Wa87+uSyct/0Ob6scZvtz/CZZPfGHwxRWRh8LNaD7XWY6XzPqga2HgOw+VfjhRyLJ2ujGEvmuCo7uzxwhXPXOZ7mQy9oHsiLiuF+EBojAEs+Vw6joH7g9mmo1dYdYrjzg1iQFI6dc+3VobRKwoYQKVMSjm3nArlB5My6jPnERTuoxCtSJyE1br2C3g/sK3gW3jK3cR4mXVWOvgGylQ== 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=fOEMYFpnUf1+8VTxWdcAC6BmtS5NSP2nCuDrMYfzKiU=; b=QClBNZ6Q3XlA719Xwp+UhKObYNQLfpZ81MiB6huBLDfjvLV/QDWXTrzzFAgCRZgndrZc5OQczrMadtNcmGDlnx43Ewlk4atG6GkJpQlP+LpZ+GzOzntJV5Ss8QqYUjCt2HM9xUG9G+I+GKLK7BSccNtkpbcvQKfO+hJJ/PphSdCf0R5WumAs1+/UB6xiPSkVTw34IN4mAIFc/BMyyYFwh3ArQfa4mS15+CAiZ6fryNXMSPUz9iUw+a3uK6H9VoIjKG1pMvUzW8JrWUqI6i5wqkxC1VUb2tNqB+EDS6gKKxsU7QFaNUj6v5ub9Oaih6O594RxJ4NSzMSfTCRsxlLfxQ== 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=fOEMYFpnUf1+8VTxWdcAC6BmtS5NSP2nCuDrMYfzKiU=; b=CcIfinkFJh6M1jrTwhzCuR1H9qn7/cUAkSzho9E2miSih7hwVaj4qGfFDT8XzkFKU6Efy4X8Cv6HG5RvRBRHEKIToKPcvAu6BxkHc1Y+zESHKg/hMN7Y25Sm8i3KkcEtM4mDecXyHBl1NYLdhGi4D0SboyruAo3a2tRdTNSMNBksyU2h6RihLIdUDsv/fNSuH4WRLzrqJLUr+dApoQDxpRSFqDAwPscM2JF1jZM+ednVGF0f3RG2RdnLjnB3VeLUjRGQRRG3Xd+KLwAh6OnSpdhplx4jZ+77klbvb3vjDRP+AaVn8CW+a6FlDVsOQbCJroAcvzr8kIp8pHKw90TSLA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SEZPR06MB5522.apcprd06.prod.outlook.com (2603:1096:101:a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.32; Tue, 25 Apr 2023 16:47:24 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965%7]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 16:47:24 +0000 To: Jaegeuk Kim , Chao Yu , Daeho Jeong Date: Wed, 26 Apr 2023 00:47:11 +0800 Message-Id: <20230425164711.19826-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SG2PR04CA0184.apcprd04.prod.outlook.com (2603:1096:4:14::22) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB5522:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d4a933a-0435-4eb7-d493-08db45acbeee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TLdg9D/6OK4+4QO2jKiucpan2N798vfnF8aJ3ZVq/DvOSidcL6HWnNXqvk4odJpv3yUNHf+FXwZrJ1d+55+wC+hFK3+YPu0I5DGOHy7FXeTMeTeAJYd6yyxhs2pWjLVpOyxUROz8XYfEKE5qt+azGg82nrT7cKFIlZnY55MQM6bZfaVg+LosdSF0gb78NYk+JmZgGcQHPqb3XqPD2avamrt2AqhdZLvBcuwWcsXwcEJICAHcmDSMabam6sDnay5JGflyIvpM5rc6cyCK7i3C/zjgwPYOBki78EXbZn/LcxGoTJlmoLFBIxPzXjqJLBklWe+d4k+W+aIZ6l+DFr+GUKaj+BkGCDJ0TODp23I1HJfPVus3B7JfOe4ChuiVzwzKAYvRbiEKGc8QQEs3eHXgyG18XGNO7Ol34n9YsOrlVaAt/7LcZAMW9kVtbKhi0fgItLz8HhSlWXv4gclBNhwfVgtMEPHDzq/OfJ8lJMheD9XKXaJCAnH0RXxEfPLM7Qz2Z+ywOdyRYrEwEk87sOKVZl+pCWdndF0RNBsCLSZ9hZZGuCobGnYJ7QEz73ospDq4jNkDYBjioSOChhaFH9RwATfJzRicknd+A/7mImsW34g= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199021)(52116002)(4744005)(2906002)(6486002)(83380400001)(86362001)(36756003)(2616005)(8676002)(41300700001)(66946007)(66556008)(66476007)(478600001)(4326008)(6666004)(6512007)(26005)(1076003)(6506007)(186003)(8936002)(38350700002)(38100700002)(316002)(110136005)(5660300002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lFjotm+2Ru7E6UfUrAw++kVH4ZRRiFNbBc/eQ2kiHLvYl74ls1yklMAU/HChRr8B96yAB2uZdWjT8lmxFJLbQfsavXhfPoifL7V9DyPtDlQpWztvXCnCQOFFXoOsqjqqIOlbJI5x0T8zqVBMxZmRrYY441rAzD4IilGklB0Yed/d0pnc9jFQEdaOvmOPzupvFoawXPs6x4gPzX/FZZv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29Wl1BtYmjIZGncZJ+dnCXrbjRHB3oB5Qlf29i8IWdv4Ugu/EZrB92E8ZbtVSaSNnkUcN8eb3AdJhixL9Z8Ene4Dytu0XIXbcR8zd1ykTfiXDqw2nEzl64RDDLTrK70zxxBm7iVjmGBLCROgTcLE9wF99m8jJvm+Pt3KLlm5NzstGoDNoPrl8q/S5wjfraTJVSrFbVvVuKtzt35I1CLt2eJIqvrxHjiyYF90jfru/u8Qai6FgUTMAPWWw80Hkvxgx8wSqxo1bRD54wRQnTkGJUTcJp/jfQTrMaEzaZ5CKhM3InxAdra X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d4a933a-0435-4eb7-d493-08db45acbeee X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 16:47:24.6175 (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: F4UR6Yut3mm83b1nmLujefW8dBERvxQv6bE4JvoiwuJZJU0TleTAHN09uANFfc581X6gKaH8eGQYf+7k36+/CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5522 X-Headers-End: 1prLpG-001LBT-Kg Subject: [f2fs-dev] [PATCH v2] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED 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: Yangtao Li via Linux-f2fs-devel From: Yangtao Li Reply-To: Yangtao Li Cc: linux-f2fs-devel@lists.sourceforge.net, Qi Han , linux-kernel@vger.kernel.org, Yangtao Li Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net If a file has FI_COMPRESS_RELEASED, all writes for it should not be allowed. Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE") Signed-off-by: Qi Han Signed-off-by: Yangtao Li Reviewed-by: Chao Yu Reviewed-by: Chao Yu --- fs/f2fs/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 5ac53d2627d2..46c62923f096 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2593,6 +2593,11 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, inode_lock(inode); + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + inode_unlock(inode); + return -EINVAL; + } + /* if in-place-update policy is enabled, don't waste time here */ set_inode_flag(inode, FI_OPU_WRITE); if (f2fs_should_update_inplace(inode, NULL)) {