Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp85023imn; Wed, 3 Aug 2022 20:50:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hUZ73zVrLvSmAYhuV0zRke1M0WErK8AXXs8TTRhWcnhfAmg3nS+pPyh5DkqcOCCGSp/TZ X-Received: by 2002:a63:464b:0:b0:419:78b4:dcf1 with SMTP id v11-20020a63464b000000b0041978b4dcf1mr21231pgk.500.1659585006242; Wed, 03 Aug 2022 20:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659585006; cv=none; d=google.com; s=arc-20160816; b=IKqicDjz0FpTQfqTIIknEnXj+g6vU3chjN20z3+O+kM35NeWLl4lb4jJF4PTSzN+Bm FYU5Y/edh0ZzfpL89MbVuZdAaDnw34S7gGeBEpNBS2GjYoA3K07IsRz3VzxSN6qPVwpN oG6TfRaMVKo/9TPJ6Q95cYp+nvbuod6JOO19fz0xvJ71fXPgLT4tfkiYO3ZIrQeCnqWH 1071NxPcYabm8Ac71Zv4oXlX+B5HTSP1Z5FsAmkOURhW6cYEBBswpIXFBI6X1G4tVtlC AS93JVhR0KcJk0Icx3akuA+corJRsXdoRgQBCGbbBQWtxtk7uIddBQwBp1de1RO5EjBT EEIg== 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=GiOyjfSp2HgfNLOy7osefeeSYulrbMZc2/kJxjQ4/N4=; b=FWGWJqbCmWbqTvrp1fQVU6+BBkD5w80OY+P0sT1/qwIKO++a6ShgLmRwWSNIcfBv75 ZbJdHPHgJyTCjHkL6QuAqptxJCoiq8Q6zMnR7JiomVVQhropC5x0fV/Unc42+swcLYag tTWlX8imABAZRr6TLQT9jzRAcwl5laTFqCUEk2+/Rq8ISF/VwiBMxHGUSk2RbhoC/eh8 hbM6wOsUXPNdbzGrzNb9aT8HIPMP3LtBwNBbJBZXxs6R3yTmYd9sgtVC2q6D/9vjHBNG bbvzKq0GPu3vWaNUbeJ7fiv6xO4AaiJQWP0GYGxttbkjF6vnNMaWEcF423w/nM9jmq2O j51Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZiqwPPMw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i69-20020a638748000000b0041ca4aef3d4si34120pge.44.2022.08.03.20.49.50; Wed, 03 Aug 2022 20:50:06 -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=ZiqwPPMw; 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 S238433AbiHDDmy (ORCPT + 99 others); Wed, 3 Aug 2022 23:42:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237833AbiHDDlx (ORCPT ); Wed, 3 Aug 2022 23:41:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B3E05F9B9 for ; Wed, 3 Aug 2022 20:41:51 -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 A8CCE617F7 for ; Thu, 4 Aug 2022 03:41:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FFBEC433D6; Thu, 4 Aug 2022 03:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659584510; bh=S8s5z1x3ID9OVqTTN45HZoXxESI7Zk4SGH+wg8AEPjA=; h=From:To:Cc:Subject:Date:From; b=ZiqwPPMwnfQ7aY1aeRE5SKLlWmnmo9H9WVkOuDp50PiPuD1JQ03kf44hA8pdYGTZH MRebCDpy2rwtSrz3LhwzUaLRRNRB1lnd8TS3A8BrnNGzZjYHyYlxgXED4Fmfcy0ddI ywR3AXGw+BdB19oS5DKZksVKiWqP14WSx8uvy7B//HU+oebmTeOH/z/hpXfQnYeC/5 HAd+lbFIVuJFiN0wHgzJKM3rL6UvVRSL9FZy8oIy/ZwoBsmk21zDoNFcBMfpQarSLM QdGngn9ibV5HW7Vs4b5wHYT0OZVsSywK6EODUFlkUkDyZCiV+hrv1g6jKR5s2h9A3U 5/0v41w5XxVMw== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: do not set compression bit if kernel doesn't support Date: Wed, 3 Aug 2022 20:41:46 -0700 Message-Id: <20220804034146.3357114-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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 If kernel doesn't have CONFIG_F2FS_FS_COMPRESSION, a file having FS_COMPR_FL via ioctl(FS_IOC_SETFLAGS) is unaccessible due to f2fs_is_compress_backend_ready(). Let's avoid it. Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 7 ++++++- fs/f2fs/file.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 4e274c91360b..2f3c4eef89c2 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4295,8 +4295,9 @@ static inline void f2fs_update_extent_tree_range_compressed(struct inode *inode, unsigned int c_len) { } #endif -static inline void set_compress_context(struct inode *inode) +static inline int set_compress_context(struct inode *inode) { +#ifdef CONFIG_F2FS_FS_COMPRESSION struct f2fs_sb_info *sbi = F2FS_I_SB(inode); F2FS_I(inode)->i_compress_algorithm = @@ -4319,6 +4320,10 @@ static inline void set_compress_context(struct inode *inode) stat_inc_compr_inode(inode); inc_compr_inode_stat(inode); f2fs_mark_inode_dirty_sync(inode, true); + return 0; +#else + return -EOPNOTSUPP; +#endif } static inline bool f2fs_disable_compressed_file(struct inode *inode) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index d2159d6880d6..67e5a6cd25e8 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1878,8 +1878,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) return -EINVAL; if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode)) return -EINVAL; - - set_compress_context(inode); + if (set_compress_context(inode)) + return -EOPNOTSUPP; } } -- 2.37.1.455.g008518b4e5-goog