Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp778283pxp; Sat, 19 Mar 2022 17:58:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzebR/gvts9FKByW79fK82VeF/mgHCfxIJMyWgKNEq6XmeJWGA/REJe5Iq19EuM+pirpD3n X-Received: by 2002:a63:2317:0:b0:381:3e21:f117 with SMTP id j23-20020a632317000000b003813e21f117mr13447573pgj.514.1647737911117; Sat, 19 Mar 2022 17:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647737911; cv=none; d=google.com; s=arc-20160816; b=iqG2C+1UZYz9XPsEXxSaCMj9OHUk6C/hw+6D11v2aS9/m6v9LvUOlHGVoiaF4WvNpU S4sLRs93+uZiKKFuWw7zxUdqKgWteLhigfEmPD268B8PZdgZXyVQAbKa77IJvy20o+nk GKIm+dniGb5g5jieTxG83X2AR+hC8kPRn/vgnoV17tV+SSvC6H7YCzERCoELrdYbDo9c SQCENBtQQsbtB4EqncRgn1NGz55yF3RKygw27D7Vi7Ijtk4VO7NbQLAaXJ+5WKqllrKD nESw+Oig8GX2hsNPU6FjlrfCF/5lJBYj7ojdCMaPKmjF/7aDyh+moNfMwLD+iQDprHia Q6+Q== 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=bXrcO8k9WHY4LEyS2fhRDME4/GfOMRGHgZg4UE14WTs=; b=OPGKp8ymTQE2BfJUZrMQVKTuNI3ecSVHB9KCS2eUnvWWlFJnorJemRM0m+kCRplXYI wZLKSSxOexCxDkAHuGQ4KFJWJM+WMoHNs64mnnfzQtC0NYyw4ljwjKgokCObbG/6LioC FSqQG+muvTys92QBtVgBrgbLYTwI5EHr8qpPsgfv1xZwO01MXWzXw6QfQMLFzqu9dq96 jYnpCXeYMNKb/5pV67eE92KIOwv6+RYQmdp1/wvRYESWq8fE8mRAA6VrZVubowMHm5c0 dT+TZr2tX3viCOTB2P4sl8ri5YN3RnGLli0hf52rg5JLmAwXBvlNX2UjNdkFDo2/GT9p xXKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iebizR8O; 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 bm23-20020a656e97000000b0038205c14f7dsi10039199pgb.170.2022.03.19.17.58.18; Sat, 19 Mar 2022 17:58:31 -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=iebizR8O; 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 S240302AbiCRTOu (ORCPT + 99 others); Fri, 18 Mar 2022 15:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233464AbiCRTOt (ORCPT ); Fri, 18 Mar 2022 15:14:49 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 596D0F1EB0 for ; Fri, 18 Mar 2022 12:13:28 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id k6so551578plg.12 for ; Fri, 18 Mar 2022 12:13:28 -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=bXrcO8k9WHY4LEyS2fhRDME4/GfOMRGHgZg4UE14WTs=; b=iebizR8O8be3nBzdLU3hoQPgO8RnJmvjRTgTSwdJEiW6W336peFm1HV1Jr7nla8WAF igKypm4cZ8RxRETI7VvpNZxw7VWQv73Rv1sJT7IWa7F9MjuIzfmsxxwdZk3wwlpT35sM t8sT7WSKQf8GoicCzPsAD8gFAdcj5VpwpRAtJSDVnPVHjuiTeXLe7D4c7Iczx0WfFLgv tRMSQ7R3yAKpW3pd+47LKynEakBQFZJKTyjxfmEa1+mdxiZDFeg6pESGA6sQpUbDTcUB 34YihZve2/QExHctdZDYFMHbhD623eOzXTHGCxiT3ccMaZadchIJjvz3HYJAKB3iJu/9 Umjw== 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=bXrcO8k9WHY4LEyS2fhRDME4/GfOMRGHgZg4UE14WTs=; b=jHjjQnOx6iGvb/jNKfH/YO5LPq3I36iAEIG0xXyT+gdCa2Z2oNCdBrkqTHq09vuu/f pXFmUFj7yCIZS6VbJtyzP/IR/hNlU+QyntDwJehPcVy5u2jLMOOX8/tNksPQzar6azuE SEfBE4LL3l9BFPj8FThWpB6IMI1D+g3Go4hLu93zKX0XrFGY4Fr8mDPbVe+Wfi+VxUGZ TdCWamNoCcJt9fjsJpRNaTMHz6HAC0b1GTj4+nL8b5UYZN1OXiaX4XsA799ypcG0Tlwi bkZFfHso5XS4P4BjEroBO/ST7igcW8cNv4BhpvV9A/NrdqYOWIaCFkSwwY8s+4XsE936 E16A== X-Gm-Message-State: AOAM530iVZvCwc/FD/zEqJ3ogQQSY1qm4OQZ8AyoNk9jfTTIDo9/Lajw uEeQW6AJSYCX7VMBA90f+7Bu9SPkzEg= X-Received: by 2002:a17:902:ea04:b0:152:7cf:1b85 with SMTP id s4-20020a170902ea0400b0015207cf1b85mr959898plg.80.1647630807714; Fri, 18 Mar 2022 12:13:27 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2620:15c:211:201:a64c:198c:4e57:caeb]) by smtp.gmail.com with ESMTPSA id b13-20020a056a00114d00b004c122b90703sm10325451pfm.27.2022.03.18.12.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 12:13:27 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] f2fs: make gc_urgent and gc_segment_mode sysfs node readable Date: Fri, 18 Mar 2022 12:13:23 -0700 Message-Id: <20220318191323.4167565-1-daeho43@gmail.com> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog 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: Daeho Jeong Changed a way of showing values of them to use strings. Signed-off-by: Daeho Jeong --- fs/f2fs/sysfs.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index fe29bcb70f46..fb950a13375f 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -41,6 +41,16 @@ enum { ATGC_INFO, /* struct atgc_management */ }; +static const char *gc_mode_names[MAX_GC_MODE] = { + "GC_NORMAL", + "GC_IDLE_CB", + "GC_IDLE_GREEDY", + "GC_IDLE_AT", + "GC_URGENT_HIGH", + "GC_URGENT_LOW", + "GC_URGENT_MID" +}; + struct f2fs_attr { struct attribute attr; ssize_t (*show)(struct f2fs_attr *, struct f2fs_sb_info *, char *); @@ -316,8 +326,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a, return sysfs_emit(buf, "%u\n", sbi->compr_new_inode); #endif + if (!strcmp(a->attr.name, "gc_urgent")) + return sysfs_emit(buf, "%s\n", + gc_mode_names[sbi->gc_mode]); + if (!strcmp(a->attr.name, "gc_segment_mode")) - return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode); + return sysfs_emit(buf, "%s\n", + gc_mode_names[sbi->gc_segment_mode]); if (!strcmp(a->attr.name, "gc_reclaimed_segments")) { return sysfs_emit(buf, "%u\n", -- 2.35.1.894.gb6a874cedc-goog