From patchwork Mon Dec 12 13:36:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 32400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2246680wrr; Mon, 12 Dec 2022 05:38:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5nsMHnLlxAxpkd+BYsfAWNaLNFDxsLWUPLuWzjtQR+jwc/h9rfppgPj+KWvVpf2l82MKHy X-Received: by 2002:a17:906:cc55:b0:7c1:6981:d062 with SMTP id mm21-20020a170906cc5500b007c16981d062mr4733772ejb.72.1670852320349; Mon, 12 Dec 2022 05:38:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670852320; cv=pass; d=google.com; s=arc-20160816; b=hQLi3yiV9Ffgfm6RhRcKonGdT2ZW9oZRZZ98PNjUDoYeCkO193DFj7bHFrhno8iEtw 7neZY7oH3o92RwCt5W2KufQ+bASfK6kRjtgBgKSqFrq3xSvRzSIuARA2jjeLfnTwRMV/ BcXyJr48GONzPnX20TtqOVG9t3pXWKebaHQDEyR3h4dbv1N8wuP454TCMB3lCO/L60mN 2ndSXpMMTep+NTHZDbiArC1dJPAkAO/K04mmOwyBBq/Pl0gv0CWbKOsbZLSBu+lZFVWc JAuMPORUIn8C5xP/+O7IZt30Wj630iPK9AqQMu084y2bW3e8lM7EAU3TnveBFMgEEM1s 7ELw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=tdygyRDNpWtdt829Z9vESAE+w0POCjkjBloy7V8cJc0=; b=OWFj4sd2ltbJQ7q6Ka+x9D9n+OErv7yUBKeEjRxcjbAgsWAO3CSxnymeQjZH7h22Ia 5rt83lsbO0e4O7EFNSrUHxzgPloQ7UqFV7auNsBoo3jytXaCo4siJJPbVDd4BUESJpbr 7wKNo9tHR7puRxszj/yG8U2pJ4uhH3yKlw39R9tbkEXpkB1G9cJRWwYGEm7pSt2frSrt tT+ztmhQti6I98gZ0CU4qk1Lk1StSVRXB6NeUXcscOLgureuEsYzAlmfzasxLX+WVjNa addw4J2BlG2Yoad3PIYa4wrXxx0TtS8XQBCGDVjmyE6ZgKmmfureBIyxJ4Jvv6TAk6hb IE4Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=qKME3PYw; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i19-20020a1709064fd300b007adb868f102si6579698ejw.476.2022.12.12.05.38.16; Mon, 12 Dec 2022 05:38:40 -0800 (PST) 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=@vivo.com header.s=selector2 header.b=qKME3PYw; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232253AbiLLNiB (ORCPT + 99 others); Mon, 12 Dec 2022 08:38:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232875AbiLLNh1 (ORCPT ); Mon, 12 Dec 2022 08:37:27 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2091.outbound.protection.outlook.com [40.107.255.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E879713E2D for ; Mon, 12 Dec 2022 05:36:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JlXb+ddUcFwI6xPTmMPo5bgY3Jbh4oKCaqe7vBolyQQKxtNu9R66jYt+toO9rk4Uk9z/e3+JA1Kr7dZM2HqvqyHWEUByoUnAMG1VDs13i3TBNfKp/6/r4HrbvxyWze0nwKNeOv+ppRF+tGoMDIQRi0CmMylnIU+xPYiNg4ytz19URBwC42BIDdr59HlpCeFLckJD08fmSwE5WvhFrJWsQU9m52qeJX80sWC+9XOGTmgCHpqO+/+ZNzEFGaUMzpV2eW1krvhGtpDLRbtiyRJqCqCtLbmY0Vfcr27wlcYnX3b6ZW2UpFMckL2G6BKhZgLh4ZP8OPomL8SZ+8zhW47NDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tdygyRDNpWtdt829Z9vESAE+w0POCjkjBloy7V8cJc0=; b=a7j5WqZdbCMgGgBF+UL3J+a4pv02B5eiWU3yPFsKMiPYCec4XjLngv+3beNHfR6rC71oEw5tsdkqGfDv/KQXUEuVAAcUWWjOXtz9GejV/zsbpQi9Uj99DbPmR9m6F7Yn9bOO/b4ZG3/ygfre2OkgjpuloyaTAHwRabSt9vQHLK3PXVEwOxUoqpeheZBYzAFRVoNzWdas3znpMq0zj+bYAVis1eLPFhDamuLOOcauQ1EJ+AE3akd2xuy+KO2yce59h+e14PPPlkSOWWdB8N0kC/ItvLlV2E3p30iimaqd+bw9NpFn1Hs/XYt6E9TrRC2naf6K/Qa6fP9FxCDg9+crxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tdygyRDNpWtdt829Z9vESAE+w0POCjkjBloy7V8cJc0=; b=qKME3PYwKUw2jCNaBnXXT2X+mNS5eK1Wc5It2WIbk0vr5Kip9JzboNpMe2XtoR31IEPmb5U76ZhMhARl2ajFo0JFzn3Uh5jePSxfLRRetI/A0b8Par5j7mzDlUNQWAPZJ0NjqVKys3QsVjJ+P2v+lk5QfqS0C+f9bm4Y/UPdecDaM9+A/U8Vd6p/K2t5REPgUo4YmeuA/E1A+vqpimVZrVt4Z1xLLXDuQKAJQfs2nno7I/sLfyqOI3O6OS9qd04aRTB5o5Onkp1wvrflRUjEzSipzQ68+HCQdM3iKwDrfRCCZ6U6UDkNSzgl7YPsXpC2qenSJrLLZhHel1AGH04SRQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SEZPR06MB6086.apcprd06.prod.outlook.com (2603:1096:101:ee::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Mon, 12 Dec 2022 13:36:56 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b%9]) with mapi id 15.20.5880.019; Mon, 12 Dec 2022 13:36:56 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] f2fs: convert discard_wake and gc_wake to bool type Date: Mon, 12 Dec 2022 21:36:44 +0800 Message-Id: <20221212133644.1503-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB6086:EE_ X-MS-Office365-Filtering-Correlation-Id: ee8260c0-d56a-4eba-1ace-08dadc45eff6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s9yx+QED7bm6gNpzKdc2BgRkLe1+GHeNDBhQCE6XmrNIv+mQwIEgXfID4FniM3+KED4Xt3enjkGtX5PHQTMCPwdo4s2PHeeXmHz2befX8oJlFxbMhiM4NyK+8sp1QkTc4XmBWsNNBOVDpalmlZUv1kPecSducPsvS3xeSDNDKoWSg4siZvURmNT3u0jBMdPdo9/aO9+owhwfNEooTYc77Uy3BpAoSNDFr0F+MGQh/79VNPBpYY1k6i0PyDLI4d+kNNDbjb2ElzXe77mt+YlCdaoEvzVfkGHKkN0XbloDKZjWG+xJ1f1xGSNCdqP+3xHvEP37S/fjhvf0DyVJI86Xr/E+qoqZ/lQboGPhWKuVXmDI+dfSqC0N3T0MaJCkwK5Sc4CyArQ+9qU6PcepifMiLADuzcku/F1Sxklh1scYqgdO0Y2TS6YEbMAqzdV1ye4tH77Lw49keNK5ROzjK3BO1z6GpmmkyQuJ2K9OaNCJBe1BubvEtfAlYvYLgQkDFQJUZTgFEay/4Rff66RT4dSZttR4bCcKD/dxbWd0YkugXlSzs74lmhqVBijVBGLpQjw6FDJh+rGzmxJNEOXY9Jcd+FJmR3oSCHKA8yc7srt3E0amZ7eb6zitjUUpZ1g64TR2GkSP+C3uc3EU2Y/BmkGRJjvHH6c5YfIFH49Q6AaUAVwRHG9OLRVWXbVClhQWraue X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(366004)(39860400002)(136003)(346002)(451199015)(2616005)(478600001)(1076003)(6512007)(186003)(26005)(107886003)(52116002)(6666004)(6486002)(38100700002)(38350700002)(6506007)(5660300002)(66476007)(66556008)(66946007)(4326008)(316002)(2906002)(41300700001)(8676002)(83380400001)(8936002)(86362001)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KVRKCi6qVEZTLdV4/8oGtc5xw1eM+caDEU8KOXfZ7qdrJzaDHfM8s3EDgc/InlTzxDC5i7ZBCd/XTYoMxASvDCcz6LRVMLX2Ag4UGVA/KeIjikVd5CcYJLViIK+R8FigjBIuDA4ThRqrKbvU4NFQ2ppX8TGc1D0xZwDJQV4W+47gziZy4bVss+YmVGfw2k1o8ahabudHEvXTn2vGH8mgrKTfcHjJEBHw8f/52ucV7JS6tBJT/KzK1z++Xu+Bzkib+fDWA4CvXbZawe7p2kdnrr49TMQPv35MTVEn70x/4FM5wSvvqDBEgAXxsYPIFqozphoglq3LxLaD3xppr0RY4x8O6IuXTeYxxuqz+z0IlooVMK7mXbXxX8Awg2OK/NMJ3qhLbz6pKiZ914t4A8MEn156r6ThfkHkGRgAUI5BmEEZE0WpWN5wPl7PJanwvW03etY/pC0VUl2OWIS+XB4Xt/fl0SlodC9tDB1DMtxC0dvC2YQ8F5uon2XM+jyMNX/jszSp4qrH1CQMkeEC1O63H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rg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee8260c0-d56a-4eba-1ace-08dadc45eff6 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2022 13:36:56.5596 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PnBUwryc8CZS6et9II5C2aS5hfaHYhOUvzEMlIoYyNUxBCKsWBG1VBIrGrAzrYeFAZb285zaf2jM7ujHjijNpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6086 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752015643094018924?= X-GMAIL-MSGID: =?utf-8?q?1752015643094018924?= discard_wake and gc_wake have only two values, 0 or 1. So there is no need to use int type to store them. BTW, move discard_wake to the end of the discard_cmd_control structure. Before: - sizeof(struct discard_cmd_control): 8392 After move: - sizeof(struct discard_cmd_control): 8384 Signed-off-by: Yangtao Li Reviewed-by: Chao Yu --- fs/f2fs/f2fs.h | 2 +- fs/f2fs/gc.c | 4 ++-- fs/f2fs/gc.h | 2 +- fs/f2fs/segment.c | 2 +- fs/f2fs/segment.h | 2 +- fs/f2fs/sysfs.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e8953c3dc81a..764041d7b217 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -402,7 +402,6 @@ struct discard_cmd_control { struct list_head wait_list; /* store on-flushing entries */ struct list_head fstrim_list; /* in-flight discard from fstrim */ wait_queue_head_t discard_wait_queue; /* waiting queue for wake-up */ - unsigned int discard_wake; /* to wake up discard thread */ struct mutex cmd_lock; unsigned int nr_discards; /* # of discards in the list */ unsigned int max_discards; /* max. discards to be issued */ @@ -420,6 +419,7 @@ struct discard_cmd_control { atomic_t discard_cmd_cnt; /* # of cached cmd count */ struct rb_root_cached root; /* root of discard rb-tree */ bool rbtree_check; /* config for consistence check */ + bool discard_wake; /* to wake up discard thread */ }; /* for the list of fsync inodes, used only during recovery */ diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index f0c6506d8975..678726e6a6e8 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -57,7 +57,7 @@ static int gc_thread_func(void *data) /* give it a try one time */ if (gc_th->gc_wake) - gc_th->gc_wake = 0; + gc_th->gc_wake = false; if (try_to_freeze()) { stat_other_skip_bggc_count(sbi); @@ -181,7 +181,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) gc_th->max_sleep_time = DEF_GC_THREAD_MAX_SLEEP_TIME; gc_th->no_gc_sleep_time = DEF_GC_THREAD_NOGC_SLEEP_TIME; - gc_th->gc_wake = 0; + gc_th->gc_wake = false; sbi->gc_thread = gc_th; init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head); diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 19b956c2d697..15bd1d680f67 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -41,7 +41,7 @@ struct f2fs_gc_kthread { unsigned int no_gc_sleep_time; /* for changing gc mode */ - unsigned int gc_wake; + bool gc_wake; /* for GC_MERGE mount option */ wait_queue_head_t fggc_wq; /* diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a9099a754dd2..a85d438e76ea 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1701,7 +1701,7 @@ static int issue_discard_thread(void *data) dcc->discard_granularity); if (dcc->discard_wake) - dcc->discard_wake = 0; + dcc->discard_wake = false; /* clean up pending candidates before going to sleep */ if (atomic_read(&dcc->queued_discard)) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 3ad1b7b6fa94..22fac8baf4a4 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -924,6 +924,6 @@ static inline void wake_up_discard_thread(struct f2fs_sb_info *sbi, bool force) if (!wakeup || !is_idle(sbi, DISCARD_TIME)) return; wake_up: - dcc->discard_wake = 1; + dcc->discard_wake = true; wake_up_interruptible_all(&dcc->discard_wait_queue); } diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 83a366f3ee80..805b632a3af0 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -511,7 +511,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, } else if (t == 1) { sbi->gc_mode = GC_URGENT_HIGH; if (sbi->gc_thread) { - sbi->gc_thread->gc_wake = 1; + sbi->gc_thread->gc_wake = true; wake_up_interruptible_all( &sbi->gc_thread->gc_wait_queue_head); wake_up_discard_thread(sbi, true); @@ -521,7 +521,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, } else if (t == 3) { sbi->gc_mode = GC_URGENT_MID; if (sbi->gc_thread) { - sbi->gc_thread->gc_wake = 1; + sbi->gc_thread->gc_wake = true; wake_up_interruptible_all( &sbi->gc_thread->gc_wait_queue_head); }