]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/segment.c
Merge remote-tracking branch 'wireless-next/master'
[karo-tx-linux.git] / fs / f2fs / segment.c
index 3b203597c744faa6f2d34db1bd1806cb9cce699b..c9c276e5316931eb461f0c79ff49e4d91b5f6782 100644 (file)
@@ -78,10 +78,14 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
        if (dirty_type == DIRTY) {
                enum dirty_type t = DIRTY_HOT_DATA;
 
-               /* clear all the bitmaps */
-               for (; t <= DIRTY_COLD_NODE; t++)
-                       if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t]))
+               /* clear its dirty bitmap */
+               for (; t <= DIRTY_COLD_NODE; t++) {
+                       if (test_and_clear_bit(segno,
+                                               dirty_i->dirty_segmap[t])) {
                                dirty_i->nr_dirty[t]--;
+                               break;
+                       }
+               }
 
                if (get_valid_blocks(sbi, segno, sbi->segs_per_sec) == 0)
                        clear_bit(GET_SECNO(sbi, segno),
@@ -550,9 +554,8 @@ static void allocate_segment_by_default(struct f2fs_sb_info *sbi,
                change_curseg(sbi, type, true);
        else
                new_curseg(sbi, type, false);
-#ifdef CONFIG_F2FS_STAT_FS
-       sbi->segment_count[curseg->alloc_type]++;
-#endif
+
+       stat_inc_alloc_type(sbi, curseg);
 }
 
 void allocate_new_segments(struct f2fs_sb_info *sbi)
@@ -807,9 +810,8 @@ static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
 
        mutex_lock(&sit_i->sentry_lock);
        __refresh_next_blkoff(sbi, curseg);
-#ifdef CONFIG_F2FS_STAT_FS
-       sbi->block_count[curseg->alloc_type]++;
-#endif
+
+       stat_inc_alloc_type(sbi, curseg);
 
        /*
         * SIT information should be updated before segment allocation,
@@ -1277,9 +1279,9 @@ static bool flush_sits_in_journal(struct f2fs_sb_info *sbi)
                        __mark_sit_entry_dirty(sbi, segno);
                }
                update_sits_in_cursum(sum, -sits_in_cursum(sum));
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 /*