Commit 4abd3f5a authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: introduce __try_update_largest_extent

This patch adds a new helper __try_update_largest_extent for cleanup.
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 545fe421
......@@ -351,8 +351,7 @@ static struct extent_node *__try_merge_extent_node(struct f2fs_sb_info *sbi,
}
if (en) {
if (en->ei.len > et->largest.len)
et->largest = en->ei;
__try_update_largest_extent(et, en);
et->cached_en = en;
}
return en;
......@@ -389,8 +388,7 @@ static struct extent_node *__insert_extent_tree(struct f2fs_sb_info *sbi,
if (!en)
return NULL;
if (en->ei.len > et->largest.len)
et->largest = en->ei;
__try_update_largest_extent(et, en);
et->cached_en = en;
return en;
}
......@@ -476,12 +474,10 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
: NULL;
}
if (parts) {
if (en->ei.len > et->largest.len)
et->largest = en->ei;
} else {
if (parts)
__try_update_largest_extent(et, en);
else
__detach_extent_node(sbi, et, en);
}
/*
* if original extent is split into zero or two parts, extent
......
......@@ -492,6 +492,13 @@ static inline bool __is_front_mergeable(struct extent_info *cur,
return __is_extent_mergeable(cur, front);
}
static inline void __try_update_largest_extent(struct extent_tree *et,
struct extent_node *en)
{
if (en->ei.len > et->largest.len)
et->largest = en->ei;
}
struct f2fs_nm_info {
block_t nat_blkaddr; /* base disk address of NAT */
nid_t max_nid; /* maximum possible node ids */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment