Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3687125ybc; Thu, 14 Nov 2019 13:04:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxYdlfGi0lHHdULiQMjOh/U7xKKQiAGTbJrTq1QMKnm6llEtkwDt0SceOu2U5jWWqADNdDJ X-Received: by 2002:a1c:4c10:: with SMTP id z16mr9502527wmf.24.1573765476224; Thu, 14 Nov 2019 13:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573765476; cv=none; d=google.com; s=arc-20160816; b=a/AbGKkYSg92fMNBnLF8ezs8fnyLPFbV3yzUvjWrkcdlKLV2nVeGqBFju2HRCFdllY W+KPEMT2d4fO1qFHse3b2QqjmH0omXHj8GYStPueXcJJ/5P5moU7Ol+zKAWldB3JWpln sa7B3Br6RGlrlxJxYw1Vf0pcUGC9zdhXkX1RLPEpFQr2WhNd0q/ROkAdLHeAvIM/KcEB ts6w+RYVO7yBcOjqL1tXSKti28axsX36+YOuRFV/WNOh7OjzmhIFWu+B3BBQ8CkHsUh1 pztbyhsrH2XiTeAaV+K6dSRz9ZEWmXrY7vsatKkffIw2ph7/P0RRTPGOMhMawM12GLRt 3ACw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FCV7jGzZ+vno0d71lnt+UQX9hacIcuLMG5VEsrhOWkI=; b=c2/CcfzNcA3Gx+SHJ144uY392RM4hf5VJFca9N+GUyzgy0dMb+811UhE8p0HYQ4TUU BvGTDNPMYV+WcJ1UaN7IsNMat1kj8WG23YyQ88zwlG81f5CC0wx2QJMKb2Pvu9fuUrS+ tsQKgwO+XkWXnjMbkRVyO573BayGFXgrnnKSn5BvToi85m6cNf2eBYOLMypZjCmjopVo Qx5hAvbfS0yUzU1UsLoH1RFbpPF27BfiG2jpqriR2Cxpi2FGsy+ydkeoe+abU0IuYscB wc70MrBCvyoG/K+Dz9rv+wY/gUvmE+aLmYYxaTHbb2biVkHG2ZIHDfcfMs01X6IgtEEw v64A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=fm1qQ7lj; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si4281490ejc.76.2019.11.14.13.04.06; Thu, 14 Nov 2019 13:04:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=fm1qQ7lj; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfKNVB0 (ORCPT + 99 others); Thu, 14 Nov 2019 16:01:26 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:47802 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbfKNVB0 (ORCPT ); Thu, 14 Nov 2019 16:01:26 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAEKxDxW037473; Thu, 14 Nov 2019 21:01:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=FCV7jGzZ+vno0d71lnt+UQX9hacIcuLMG5VEsrhOWkI=; b=fm1qQ7ljacoCBS+sd+WLabtpI0JxqoDX5usgIgXMV0mvhNjaBMCcOr3OORCZxsyrX6ah JD4CB/UfG5lDNy97Wa6rCkpyUhHJdSa7qNbu6Z3/05tFCtnblIjj/myXPWpAyHk/WDzH oUaG/oTrxAHXLjfSR5/E+2jqY8gubS7KdCTUaJKA8EQuPjLnszskrmsDzsLcsao+Or7t OX9xzKh+zrEKBbsvy1NqOOgI3JYVP7Frfw353SmD15o583pEH905udEEeYh0IP1oVn3X KpO5pteVj5J3RlNlhNkSJeVd50pNWObZG6RCaR+yhLhI0hwHmca5p1mzjBo7CW5iNsj3 Pg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2w5mvu5tge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 21:01:20 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAEKsGSs001810; Thu, 14 Nov 2019 21:01:20 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2w8g1a1tgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 21:01:20 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id xAEL1JD9009162; Thu, 14 Nov 2019 21:01:19 GMT Received: from localhost (/10.145.178.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Nov 2019 13:01:19 -0800 Date: Thu, 14 Nov 2019 13:01:17 -0800 From: "Darrick J. Wong" To: Dmitry Monakhov Cc: linux-ext4@vger.kernel.org, tytso@mit.edu Subject: Re: [PATCH 1/2] ext4: fix symbolic enum printing in trace output Message-ID: <20191114210117.GC6213@magnolia> References: <20191114200147.1073-1-dmonakhov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191114200147.1073-1-dmonakhov@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9441 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140173 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9441 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140174 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Nov 14, 2019 at 08:01:46PM +0000, Dmitry Monakhov wrote: > Trace's macro __print_flags() produce raw event's decraration w/o knowing actual > flags value > > cat /sys/kernel/debug/tracing/events/ext4/ext4_ext_map_blocks_exit/format > .. > __print_flags(REC->mflags, "", { (1 << BH_New), > > For that reason we have to explicitly define it via special macro TRACE_DEFINE_ENUM() > Also add missed EXTENT_STATUS_REFERENCED flag. > > #Before patch > ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 2 flags lblk 0 pblk 4177 len 1 mflags 0x20 ret 1 > ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 12 flags CREATE lblk 0 pblk 34304 len 1 mflags 0x60 ret 1 > > #With patch > ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 2 flags lblk 0 pblk 4177 len 1 mflags M ret 1 > ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 12 flags CREATE lblk 0 pblk 34816 len 1 mflags NM ret 1 > > Signed-off-by: Dmitry Monakhov > --- > include/trace/events/ext4.h | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h > index 182c9fe..3bf7128 100644 > --- a/include/trace/events/ext4.h > +++ b/include/trace/events/ext4.h > @@ -48,6 +48,16 @@ struct partial_cluster; > { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \ > { EXT4_GET_BLOCKS_ZERO, "ZERO" }) > > +/* > + * __print_flags() requires that all enum values be wrapped in the > + * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace > + * ring buffer. > + */ > +TRACE_DEFINE_ENUM(BH_New); > +TRACE_DEFINE_ENUM(BH_Mapped); > +TRACE_DEFINE_ENUM(BH_Unwritten); > +TRACE_DEFINE_ENUM(BH_Boundary); > + > #define show_mflags(flags) __print_flags(flags, "", \ > { EXT4_MAP_NEW, "N" }, \ > { EXT4_MAP_MAPPED, "M" }, \ > @@ -62,11 +72,18 @@ struct partial_cluster; > { EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\ > { EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER, "LAST_CLUSTER" }) > > +TRACE_DEFINE_ENUM(ES_WRITTEN_B); > +TRACE_DEFINE_ENUM(ES_UNWRITTEN_B); > +TRACE_DEFINE_ENUM(ES_DELAYED_B); > +TRACE_DEFINE_ENUM(ES_HOLE_B); > +TRACE_DEFINE_ENUM(ES_REFERENCED_B); I wonder if it's worth leaving a comment wherever this enum is defined warning developers to keep this TRACE_DEFINE_NUM list (and the string mapping) up to date? --D > #define show_extent_status(status) __print_flags(status, "", \ > { EXTENT_STATUS_WRITTEN, "W" }, \ > { EXTENT_STATUS_UNWRITTEN, "U" }, \ > { EXTENT_STATUS_DELAYED, "D" }, \ > - { EXTENT_STATUS_HOLE, "H" }) > + { EXTENT_STATUS_HOLE, "H" }, \ > + { EXTENT_STATUS_REFERENCED, "R" }) > > #define show_falloc_mode(mode) __print_flags(mode, "|", \ > { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \ > -- > 2.7.4 >