Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2785939pxb; Tue, 21 Sep 2021 07:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/opNUN5cGthDkb8qCqsbrh32ArPemBdthm4mejISWPfA52aP+zi8B3wuMgGfpgVf/IpUL X-Received: by 2002:a05:6402:5ca:: with SMTP id n10mr4471743edx.335.1632235113212; Tue, 21 Sep 2021 07:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632235113; cv=none; d=google.com; s=arc-20160816; b=ne/YeE6tTyBRjbRPfbTE6j1oivl0vI/zQHs8axSYhxl0MbKf/5lAKyETVc/SU6Hwuo 2YPJyif7p4AljUIbdvaO2mhz6juewXwDNrJZvuNotWmP+jOvnKauDBUbeVIO3EqKtoJW lE4H570YR2YKLAOhvlqtHj0KhpCefY2FmArx528zHQvcuiaWcuQG+JEvhYN4oNrNX1FP O3uP45Y6VQ0RSZX3oT/3DDc/mCk3tWlJ8d//4LznBpMN1XFD7jd8ir3oT74C6igsPYZi GoBfeW1eaOLiA0rARTYElHEauY3YIwSL+acVyhfUgwkQYfTqK1c45/bi/rYtwLniRN+J DVuQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MLDAZdqZHKBUI+ZlVEvAvCAHRx2hwN8qAaY5RfriHBI=; b=fBRQwDVgRYZbk7NszeCI3+YUBEEk4XRp33M1PawPNuiu/wgJGVZJxEx8A6Vlx/wlJX ZawufvgGitrDjU+dsH50KXrKcSE7kuXthEoyGlEf+9XYCKBv9JcJhkWQfHkTIxOestYT kxeZNy5hyxWUpA7Tp01Q5hKUAV1rR5faRTJ84bzEzGov5mDPoQUlIcCP0HnqC3RR2gv3 mOnJbo0/I+i6P6MU3YovT34be0O49Tl4DuvT0r4fXDf6+rx08RkYR6HdCBeXZx4MiTiR 5B/hAJPqwmamDFZ1Etxbmo/YqlJq3CaErIcVnSLPWCRzuV9Qt7UcVkFwueTNPqkBUjpR exSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si670597edc.159.2021.09.21.07.38.08; Tue, 21 Sep 2021 07:38:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233708AbhIUOhS (ORCPT + 99 others); Tue, 21 Sep 2021 10:37:18 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:59282 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233716AbhIUOhR (ORCPT ); Tue, 21 Sep 2021 10:37:17 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R461e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0Up8yjG5_1632234933; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Up8yjG5_1632234933) by smtp.aliyun-inc.com(127.0.0.1); Tue, 21 Sep 2021 22:35:47 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH 2/2] erofs: clean up erofs_map_blocks tracepoints Date: Tue, 21 Sep 2021 22:35:31 +0800 Message-Id: <20210921143531.81356-2-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 In-Reply-To: <20210921143531.81356-1-hsiangkao@linux.alibaba.com> References: <20210921143531.81356-1-hsiangkao@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the new type of chunk-based files is introduced, there is no need to leave flatmode tracepoints. Rename to erofs_map_blocks. Add the missing FIEMAP tracepoint map flag as well. Signed-off-by: Gao Xiang --- fs/erofs/data.c | 31 ++++++++++++++----------------- include/trace/events/erofs.h | 7 ++++--- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 9db8297..020c3e0 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -26,14 +26,11 @@ static int erofs_map_blocks_flatmode(struct inode *inode, struct erofs_map_blocks *map, int flags) { - int err = 0; erofs_blk_t nblocks, lastblk; u64 offset = map->m_la; struct erofs_inode *vi = EROFS_I(inode); bool tailendpacking = (vi->datalayout == EROFS_INODE_FLAT_INLINE); - trace_erofs_map_blocks_flatmode_enter(inode, map, flags); - nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE); lastblk = nblocks - tailendpacking; @@ -57,8 +54,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, "inline data cross block boundary @ nid %llu", vi->nid); DBG_BUGON(1); - err = -EFSCORRUPTED; - goto err_out; + return -EFSCORRUPTED; } map->m_flags |= EROFS_MAP_META; @@ -67,14 +63,10 @@ static int erofs_map_blocks_flatmode(struct inode *inode, "internal error @ nid: %llu (size %llu), m_la 0x%llx", vi->nid, inode->i_size, map->m_la); DBG_BUGON(1); - err = -EIO; - goto err_out; + return -EIO; } - map->m_llen = map->m_plen; -err_out: - trace_erofs_map_blocks_flatmode_exit(inode, map, flags, 0); - return err; + return 0; } static int erofs_map_blocks(struct inode *inode, @@ -89,6 +81,7 @@ static int erofs_map_blocks(struct inode *inode, erofs_off_t pos; int err = 0; + trace_erofs_map_blocks_enter(inode, map, flags); if (map->m_la >= inode->i_size) { /* leave out-of-bound access unmapped */ map->m_flags = 0; @@ -96,8 +89,10 @@ static int erofs_map_blocks(struct inode *inode, goto out; } - if (vi->datalayout != EROFS_INODE_CHUNK_BASED) - return erofs_map_blocks_flatmode(inode, map, flags); + if (vi->datalayout != EROFS_INODE_CHUNK_BASED) { + err = erofs_map_blocks_flatmode(inode, map, flags); + goto out; + } if (vi->chunkformat & EROFS_CHUNK_FORMAT_INDEXES) unit = sizeof(*idx); /* chunk index */ @@ -109,9 +104,10 @@ static int erofs_map_blocks(struct inode *inode, vi->xattr_isize, unit) + unit * chunknr; page = erofs_get_meta_page(inode->i_sb, erofs_blknr(pos)); - if (IS_ERR(page)) - return PTR_ERR(page); - + if (IS_ERR(page)) { + err = PTR_ERR(page); + goto out; + } map->m_la = chunknr << vi->chunkbits; map->m_plen = min_t(erofs_off_t, 1UL << vi->chunkbits, roundup(inode->i_size - map->m_la, EROFS_BLKSIZ)); @@ -147,11 +143,12 @@ static int erofs_map_blocks(struct inode *inode, map->m_flags = EROFS_MAP_MAPPED; break; } + map->m_llen = map->m_plen; out_unlock: unlock_page(page); put_page(page); out: - map->m_llen = map->m_plen; + trace_erofs_map_blocks_exit(inode, map, flags, 0); return err; } diff --git a/include/trace/events/erofs.h b/include/trace/events/erofs.h index db4f2ce..5c91edd 100644 --- a/include/trace/events/erofs.h +++ b/include/trace/events/erofs.h @@ -19,7 +19,8 @@ { 1, "DIR" }) #define show_map_flags(flags) __print_flags(flags, "|", \ - { EROFS_GET_BLOCKS_RAW, "RAW" }) + { EROFS_GET_BLOCKS_RAW, "RAW" }, \ + { EROFS_GET_BLOCKS_FIEMAP, "FIEMAP" }) #define show_mflags(flags) __print_flags(flags, "", \ { EROFS_MAP_MAPPED, "M" }, \ @@ -169,7 +170,7 @@ __entry->flags ? show_map_flags(__entry->flags) : "NULL") ); -DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_flatmode_enter, +DEFINE_EVENT(erofs__map_blocks_enter, erofs_map_blocks_enter, TP_PROTO(struct inode *inode, struct erofs_map_blocks *map, unsigned flags), @@ -221,7 +222,7 @@ show_mflags(__entry->mflags), __entry->ret) ); -DEFINE_EVENT(erofs__map_blocks_exit, erofs_map_blocks_flatmode_exit, +DEFINE_EVENT(erofs__map_blocks_exit, erofs_map_blocks_exit, TP_PROTO(struct inode *inode, struct erofs_map_blocks *map, unsigned flags, int ret), -- 1.8.3.1