Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2017325ybt; Sun, 28 Jun 2020 05:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA6UdPeBDHQBSyRBo0f9n8mGGn/Mlomf6fWlaICo2TZecKIP7KEUYVRqniTFnRGGdhAaAU X-Received: by 2002:aa7:d6cf:: with SMTP id x15mr12369312edr.164.1593347450483; Sun, 28 Jun 2020 05:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593347450; cv=none; d=google.com; s=arc-20160816; b=ezbbfAF72ubdjgpgi9abdcgVxiLiyQ5M+bwq4jYeAN3nPyrfpjnb9WRo2Cir/mUS3F a2cD4U3ETC/kRDUlYWq6Ju6NX4k2iX/0tCKTJWwqE+3t5CCWwWyPr4sCVa8vNiL/XGQ6 bSGoLabO42NR6iPHWsPD9AQdop8jn+jg5NF5r3iWbzlKk5GtNBHd9qu3cX0kYsoDliUY XqIP8bEwvMr0KvMW/mqWrBqsL/Rj0bZ0A0OOnWivbff3CV5se2dhm01CLpiWK7tsm6vs 9WUdQ/uQdRENF7Vqf24xYXMVJpyLsSOLnIgBH/xQ4LgRym2Xt2H/9bs2U3afVOHo8peQ uCkQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NHEjsmd46maEqsz8IFFbn7CvyfiYyuBEw4oR5KrNuPY=; b=xMrbuh0voov6gmeWOAgztXwImc6EbLIrQhkagKD5LCK7yrqD8iIez5OVd8j4iun0YR DlOIGTQKWgKTZJ+EsiEo6PoVPUgUj7xNp0AvznmQr6YwqF3vbJEYhcVe0GzoOMzdwrWZ G7r9U3qyKEMRr4FbK3TZoqGLWwtoujGvIiZ/NsjYqAUwjYRMeRpEXtWhc4OMKCZQVgL3 CJXtRgPDY7NN1Emr76QT5gpa7+jjKftsBzGEeHrrQfrYUHRdQ0mJbj38ZcxCSjR4sFCB wHaTrqcVtluzBvVH2xdJK/lmV5VjfbHoLFKse4ISCNxJmqZaVxuLlNeeeciZC2c7oeka NP4g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx8si11942157ejb.415.2020.06.28.05.30.27; Sun, 28 Jun 2020 05:30:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726463AbgF1MaV (ORCPT + 99 others); Sun, 28 Jun 2020 08:30:21 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33758 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726317AbgF1MaS (ORCPT ); Sun, 28 Jun 2020 08:30:18 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B128AF012B4D705F9F08; Sun, 28 Jun 2020 20:30:14 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Sun, 28 Jun 2020 20:30:07 +0800 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH 3/3] f2fs: support to trace f2fs_fiemap() Date: Sun, 28 Jun 2020 20:29:40 +0800 Message-ID: <20200628122940.29665-3-yuchao0@huawei.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200628122940.29665-1-yuchao0@huawei.com> References: <20200628122940.29665-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org to show f2fs_fiemap()'s result as below: f2fs_fiemap: dev = (251,0), ino = 7, lblock:0, pblock:1625292800, len:2097152, flags:0, ret:0 Signed-off-by: Chao Yu --- fs/f2fs/data.c | 6 +++++- fs/f2fs/inline.c | 2 ++ include/trace/events/f2fs.h | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c07a50e4d967..995cf78b23c5 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1813,6 +1813,7 @@ static int f2fs_xattr_fiemap(struct inode *inode, flags |= FIEMAP_EXTENT_LAST; err = fiemap_fill_next_extent(fieinfo, 0, phys, len, flags); + trace_f2fs_fiemap(inode, 0, phys, len, flags, err); if (err || err == 1) return err; } @@ -1836,8 +1837,10 @@ static int f2fs_xattr_fiemap(struct inode *inode, flags = FIEMAP_EXTENT_LAST; } - if (phys) + if (phys) { err = fiemap_fill_next_extent(fieinfo, 0, phys, len, flags); + trace_f2fs_fiemap(inode, 0, phys, len, flags, err); + } return (err < 0 ? err : 0); } @@ -1931,6 +1934,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, ret = fiemap_fill_next_extent(fieinfo, logical, phys, size, flags); + trace_f2fs_fiemap(inode, logical, phys, size, flags, ret); if (ret) goto out; size = 0; diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index dbade310dc79..def4b8481883 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -12,6 +12,7 @@ #include "f2fs.h" #include "node.h" +#include bool f2fs_may_inline_data(struct inode *inode) { @@ -776,6 +777,7 @@ int f2fs_inline_data_fiemap(struct inode *inode, byteaddr += (char *)inline_data_addr(inode, ipage) - (char *)F2FS_INODE(ipage); err = fiemap_fill_next_extent(fieinfo, start, byteaddr, ilen, flags); + trace_f2fs_fiemap(inode, start, byteaddr, ilen, flags, err); out: f2fs_put_page(ipage, 1); return err; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 3d844c51d283..67202963ef82 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1918,6 +1918,44 @@ TRACE_EVENT(f2fs_bmap, (unsigned long long)__entry->pblock) ); +TRACE_EVENT(f2fs_fiemap, + + TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock, + unsigned long long len, unsigned int flags, int ret), + + TP_ARGS(inode, lblock, pblock, len, flags, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(sector_t, lblock) + __field(sector_t, pblock) + __field(unsigned long long, len) + __field(unsigned int, flags) + __field(int, ret) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->lblock = lblock; + __entry->pblock = pblock; + __entry->len = len; + __entry->flags = flags; + __entry->ret = ret; + ), + + TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, " + "len:%llu, flags:%u, ret:%d", + show_dev(__entry->dev), + __entry->ino, + (unsigned long long)__entry->lblock, + (unsigned long long)__entry->pblock, + __entry->len, + __entry->flags, + __entry->ret) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 2.26.2