hfsplus: prevent corruption in shrinking truncate
[linux-2.6-microblaze.git] / fs / f2fs / segment.h
index e9a7a63..050230c 100644 (file)
@@ -172,12 +172,10 @@ enum {
 /*
  * BG_GC means the background cleaning job.
  * FG_GC means the on-demand cleaning job.
- * FORCE_FG_GC means on-demand cleaning job in background.
  */
 enum {
        BG_GC = 0,
        FG_GC,
-       FORCE_FG_GC,
 };
 
 /* for a function parameter to select a victim segment */
@@ -361,8 +359,20 @@ static inline unsigned int get_valid_blocks(struct f2fs_sb_info *sbi,
 }
 
 static inline unsigned int get_ckpt_valid_blocks(struct f2fs_sb_info *sbi,
-                               unsigned int segno)
+                               unsigned int segno, bool use_section)
 {
+       if (use_section && __is_large_section(sbi)) {
+               unsigned int start_segno = START_SEGNO(segno);
+               unsigned int blocks = 0;
+               int i;
+
+               for (i = 0; i < sbi->segs_per_sec; i++, start_segno++) {
+                       struct seg_entry *se = get_seg_entry(sbi, start_segno);
+
+                       blocks += se->ckpt_valid_blocks;
+               }
+               return blocks;
+       }
        return get_seg_entry(sbi, segno)->ckpt_valid_blocks;
 }