diff options
author | Chao Yu <yuchao0@huawei.com> | 2020-06-29 20:13:12 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-07-07 21:51:46 -0700 |
commit | b79b0a310bca6dbe86d8adc1ca6a88e818bc1f19 (patch) | |
tree | 8d944def4969e01fd4ebbb7ba891a184f76cff09 /fs | |
parent | 250e84d725479914aa6f3feec1191c5f1ea3c057 (diff) |
f2fs: support to trace f2fs_bmap()
to show f2fs_bmap()'s result as below:
f2fs_bmap: dev = (251,0), ino = 7, lblock:0, pblock:396800
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/data.c | 14 |
1 files changed, 11 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 |