Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4518048ybi; Mon, 27 May 2019 20:33:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8g7MT4hNk+h5MbHnkWsJbXOS1axs00y4rGLdREAWRQY3MoMMrh08T/TRi3DFOKPsespmN X-Received: by 2002:a17:90a:8982:: with SMTP id v2mr2667600pjn.138.1559014404953; Mon, 27 May 2019 20:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559014404; cv=none; d=google.com; s=arc-20160816; b=wdBJLsipg+XbhCSoScQcULCYLYIjaqnjjCM+Fg2/sv5MbbCwxQoWC+kwS81/EAkCVG /2itCnNfHomCF8rSamCngg/4m+1gFNen+KOiocPW+nN4wMPtiNlFirnZ1ZSKgevTLSQJ V4np/VCDqdzuPnfs6Y5TAdZ6BLuISvjDG91c9tF0tRgHO2efqyDOEJlsdCPk4ZM8RVn5 z78gBYfMlj2+DTXNN3B4yFPrl6bVaX2HrrpNHyjGRIn+JvLm2Ob7Zi+PV/P06gypKFjf 5h/0m4qM5a0J+zsH3ME600t4CTZF3E0cLhH+VmrwobWHs713bURTsAKfg/wB/h20I0Jq BWnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=uxtugqUAa9NehSISgWVUCra2043C+kzz7GDUhldPulk=; b=oRRpApWKj2/l/FrHy2ekzGQgOuoTvtq2x3Rojs83CNsWNYH8nXQ0+YPST9sanZ7o+T At5iYGSAArDNjaKLJSRgGL8pQhxm7MXJZ3TnfYzfxcH7qEa5ICTYLP4w7a8o4CzN42/C KIK+ftFw3fSKAsRnI0FuvgrkytgVE1wDutY42QMVChBpYfpddxe7gXLnRY0LAYW+zXDz afWJFtG2S+0XUeNSgqD+KZz2B4FbtX6yh6FykEa+1j1WKPFhps8aaMDnUQR26uXKFl5z ag4rj9QIl5qM76Ofo8JnFRGivQx21VjdzHo/qAehUfFoy/adymZ+ksY57H6drKK31U/s 6cIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh11si19092743plb.383.2019.05.27.20.33.09; Mon, 27 May 2019 20:33:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727730AbfE1Dbh (ORCPT + 99 others); Mon, 27 May 2019 23:31:37 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:17588 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727320AbfE1Dbh (ORCPT ); Mon, 27 May 2019 23:31:37 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EB2311CEAC61CABD6EED; Tue, 28 May 2019 11:31:34 +0800 (CST) Received: from [10.151.23.176] (10.151.23.176) by smtp.huawei.com (10.3.19.211) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 May 2019 11:31:25 +0800 Subject: Re: [f2fs-dev] [PATCH v2] f2fs: ratelimit recovery messages To: Sahitya Tummala CC: Chao Yu , Jaegeuk Kim , , References: <1558962655-25994-1-git-send-email-stummala@codeaurora.org> <94025a6d-f485-3811-5521-ed5c9b4d1d77@huawei.com> <20190528030509.GE10043@codeaurora.org> <2575bd54-d67c-6b26-ebf7-d6adb2e193a7@huawei.com> From: Gao Xiang Message-ID: Date: Tue, 28 May 2019 11:30:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <2575bd54-d67c-6b26-ebf7-d6adb2e193a7@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.151.23.176] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sahitya, On 2019/5/28 11:17, Chao Yu wrote: > Hi Sahitya, > > On 2019/5/28 11:05, Sahitya Tummala wrote: >> Hi Chao, >> >> On Tue, May 28, 2019 at 09:23:15AM +0800, Chao Yu wrote: >>> Hi Sahitya, >>> >>> On 2019/5/27 21:10, Sahitya Tummala wrote: >>>> Ratelimit the recovery logs, which are expected in case >>>> of sudden power down and which could result into too >>>> many prints. >>> >>> FYI >>> >>> https://lore.kernel.org/patchwork/patch/973837/ >>> >>> IMO, we need those logs to provide evidence during trouble-shooting of file data >>> corruption or file missing problem... >>> >> In one of the logs, I have noticed there were ~400 recovery prints in the > > I think its order of magnitudes is not such bad, if there is redundant logs such > as the one in do_recover_data(), we can improve it. > >> kernel bootup. I noticed your patch above and with that now we can always get >> the error returned by f2fs_recover_fsync_data(), which should be good enough >> for knowing the status of recovered files I thought. Do you think we need >> individually each file status as well? > > Yes, I think so, we need them for the detailed info. :) I personally agree with Chao's suggestion as well. Sometimes huawei got stuck into rare potential f2fs stability issues, which is hard to say whether it is a clearly hardware or software issues. These messages is used as some evidences for us to guess what happened. it'd better to handle carefully... Thanks, Gao Xiang > > Thanks, > >> >> Thanks, >> >>> So I suggest we can keep log as it is in recover_dentry/recover_inode, and for >>> the log in do_recover_data, we can record recovery info [isize_kept, >>> recovered_count, err ...] into struct fsync_inode_entry, and print them in >>> batch, how do you think? >>> >>> Thanks, >>> >>>> >>>> Signed-off-by: Sahitya Tummala >>>> --- >>>> v2: >>>> - fix minor formatting and add new line for printk >>>> >>>> fs/f2fs/recovery.c | 18 +++++++++--------- >>>> 1 file changed, 9 insertions(+), 9 deletions(-) >>>> >>>> diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c >>>> index e04f82b..60d7652 100644 >>>> --- a/fs/f2fs/recovery.c >>>> +++ b/fs/f2fs/recovery.c >>>> @@ -188,8 +188,8 @@ static int recover_dentry(struct inode *inode, struct page *ipage, >>>> name = ""; >>>> else >>>> name = raw_inode->i_name; >>>> - f2fs_msg(inode->i_sb, KERN_NOTICE, >>>> - "%s: ino = %x, name = %s, dir = %lx, err = %d", >>>> + printk_ratelimited(KERN_NOTICE >>>> + "%s: ino = %x, name = %s, dir = %lx, err = %d\n", >>>> __func__, ino_of_node(ipage), name, >>>> IS_ERR(dir) ? 0 : dir->i_ino, err); >>>> return err; >>>> @@ -292,8 +292,8 @@ static int recover_inode(struct inode *inode, struct page *page) >>>> else >>>> name = F2FS_INODE(page)->i_name; >>>> >>>> - f2fs_msg(inode->i_sb, KERN_NOTICE, >>>> - "recover_inode: ino = %x, name = %s, inline = %x", >>>> + printk_ratelimited(KERN_NOTICE >>>> + "recover_inode: ino = %x, name = %s, inline = %x\n", >>>> ino_of_node(page), name, raw->i_inline); >>>> return 0; >>>> } >>>> @@ -642,11 +642,11 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, >>>> err: >>>> f2fs_put_dnode(&dn); >>>> out: >>>> - f2fs_msg(sbi->sb, KERN_NOTICE, >>>> - "recover_data: ino = %lx (i_size: %s) recovered = %d, err = %d", >>>> - inode->i_ino, >>>> - file_keep_isize(inode) ? "keep" : "recover", >>>> - recovered, err); >>>> + printk_ratelimited(KERN_NOTICE >>>> + "recover_data: ino = %lx (i_size: %s) recovered = %d, err = %d\n", >>>> + inode->i_ino, >>>> + file_keep_isize(inode) ? "keep" : "recover", >>>> + recovered, err); >>>> return err; >>>> } >>>> >>>> >> > > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel >