Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp209319iob; Mon, 2 May 2022 17:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwP46WRJTvFdx9p05w/YJ8sA5FWfN3ZQsCoB29xbDaXDvrw7xmFE77KI0pGtvfn+HL5eyS5 X-Received: by 2002:a05:6a00:244a:b0:4fa:ebf9:75de with SMTP id d10-20020a056a00244a00b004faebf975demr13524176pfj.73.1651537003910; Mon, 02 May 2022 17:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537003; cv=none; d=google.com; s=arc-20160816; b=JBeOeMUBDYNTt/SHHZmD/6sWIhBkDMdgsMzrutxVajQte1NuogaW36YSKuzSpN4HHh WO/xvswp7VqaI6ZN70RATxyWajQiGFryY71gq4l++wUZQnaqethTrRm0fla1/CMbYNWN /kQOTBbLYmooovhJeprw/fsspvU4FIE/YAGP9M75fSHbmnTesDn2tDLFyQoxdfMwI2dP IV0ieIjSGub8bblaPCek63l6kEQIXl/i7iAsGkX50m/GIZEKIc8/wj2zWwtKHJzIz227 fWYmx59EkEAUYVOyJfAXpvLVXdXTYpgTZX938vsVhsbSvTPCHf/cuLY/w2mAS+rkmdD5 CJrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=ga9ROf5ix+tFT4oGIEf5QkQM90cv+Xc4ECD9D3wy18o=; b=ZXJceIFPjT+lF5rpkvRXUQ2wloRFZOdy23mZcuEJGR0s/9n8H6kwvr6lnSydmTPV5K XzdQs+RGwNodWnhJZnq4VF+j1A5TzA1HK9d9pGRYf7bxpBPu1+4JxSWWeYTdOPIgJ6b2 Mmt1mzkAmMu12nKFWMg/DBXW3x79rShD3HP2YZFrzM2USEQ7aX1lolLgYznPk+wAocMV QDaAIRTSaJ+RJeprHDLMJcHzcnhlmFkfY02wa2tnYsLnf4XTxuMCV0SHr3a8AxOWPYb2 oTMlb+BDIrQL9sskjEqrwBdf1tUy4EqosoI7p6GsvXHkY1WkfYPXWokgXGao0yR2ANe+ XAFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vyu1evG5; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v21-20020a637a15000000b0039dc635f2d9si16827249pgc.281.2022.05.02.17.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:16:43 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vyu1evG5; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 82DC0F08; Mon, 2 May 2022 17:14:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242369AbiD3Qr5 (ORCPT + 99 others); Sat, 30 Apr 2022 12:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383169AbiD3Qrz (ORCPT ); Sat, 30 Apr 2022 12:47:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0080C58380 for ; Sat, 30 Apr 2022 09:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651337071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ga9ROf5ix+tFT4oGIEf5QkQM90cv+Xc4ECD9D3wy18o=; b=Vyu1evG5GAcGRImbE5+AmOU/MusEZqH/Tn51N+FIMKCf9OA/ETvcTSxkFAEjRzx/DGJepk 9k+8lxmhW/8SjR/vrhWBYqBkr/mKHFk9awwubTanihxtna9h9fucCojxk9OKF+qonvW9y9 4nzeAyYsz3vBM586cJn2xbMth/bd9m4= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-qZBDrv_XPOKbMST0cLRs8Q-1; Sat, 30 Apr 2022 12:44:30 -0400 X-MC-Unique: qZBDrv_XPOKbMST0cLRs8Q-1 Received: by mail-qv1-f72.google.com with SMTP id 13-20020a0562140d6d00b004563de53d74so8035791qvs.11 for ; Sat, 30 Apr 2022 09:44:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=ga9ROf5ix+tFT4oGIEf5QkQM90cv+Xc4ECD9D3wy18o=; b=sfT9bT2ay6ZhrLtU08vdkwyoLLD7DHofKgBPNF1BipOKwgLCEtrBXczqvIRWFAqOmI ndR1PmuAJlicFCB9zBRlq6dsZafJBbRuSWrzdrPKxwkWDg0EuwCEuE9/GXhxyqHb6k1L oKt8iWXgvhuXKIwqj/hcoHvrbaFocxBOtuw7nVnS36Ynf7nos/bIRjG0Z1apmSENxMfK wFCOpLbR6gQXvcNZfAiv4dfUplUxuzX+zBMRXbiSvi2BMSQHNOuCNf8Nhy5IoUAzRQXK HCbMxZEtg7ccweMYX5GiW2qxWRPVff3sm+fFWgx7qNtH7MK/fvUKELg4hYECKHz3Ps+g XuIg== X-Gm-Message-State: AOAM533WcIdCJbRvIFnY8+gJ/cnVtjCjs0ps8R1BuDyXSuvNAXNeIaPP OSgrSYSrSzmYodb3z8YGFwckXhmt4/4J0NQQMskRMk9ztbJl3k/r19hqS2dQ+UZto0vbers7aua ylAsVuQYmMCIr5AX5KXic X-Received: by 2002:ac8:5cd4:0:b0:2f3:9249:ff0b with SMTP id s20-20020ac85cd4000000b002f39249ff0bmr4105950qta.422.1651337069638; Sat, 30 Apr 2022 09:44:29 -0700 (PDT) X-Received: by 2002:ac8:5cd4:0:b0:2f3:9249:ff0b with SMTP id s20-20020ac85cd4000000b002f39249ff0bmr4105932qta.422.1651337069391; Sat, 30 Apr 2022 09:44:29 -0700 (PDT) Received: from [172.31.1.6] ([71.168.80.171]) by smtp.gmail.com with ESMTPSA id w24-20020a05620a095800b0069fc13ce23csm1359413qkw.109.2022.04.30.09.44.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Apr 2022 09:44:29 -0700 (PDT) Message-ID: <6b3b7148-2b05-b0ed-d1ae-aa4eb72d68fe@redhat.com> Date: Sat, 30 Apr 2022 12:44:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] nfsrahead: fix and improve logging. Content-Language: en-US To: Thiago Becker , linux-nfs@vger.kernel.org References: <20220429163604.1645422-1-tbecker@redhat.com> From: Steve Dickson In-Reply-To: <20220429163604.1645422-1-tbecker@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-nfs@vger.kernel.org On 4/29/22 12:36 PM, Thiago Becker wrote: > Logging was not working properly wrt verbosity, it is changed by > changing the facilities used. While at logging, add some extra logs when > verbose that may be important. > > Signed-off-by: Thiago Becker Committed... steved. > --- > tools/nfsrahead/main.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c > index 83a389f7..5fae941c 100644 > --- a/tools/nfsrahead/main.c > +++ b/tools/nfsrahead/main.c > @@ -85,8 +85,10 @@ static int get_mountinfo(const char *device_number, struct device_info *device_i > > mnttbl = mnt_new_table(); > > - if ((ret = mnt_table_parse_file(mnttbl, mountinfo_path)) < 0) > + if ((ret = mnt_table_parse_file(mnttbl, mountinfo_path)) < 0) { > + xlog(D_GENERAL, "Failed to parse %s\n", mountinfo_path); > goto out_free_tbl; > + } > > if ((fs = mnt_table_find_devno(mnttbl, device_info->dev, MNT_ITER_FORWARD)) == NULL) { > ret = ENOENT; > @@ -130,19 +132,20 @@ static int conf_get_readahead(const char *kind) { > > return readahead; > } > -#define L_DEFAULT (L_WARNING | L_ERROR | L_FATAL) > > int main(int argc, char **argv) > { > int ret = 0, retry; > struct device_info device; > - unsigned int readahead = 128, verbose = 0, log_stderr = 0; > + unsigned int readahead = 128, log_level, log_stderr = 0; > char opt; > > + > + log_level = D_ALL & ~D_GENERAL; > while((opt = getopt(argc, argv, "dF")) != -1) { > switch (opt) { > case 'd': > - verbose = 1; > + log_level = D_ALL; > break; > case 'F': > log_stderr = 1; > @@ -154,7 +157,7 @@ int main(int argc, char **argv) > > xlog_stderr(log_stderr); > xlog_syslog(~log_stderr); > - xlog_config(L_DEFAULT | (L_NOTICE & verbose), 1); > + xlog_config(log_level, 1); > xlog_open(CONF_NAME); > > // xlog_err causes the system to exit > @@ -166,12 +169,12 @@ int main(int argc, char **argv) > break; > > if (ret != 0) { > - xlog(L_ERROR, "unable to find device %s\n", argv[optind]); > + xlog(D_GENERAL, "unable to find device %s\n", argv[optind]); > goto out; > } > > if (strncmp("nfs", device.fstype, 3) != 0) { > - xlog(L_NOTICE, > + xlog(D_GENERAL, > "not setting readahead for non supported fstype %s on device %s\n", > device.fstype, argv[optind]); > ret = -EINVAL; > @@ -180,7 +183,7 @@ int main(int argc, char **argv) > > readahead = conf_get_readahead(device.fstype); > > - xlog(L_WARNING, "setting %s readahead to %d\n", device.mountpoint, readahead); > + xlog(D_FAC7, "setting %s readahead to %d\n", device.mountpoint, readahead); > > printf("%d\n", readahead); >