From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 325C8C4167B for ; Wed, 28 Dec 2022 16:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234506AbiL1QLE (ORCPT ); Wed, 28 Dec 2022 11:11:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234570AbiL1QKd (ORCPT ); Wed, 28 Dec 2022 11:10:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE7619C24 for ; Wed, 28 Dec 2022 08:09:06 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id D66A0B81719 for ; Wed, 28 Dec 2022 16:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8C1C433D2; Wed, 28 Dec 2022 16:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672243744; bh=f1yknhdNEv510RONUsHY8Ln7xVDyPd46hqurIzVSIZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgUlNoDrFaar9qFyy8Fo25WgFfnGbndZhebx1UVV/XGJIu6c6er4ICHP9tMATmOnH EF2k779ON1aWtJVFEBBOHKbk2CS2tZy0M8vf9RffOvGrwAB1LfeQzPn1/wvyGkyycV tiMsp/xcAngPawhIo/OC4vGGBJuAfHdotCDqtKYg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.0 0581/1073] f2fs: allow to set compression for inlined file Date: Wed, 28 Dec 2022 15:36:09 +0100 Message-Id: <20221228144343.829594317@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221228144328.162723588@linuxfoundation.org> References: <20221228144328.162723588@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaegeuk Kim [ Upstream commit a995627e6dd81d4485d40ce64880017a080d71e6 ] 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") Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ce4905a073b3..74337edcbbb0 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1866,6 +1866,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)) -- 2.35.1