Message ID | 20221024233634.803695-1-jaegeuk@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;pwkd43@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <linux-kernel@vger.kernel.org>; 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 <jaegeuk@kernel.org> To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim <jaegeuk@kernel.org> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
f2fs: allow to set compression for inlined file
|
|
Commit Message
Jaegeuk Kim
Oct. 24, 2022, 11:36 p.m. UTC
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 <jaegeuk@kernel.org>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 2022/10/25 7:36, Jaegeuk Kim wrote: > 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 <jaegeuk@kernel.org> > --- > 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); It needs to check return value of f2fs_convert_inline_inode()? Thanks, > + > if (!f2fs_may_compress(inode)) > return -EINVAL; > if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
On 10/25, Chao Yu wrote: > On 2022/10/25 7:36, Jaegeuk Kim wrote: > > 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 <jaegeuk@kernel.org> > > --- > > 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); > > It needs to check return value of f2fs_convert_inline_inode()? I intended to catch that in the below checks? > > Thanks, > > > + > > if (!f2fs_may_compress(inode)) > > return -EINVAL; > > if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
On 2022/10/26 1:46, Jaegeuk Kim wrote: > On 10/25, Chao Yu wrote: >> On 2022/10/25 7:36, Jaegeuk Kim wrote: >>> 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 <jaegeuk@kernel.org> >>> --- >>> 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); >> >> It needs to check return value of f2fs_convert_inline_inode()? > > I intended to catch that in the below checks? But it may hide the real error number, e.g. -ENOMEM returned from f2fs_convert_inline_inode()? Thanks, > >> >> Thanks, >> >>> + >>> if (!f2fs_may_compress(inode)) >>> return -EINVAL; >>> if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
On 10/26, Chao Yu wrote: > On 2022/10/26 1:46, Jaegeuk Kim wrote: > > On 10/25, Chao Yu wrote: > > > On 2022/10/25 7:36, Jaegeuk Kim wrote: > > > > 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 <jaegeuk@kernel.org> > > > > --- > > > > 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); > > > > > > It needs to check return value of f2fs_convert_inline_inode()? > > > > I intended to catch that in the below checks? > > But it may hide the real error number, e.g. -ENOMEM returned from > f2fs_convert_inline_inode()? Fair enough. Let me send v2. > > Thanks, > > > > > > > > > Thanks, > > > > > > > + > > > > if (!f2fs_may_compress(inode)) > > > > return -EINVAL; > > > > if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
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 <jaegeuk@kernel.org>
---
Change log from v1:
- add returning an error
fs/f2fs/file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1c4004c9245f..8cd52b0965b1 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1915,6 +1915,10 @@ 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 */
+ int err = f2fs_convert_inline_inode(inode);
+ if (err)
+ return err;
if (!f2fs_may_compress(inode))
return -EINVAL;
if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
On 2022/10/27 1:06, Jaegeuk Kim wrote: > 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 <jaegeuk@kernel.org> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
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))