f2fs: remove unneeded pointer conversion
There are redundant pointer conversion in following call stack: - at position a, inode was been converted to f2fs_file_info. - at position b, f2fs_file_info was been converted to inode again. - truncate_blocks(inode,..) - fi = F2FS_I(inode) ---a - ADDRS_PER_PAGE(node_page, fi) - addrs_per_inode(fi) - inode = &fi->vfs_inode ---b - f2fs_has_inline_xattr(inode) - fi = F2FS_I(inode) - is_inode_flag_set(fi,..) In order to avoid unneeded conversion, alter ADDRS_PER_PAGE and addrs_per_inode to acept parameter with type of inode pointer. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
这个提交包含在:
@@ -407,10 +407,10 @@ cache:
|
||||
* The maximum depth is four.
|
||||
* Offset[0] will have raw inode offset.
|
||||
*/
|
||||
static int get_node_path(struct f2fs_inode_info *fi, long block,
|
||||
static int get_node_path(struct inode *inode, long block,
|
||||
int offset[4], unsigned int noffset[4])
|
||||
{
|
||||
const long direct_index = ADDRS_PER_INODE(fi);
|
||||
const long direct_index = ADDRS_PER_INODE(inode);
|
||||
const long direct_blks = ADDRS_PER_BLOCK;
|
||||
const long dptrs_per_blk = NIDS_PER_BLOCK;
|
||||
const long indirect_blks = ADDRS_PER_BLOCK * NIDS_PER_BLOCK;
|
||||
@@ -498,7 +498,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
|
||||
int level, i;
|
||||
int err = 0;
|
||||
|
||||
level = get_node_path(F2FS_I(dn->inode), index, offset, noffset);
|
||||
level = get_node_path(dn->inode, index, offset, noffset);
|
||||
|
||||
nids[0] = dn->inode->i_ino;
|
||||
npage[0] = dn->inode_page;
|
||||
@@ -792,7 +792,7 @@ int truncate_inode_blocks(struct inode *inode, pgoff_t from)
|
||||
|
||||
trace_f2fs_truncate_inode_blocks_enter(inode, from);
|
||||
|
||||
level = get_node_path(F2FS_I(inode), from, offset, noffset);
|
||||
level = get_node_path(inode, from, offset, noffset);
|
||||
restart:
|
||||
page = get_node_page(sbi, inode->i_ino);
|
||||
if (IS_ERR(page)) {
|
||||
|
在新工单中引用
屏蔽一个用户