Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2017727ybt; Sun, 28 Jun 2020 05:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ6Dy+XcB2MpW10LYxRUJa8KG3mFNAH1pL612lBqiPvyXXtqr5srLTM402ncwsTmP6jfri X-Received: by 2002:a17:906:5657:: with SMTP id v23mr10408245ejr.196.1593347494478; Sun, 28 Jun 2020 05:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593347494; cv=none; d=google.com; s=arc-20160816; b=XVFXk+Pzv/OoUI8rKSWpF8zH6g7tOQvVavSw5xkxuarG6n69QUg1kV0LcGTJ1wVMO2 /g9V1kN2pO/yuIPi3M7te0rK0XMrPS4l87/znYTrSAy4AmNuRhs/OR/E3Bn/Amc0moC4 vMu8WWn4e/RIphaCVSaMWM1mloCjWW7kZUrqdq3s30lyeD2LY4goZKWv6D4OwnG2ISjI gmQc/E8dAm+Pf2dQdp788e4OLZwK0C7WVJTOlIJdyLCok7h+6Kt1cY/oqNdzvGoLfuh/ 0SiYL/qQw5cn1xnzFq9mZvmQmMzA4eo151bi6y6uED5PIpW3agcJVQMoyNZm0W22CYHi wm4g== 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=druS1IyrZPz3mcYs/zRsB+EUqWUopWStFSsTICn3/AA=; b=LmvJYx3aUO7ppKxySj7xjp+gUNJTx13MufT2CjrcqCDsEtJSy6Nw6N8zEHqM2Qwubs +yqd4jsCk+JnhOIDagTHyjabCdpNUE6VVt1RD6IDSVGBr5i0L/g/VVpniKjE3+2Plv3R 0LuhxI0mVztF4CqiGTQCTQ33PM6WWj0M4sppvtZXWutR+P4Zxmg6QTGZ+21aLCAOHq1K KKSTnOj7nHnsHc6M/rjB01hIsWpYrjJzpI8GI+EjUj8R5oiafYJErPS5PfHvcZl9TaKM 6TrZyAdsIBOORLCxKB2eEmNfTjyq7IneNTyZUsw1+2sIWUIy7lZTxAe4qTSyj+yGjHIX u+SQ== 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 ce10si13454559edb.534.2020.06.28.05.31.11; Sun, 28 Jun 2020 05:31:34 -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 S1726443AbgF1MaT (ORCPT + 99 others); Sun, 28 Jun 2020 08:30:19 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33760 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726342AbgF1MaS (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 B6460FEF95BAB2B080D3; 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 2/3] f2fs: support to trace f2fs_bmap() Date: Sun, 28 Jun 2020 20:29:39 +0800 Message-ID: <20200628122940.29665-2-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_bmap()'s result as below: f2fs_bmap: dev = (251,0), ino = 7, lblock:0, pblock:396800 Signed-off-by: Chao Yu --- fs/f2fs/data.c | 14 +++++++++++--- include/trace/events/f2fs.h | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 91dc7b598961..c07a50e4d967 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3713,18 +3713,26 @@ static sector_t f2fs_bmap_compress(struct inode *inode, sector_t block) static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; + struct buffer_head tmp = { + .b_size = i_blocksize(inode), + }; + sector_t blknr = 0; if (f2fs_has_inline_data(inode)) - return 0; + goto out; /* make sure allocating whole blocks */ if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) filemap_write_and_wait(mapping); if (f2fs_compressed_file(inode)) - return f2fs_bmap_compress(inode, block); + blknr = f2fs_bmap_compress(inode, block); - return generic_block_bmap(mapping, block, get_data_block_bmap); + if (!get_data_block_bmap(inode, block, &tmp, 0)) + blknr = tmp.b_blocknr; +out: + trace_f2fs_bmap(inode, block, blknr); + return blknr; } #ifdef CONFIG_MIGRATION diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 8639ab962a71..3d844c51d283 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1891,6 +1891,33 @@ TRACE_EVENT(f2fs_iostat, __entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio) ); +TRACE_EVENT(f2fs_bmap, + + TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock), + + TP_ARGS(inode, lblock, pblock), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(sector_t, lblock) + __field(sector_t, pblock) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->lblock = lblock; + __entry->pblock = pblock; + ), + + TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld", + show_dev(__entry->dev), + __entry->ino, + (unsigned long long)__entry->lblock, + (unsigned long long)__entry->pblock) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 2.26.2