]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/segment.c
f2fs: don't need to collect dirty sit entries and flush journal when there's no dirty...
[karo-tx-linux.git] / fs / f2fs / segment.c
index daee4ab913daf2bcd2883aeee28ff2e8975d02bd..1e909340842a62383727e2e17e081ada6278a2c7 100644 (file)
@@ -277,6 +277,9 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi)
 
 void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi)
 {
+       /* try to shrink extent cache when there is no enough memory */
+       f2fs_shrink_extent_tree(sbi, EXTENT_CACHE_SHRINK_NUMBER);
+
        /* check the # of cached NAT entries and prefree segments */
        if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK) ||
                        excess_prefree_segs(sbi) ||
@@ -1730,6 +1733,9 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
        mutex_lock(&curseg->curseg_mutex);
        mutex_lock(&sit_i->sentry_lock);
 
+       if (!sit_i->dirty_sentries)
+               goto out;
+
        /*
         * add and account sit entries of dirty bitmap in sit entry
         * set temporarily
@@ -1744,9 +1750,6 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
        if (!__has_cursum_space(sum, sit_i->dirty_sentries, SIT_JOURNAL))
                remove_sits_in_journal(sbi);
 
-       if (!sit_i->dirty_sentries)
-               goto out;
-
        /*
         * there are two steps to flush sit entries:
         * #1, flush sit entries to journal in current cold data summary block.