Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp382717rwe; Tue, 18 Apr 2023 23:47:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Zwg0E16wpVYArbWWi6yMWF743LzmKPy9FfnaDM7LlpreI4bug1Yy+2Kv0A5jcjjut5h6E8 X-Received: by 2002:a17:902:f203:b0:1a1:b5ce:5d03 with SMTP id m3-20020a170902f20300b001a1b5ce5d03mr3466792plc.10.1681886857973; Tue, 18 Apr 2023 23:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681886857; cv=none; d=google.com; s=arc-20160816; b=FvOdycxThjWtoKyMU+kXasiE1IZh7hUZ19Yc7lbbUC8hb/fVytZcT0AP0RQa3YcQ63 zRYb1G1+WHkRhSHbaflEOX+usCr5l0prAeiQGEDYLaUsFA/iHyQkDlbBExcyFGPueEei eNFNoOA3VXwadGsgpX8ag3FvW9L8dWOP5mUWsEn19dFrhPnyhrST4eBDRMdtlVrspslT ehUpxJStw/hzqlfMe6rfy0lxJRbYLaHt9H8EeOdLt4iiR7euJKRtWfGrT+1lqaBr3l5t bkyXrbzOCG1iVIbcSR+S6civwGnMeVZmNfUq/sGTtBuVdPb9maoWgHLaRCI/zXMBXIkk 0DHw== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=tCTxIK+SnqDMdz2xoQ1WwnromwLS1x6PtHiwDfeV7RA=; b=sjH55QAtUJkqxB4Iidfis0T/B3zQ7u1WWIrBZv+DP/QNorjBpLm3Fse+zgLJg44TK6 8G5U0hXxn6DsfLxenmSyjMfuZg/MlJ8odXlWTITrCL1wgm9Kxa5TO9NRGzlWEJ6Tkwvn /eAjtBiUT3XFKVEW9HI4UsJcEiYkWzsUrm/mgMkJhdhpEfDnH2pwQdxJOnkYjZxxftIH 8gCHmha2xz0/ElWVFj9uIt6Sb7cHo4viqK3d/8AfzlGXDoQ86wdbB/aG64TpbpJNqr/M 8/DVgcdrisSyAdvtrZ+vP6HWGFMx9ysiAZyu3m7tmNeKDAu9+RkX8WA5vACKNIJ/xNXk wFIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UCuMd2kW; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902b28900b00194bcc88b52si15130999plr.363.2023.04.18.23.47.27; Tue, 18 Apr 2023 23:47:37 -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=@kernel.org header.s=k20201202 header.b=UCuMd2kW; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232240AbjDSG3X (ORCPT + 99 others); Wed, 19 Apr 2023 02:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232242AbjDSG3F (ORCPT ); Wed, 19 Apr 2023 02:29:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797D5B774 for ; Tue, 18 Apr 2023 23:28:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0870363B72 for ; Wed, 19 Apr 2023 06:28:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F635C433EF; Wed, 19 Apr 2023 06:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681885716; bh=985/Kh3t1ZuC33aqHLJddpQN44KiQbFNY0oeobBOvOY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=UCuMd2kWq7lnS3b/8L76RDxr3quWOCJnAaMOBzRrnIBatf+HhJVzCNZWl2XLCDYw5 Pa9Q0+XRBo0phjqWcZ9dTaZ5l4gmWxTrSSkOFaTgrZ59g6OPCQeJKkQ5KWyiM25O6n KOrKXTKWLpw4TcjhmFgHPsiclrrtXE2ALtGFOvlAps7cIY1SJT1AN8IEgMwwmi6zBm oKwCkbw20bzWNHEgUVbPZ+f3+fhgrwakSFYKkJkKfh3LKEEWz0p5tOXCSdJ2qC3aI+ wkDtN5Lfe6/04b20GREdHiWCeiig/UeE1dXajukVS5NmBhkh4JA7RKOypw/MsbHz3m tk7SlmerkOqWw== Message-ID: <91a05857-c916-cae5-d61d-bbec6f1ae052@kernel.org> Date: Wed, 19 Apr 2023 14:28:33 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 1/1] f2fs: allocate trace path buffer from names_cache Content-Language: en-US To: Jaegeuk Kim Cc: Wu Bo , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, wubo.oduw@gmail.com References: <20230414104308.6591-1-bo.wu@vivo.com> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 On 2023/4/19 0:07, Jaegeuk Kim wrote: > On 04/18, Chao Yu wrote: >> On 2023/4/14 18:43, Wu Bo wrote: >>> It would be better to use the dedicated slab to store path. >>> >>> Signed-off-by: Wu Bo >>> --- >>> fs/f2fs/file.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >>> index 15dabeac4690..27137873958f 100644 >>> --- a/fs/f2fs/file.c >>> +++ b/fs/f2fs/file.c >>> @@ -4361,7 +4361,7 @@ static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw) >>> struct inode *inode = file_inode(iocb->ki_filp); >>> char *buf, *path; >>> - buf = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL); >>> + buf = __getname(); >> >> How about: >> >> buf = f2fs_kmem_cache_alloc(names_cachep, GFP_KERNEL, NULL, F2FS_I_SB(inode)); > > This looks like a hack using names_cachep? names_cachep was exported in fs.h. > Using f2fs_kmem_cache_alloc is able to inject malloc error. > But here is a trace event, is it ok to inject error in a trace path? Yes, the fail path handling is very simple, so it's fine to leave it as it is. Reviewed-by: Chao Yu Thanks, > >> >>> if (!buf) >>> return; >>> path = dentry_path_raw(file_dentry(iocb->ki_filp), buf, PATH_MAX); >>> @@ -4374,7 +4374,7 @@ static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw) >>> trace_f2fs_dataread_start(inode, iocb->ki_pos, count, >>> current->pid, path, current->comm); >>> free_buf: >>> - kfree(buf); >>> + __putname(buf); >> >> kmem_cache_free(names_cachep, buf); >> >> Thanks, >> >>> } >>> static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)