summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/node.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 63252ff1e5c3..74992fd9c9b6 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -3179,7 +3179,7 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
struct f2fs_journal *journal = curseg->journal;
struct nat_entry_set *setvec[NAT_VEC_SIZE];
struct nat_entry_set *set, *tmp;
- unsigned int found;
+ unsigned int found, entry_count = 0;
nid_t set_idx = 0;
LIST_HEAD(sets);
int err = 0;
@@ -3219,6 +3219,18 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
MAX_NAT_JENTRIES(sbi, journal));
}
+ /*
+ * Readahead the current NAT block to prevent read requests from
+ * being issued and waited on one by one.
+ */
+ list_for_each_entry(set, &sets, set_list) {
+ entry_count += set->entry_cnt;
+ if (!enabled_nat_bits(sbi, cpc) &&
+ __has_cursum_space(sbi, journal,
+ entry_count, NAT_JOURNAL))
+ continue;
+ f2fs_ra_meta_pages(sbi, set->set, 1, META_NAT, true);
+ }
/* flush dirty nats in nat entry set */
list_for_each_entry_safe(set, tmp, &sets, set_list) {
err = __flush_nat_entry_set(sbi, set, cpc);