Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3537381iog; Tue, 21 Jun 2022 00:12:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tMOx0Ld+V4Y1dSYc8WfyKBElAXkoknOmTuHEeQOgjfewwE9oTM+PjfQEAfBbf4YasSNKpP X-Received: by 2002:a17:902:b215:b0:168:da4b:c925 with SMTP id t21-20020a170902b21500b00168da4bc925mr27887838plr.155.1655795578327; Tue, 21 Jun 2022 00:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655795578; cv=none; d=google.com; s=arc-20160816; b=f+bdP5mG0Jf1LyS8uewy7zd3XX1tviJXWkYlKR++WKq7NLMLTJCuaHaludObnGjlBn zqZTuqDtQf5Q6O/cbzdDUhZ/NoO2m5du8pDt3Ml8nK/atvVE7qFxRW8THkjKNQniSeoG IWlaj0OgLart5oKCq95LGyF3F5zsEKUamLy+qs5Xh1p7RbR+wojN8X0pQ6UXx+KDE5HK Nl1jSYw3ByFCrgWhqwnl+6xTKszKa/fp6iwhYuI/XJ/ubFb76TWXRsoiULlIBkAl4YgQ SxSItEuJ4nR4aZ6pynkO0s2tWSsLtPtm6236A2iN+J1DGIOe6WPXHs9xYOCkxMcMxAUQ 9Okw== 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=JI5187A/roVo6JAbOBFXjnebVpVgrehVAoIVRGh0e44=; b=Dk0PXwkO0JWM1rQ1MC+yFl7F03nvhBiZ3KoVhTxcpjB6zvLt5zFS8lEDVuORjin8yk Me3etGsvJtEC/cehz0Flqe7ArKnOvLRuCv8uUgFUxkVnSNIkZm721mM6JpxXQNvejHxc RUEdHsS7ab97WVmRwH0FGTDbY/rhnrfSDSzzH3IPHFqFRGTxSmXuoukqy2mXEBEBx1Gu 9GShw/it8OrtVU1yGv0mn0zpgs3qkmOtG36fvV0W++jdMIfPf5JXHk0kW/P+8v5r2Mbg QZbSc2BBvd5D664UgnrjEISQDVk83EcHQ8T2QODKxx6dfIxY/oTmXk3/rS4Ftn8LQTTN NuaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FrXBiLnB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a635301000000b003fe30cc898bsi14947519pgb.664.2022.06.21.00.12.45; Tue, 21 Jun 2022 00:12:58 -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=@gmail.com header.s=20210112 header.b=FrXBiLnB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346215AbiFUGqg (ORCPT + 99 others); Tue, 21 Jun 2022 02:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346202AbiFUGqe (ORCPT ); Tue, 21 Jun 2022 02:46:34 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6E01C121 for ; Mon, 20 Jun 2022 23:46:33 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id k127so7011962pfd.10 for ; Mon, 20 Jun 2022 23:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JI5187A/roVo6JAbOBFXjnebVpVgrehVAoIVRGh0e44=; b=FrXBiLnBfk7eFPJKW6Gs5IKtpFdUBAPc6uwr6+eSP2SzABCpb7yrfxCn5YRntMh9Kg VfQEb4+xfRce7XuCdKObakYlW9+58/BWhmZEJiaXm/YmvOyhWBCcimbvtzn7ywmmbxBd ILgZg1pgFC/WEKM154UsesXVjDBOfvtpZbfdio7UlTYbrchMMh5+nJEkP1WnsXbsrTC/ SubEcYEBYrTVLvtxUD68hcJeDY7xcvzCZrwng2nBwF2cfzKpyRVACqDaufI3Xd+4v1Ix JepineKyh+NyAmKYnxZjL4TWGK7keAwOypf/JfNGGhy1JYSrbS3g8UbvB0GwONwdFBYM NjgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JI5187A/roVo6JAbOBFXjnebVpVgrehVAoIVRGh0e44=; b=IoqYwiZvmS6kbormw/5PWilSBG1ry9n33qPJuAd94Vmx8ib/mBYk8XM4O+KEw1eK5n D0CWPv9BB+xdwWNwTmfSUItNMoc2gt2c2/1mignJ5oI9yz2DGFuPy6QQM0mtioPTL4uj 0d8VxHAodhKXLtiXUu5c3f+Fui6V/+ockQxVdg66h81ZbNJi12/y1ZOSrsQ4d0YpFUHn wWTF1aHBjxR5cWxnqBBwylcCyAH9V8Rerj3ZROux5DSMNC7W/ZHuyR03773mzA1nDjUn BYp/MKUxcJ7t81BIHBh2rq0ESiFAzvLTdjX0sdy4Fdyxdanh+oZqx5TusBVypK6cNH4G vLpw== X-Gm-Message-State: AJIora9C0EiRlLXFhWrHRoU9plR1IMdcBHcfBrwtCNo1rNR0pV5Ls4iD Iipr8iPlP+DrFk5Ma3DeX+k= X-Received: by 2002:a05:6a00:410a:b0:51e:6fc6:e4da with SMTP id bu10-20020a056a00410a00b0051e6fc6e4damr28721999pfb.84.1655793993060; Mon, 20 Jun 2022 23:46:33 -0700 (PDT) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id d10-20020a170902654a00b0015e8d4eb29csm9709043pln.230.2022.06.20.23.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 23:46:31 -0700 (PDT) From: Chao Liu To: Jaegeuk Kim , Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yue Hu , Wayne Zhang , Chao Liu Subject: [PATCH] f2fs: allow compression of files without blocks Date: Tue, 21 Jun 2022 14:42:02 +0800 Message-Id: <20220621064202.1078536-1-chaoliu719@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 From: Chao Liu Files created by truncate have a size but no blocks, so they can be allowed to enable compression. Signed-off-by: Chao Liu --- fs/f2fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 2d1114b0ceef..daaa0dfd2d2e 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1879,7 +1879,7 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) if (iflags & F2FS_COMPR_FL) { if (!f2fs_may_compress(inode)) return -EINVAL; - if (S_ISREG(inode->i_mode) && inode->i_size) + if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode)) return -EINVAL; set_compress_context(inode); -- 2.36.1