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 X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIM_INVALID,DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F4EFC4338F for ; Tue, 27 Jul 2021 15:45:27 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD38F61B5F for ; Tue, 27 Jul 2021 15:45:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD38F61B5F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1m8PGn-0008U7-Jd; Tue, 27 Jul 2021 15:45:25 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8PGm-0008To-1Y for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Jul 2021 15:45:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kmplko0SoGr4Md/4wR0T5J7xYk5dwkmFK2pl19ghwnQ=; b=Qz6YxR37+BWhrsr3++ugkEy/Y9 Z565hOVZxXiuSnAUvXHIqX6D3tGpF6NF+NHWEhIXdWuVytgPvxHYvESeftw3aRmrLI8tPV9gHitM9 VmUtDK3Dn9lOzPHZj+NqS37DpGFg5NuRqKlvAete/4UPV7x8STpgKWGddNZ0ahNdgpeo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=kmplko0SoGr4Md/4wR0T5J7xYk5dwkmFK2pl19ghwnQ=; b=S T65M/cR4YU5sDe9Z5w6wmaOSFYvVlcYG087uVuWs5qfeqZvQ988YDN22uMrPBppyp2VbkLwvtBJVG moZrwNsV4CHF1bbA1y5iDBMtPUFFr1O1SfZzoLem615YJiNpfo9PW2sf70Si/68UaHf67kLhTuiMe RJA2vHpn7mwwA+Bs=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1m8PGf-004MqC-Qk for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Jul 2021 15:45:23 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DB3061B4C; Tue, 27 Jul 2021 15:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627400712; bh=d0zv6RtbSmg5wdXW/LCxn3s+mk2wN2t8jhgBEjbtGcc=; h=From:To:Cc:Subject:Date:From; b=QJxTwNcVj9ZRlBCjiVNHXxNaDn3M0D2kEY7aokJXewTZyoBklJZ6JFmkCR4RzDI3O v2jnCsum3jODwmwbqLJru+pT7S832rAF7rDe6nLIMu4eeCG5SWYN1e3lkUcdLaXfZy coFQRCN0R2omxu6T2vbBIwx4icx8ed0PSJP9kvZWzk+0i4c6GP6/gblxVzNTc8pbZn ffsZdya+PbM5zANp4ElGDZmYL5IO4GFUgxLP0ITaUIZqM718MwlQGaIgEB2WdbY0Ll nTLxXsTECQWE2kaOkKXxbTE5600gvXACrhbi3Rw1iNW5wkO5Qt6Mwl/Y+SjkWeuVaI d1cuYQY1MMS7g== From: Chao Yu To: jaegeuk@kernel.org Date: Mon, 26 Jul 2021 09:05:20 +0800 Message-Id: <20210726010520.778237-1-chao@kernel.org> X-Mailer: git-send-email 2.22.1 MIME-Version: 1.0 X-Headers-End: 1m8PGf-004MqC-Qk Subject: [f2fs-dev] [PATCH] f2fs: fix wrong checkpoint_changed value in f2fs_remount() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chao Yu , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net In f2fs_remount(), return value of test_opt() is an unsigned int type variable, however when we compare it to a bool type variable, it cause wrong result, fix it. Fixes: 4354994f097d ("f2fs: checkpoint disabling") Signed-off-by: Chao Yu --- fs/f2fs/super.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 41765e90caa2..18c1ffb8710e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2062,11 +2062,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) bool need_restart_ckpt = false, need_stop_ckpt = false; bool need_restart_flush = false, need_stop_flush = false; bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE); - bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT); + bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT); bool no_io_align = !F2FS_IO_ALIGNED(sbi); bool no_atgc = !test_opt(sbi, ATGC); bool no_compress_cache = !test_opt(sbi, COMPRESS_CACHE); - bool checkpoint_changed; #ifdef CONFIG_QUOTA int i, j; #endif @@ -2111,8 +2110,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) err = parse_options(sb, data, true); if (err) goto restore_opts; - checkpoint_changed = - disable_checkpoint != test_opt(sbi, DISABLE_CHECKPOINT); /* * Previous and new state of filesystem is RO, @@ -2234,7 +2231,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) need_stop_flush = true; } - if (checkpoint_changed) { + if (enable_checkpoint == !!test_opt(sbi, DISABLE_CHECKPOINT)) { if (test_opt(sbi, DISABLE_CHECKPOINT)) { err = f2fs_disable_checkpoint(sbi); if (err) -- 2.22.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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 X-Spam-Level: X-Spam-Status: No, score=-18.4 required=3.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C94C4338F for ; Tue, 27 Jul 2021 15:45:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71D3561B5F for ; Tue, 27 Jul 2021 15:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbhG0PpN (ORCPT ); Tue, 27 Jul 2021 11:45:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:51678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhG0PpM (ORCPT ); Tue, 27 Jul 2021 11:45:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DB3061B4C; Tue, 27 Jul 2021 15:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627400712; bh=d0zv6RtbSmg5wdXW/LCxn3s+mk2wN2t8jhgBEjbtGcc=; h=From:To:Cc:Subject:Date:From; b=QJxTwNcVj9ZRlBCjiVNHXxNaDn3M0D2kEY7aokJXewTZyoBklJZ6JFmkCR4RzDI3O v2jnCsum3jODwmwbqLJru+pT7S832rAF7rDe6nLIMu4eeCG5SWYN1e3lkUcdLaXfZy coFQRCN0R2omxu6T2vbBIwx4icx8ed0PSJP9kvZWzk+0i4c6GP6/gblxVzNTc8pbZn ffsZdya+PbM5zANp4ElGDZmYL5IO4GFUgxLP0ITaUIZqM718MwlQGaIgEB2WdbY0Ll nTLxXsTECQWE2kaOkKXxbTE5600gvXACrhbi3Rw1iNW5wkO5Qt6Mwl/Y+SjkWeuVaI d1cuYQY1MMS7g== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , Chao Yu Subject: [PATCH] f2fs: fix wrong checkpoint_changed value in f2fs_remount() Date: Mon, 26 Jul 2021 09:05:20 +0800 Message-Id: <20210726010520.778237-1-chao@kernel.org> X-Mailer: git-send-email 2.22.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In f2fs_remount(), return value of test_opt() is an unsigned int type variable, however when we compare it to a bool type variable, it cause wrong result, fix it. Fixes: 4354994f097d ("f2fs: checkpoint disabling") Signed-off-by: Chao Yu --- fs/f2fs/super.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 41765e90caa2..18c1ffb8710e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2062,11 +2062,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) bool need_restart_ckpt = false, need_stop_ckpt = false; bool need_restart_flush = false, need_stop_flush = false; bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE); - bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT); + bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT); bool no_io_align = !F2FS_IO_ALIGNED(sbi); bool no_atgc = !test_opt(sbi, ATGC); bool no_compress_cache = !test_opt(sbi, COMPRESS_CACHE); - bool checkpoint_changed; #ifdef CONFIG_QUOTA int i, j; #endif @@ -2111,8 +2110,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) err = parse_options(sb, data, true); if (err) goto restore_opts; - checkpoint_changed = - disable_checkpoint != test_opt(sbi, DISABLE_CHECKPOINT); /* * Previous and new state of filesystem is RO, @@ -2234,7 +2231,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) need_stop_flush = true; } - if (checkpoint_changed) { + if (enable_checkpoint == !!test_opt(sbi, DISABLE_CHECKPOINT)) { if (test_opt(sbi, DISABLE_CHECKPOINT)) { err = f2fs_disable_checkpoint(sbi); if (err) -- 2.22.1