From patchwork Mon Oct 24 23:36:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 10429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp732736wru; Mon, 24 Oct 2022 17:55:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KWlaGem9v8z0IYlJxUDs5rUraGeMErgMqE7fr0eI9ibnBZFV01JTXBipSqvv1Pgyv4FM4 X-Received: by 2002:a17:907:783:b0:76e:f290:8b5 with SMTP id xd3-20020a170907078300b0076ef29008b5mr30679565ejb.395.1666659332766; Mon, 24 Oct 2022 17:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666659332; cv=none; d=google.com; s=arc-20160816; b=y2mDaCkoXWpBGVzKeeUGHijByg9w6PrfHH3PwASBXQ9CnMohzo9FsP5Y5HrbCLLYkE H2oFtM4r4j5LUPcETtkJ/owCoQAEhr/h0MfOGlhIk1uJSBEyLYfFfJn3K9Ge7BgmgoIo 56FqduQZRXenyqAI5jz8swAZoPwxKSyxL1QcXzh1bIDT6tkcj4M+ZpsB7GS7u2tpt1g6 Hn81zNAtQYQ6FmSTmJRmnj4wGkC6O4KY5vowJSCqAbOFjwxdwWadIn9XLK+q4fjsLYci GPykd2zJHcf1s4lyE0s/ITKpOy7vzscborcwH4bjLxuB0r+e+J75rCXqWuPiVefQ1WQn B9BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5bKrObDZwtU/biK5Z2ervaty4fZpvJ8TS4JvElAK31E=; b=jM1Bi740x17NUaccT6HfyTXx6nuD5RuV4efS4ymNKeJ0BsfgasY2ObeZxLnYXSChMv GLTydMSLOYCxkjRhdwYVdCK5R1HqGWfjXuabUsGl11VK6A31qNKCrxR/K2x+dmCT8aZ5 vCfiWV9vWKLuq1QgThmnEXQEwyWaZa72ar9W1x3fuEiKUOSLa4vrlv54plwvI47ViJ5j R3PjnqA3FDWlAejj4mO2HLTN1aeB8smdxeSdH9Uzx7vZBsrmZ0lSjPjaNJd2MR1yvQYa mpZ7XrWrVoyX3HVHKRKViK43ZB0RsMwyE/1Eu4A5/ws3hu9NDmr5sVMiPszMxNaZiFb+ y4Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzcPBFUw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a170906091100b0073d6c0facdcsi1148411ejd.259.2022.10.24.17.55.09; Mon, 24 Oct 2022 17:55:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzcPBFUw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbiJYAyF (ORCPT + 99 others); Mon, 24 Oct 2022 20:54:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231318AbiJYAxu (ORCPT ); Mon, 24 Oct 2022 20:53:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4176A104504 for ; Mon, 24 Oct 2022 16:36:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D28A061632 for ; Mon, 24 Oct 2022 23:36:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31ACBC433B5; Mon, 24 Oct 2022 23:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666654596; bh=N+eoJ9Y4rEs3YSsl7usF2YxvUJ1yMmWw/73dM3wnX7g=; h=From:To:Cc:Subject:Date:From; b=QzcPBFUwqZHTnmwC4YE/ioV4IVP6l7urzv0ljg/nLA6j3ZgQE1YZyoqYoNfeHUPl6 fk/aL5Pk09G+Pn6LOKQjq3LdKHYpymqTgU3jMTa1u6lXRD+U4FYH5nAdYAmOEml+UP UDcF0QEegpoEW+aoLdETjZsn0zfcNqI8ITdf6Ju4OplJSmrdXOHt3Q8iPHQIk7ayq8 QxunYY73J1hnQXgmeFH1sFl6bTvGwuG1kYWk+Y0rK4FGr47O0L6Y8WUbUMfW7vP6gn Lc+heoSQJJCyveIVo77+zdxx6aU+rojIVzzi/L7xMcAcOTUoSgI2dxqqhlkZCCTian nC9R+i0jPNqSw== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: allow to set compression for inlined file Date: Mon, 24 Oct 2022 16:36:34 -0700 Message-Id: <20221024233634.803695-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747618976766805021?= X-GMAIL-MSGID: =?utf-8?q?1747618976766805021?= The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it. Fixes: 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion") Signed-off-by: Jaegeuk Kim Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 1c4004c9245f..304fe08edc61 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) if (!f2fs_disable_compressed_file(inode)) return -EINVAL; } else { + /* try to convert inline_data to support compression */ + f2fs_convert_inline_inode(inode); + if (!f2fs_may_compress(inode)) return -EINVAL; if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))