f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup
[linux-2.6-microblaze.git] / fs / f2fs / super.c
index b038028..78a7658 100644 (file)
@@ -3756,9 +3756,9 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
        sbi->segs_per_sec = le32_to_cpu(raw_super->segs_per_sec);
        sbi->secs_per_zone = le32_to_cpu(raw_super->secs_per_zone);
        sbi->total_sections = le32_to_cpu(raw_super->section_count);
-       sbi->total_node_count =
-               ((le32_to_cpu(raw_super->segment_count_nat) / 2) *
-               NAT_ENTRY_PER_BLOCK) << sbi->log_blocks_per_seg;
+       sbi->total_node_count = SEGS_TO_BLKS(sbi,
+                       ((le32_to_cpu(raw_super->segment_count_nat) / 2) *
+                       NAT_ENTRY_PER_BLOCK));
        F2FS_ROOT_INO(sbi) = le32_to_cpu(raw_super->root_ino);
        F2FS_NODE_INO(sbi) = le32_to_cpu(raw_super->node_ino);
        F2FS_META_INO(sbi) = le32_to_cpu(raw_super->meta_ino);
@@ -4200,14 +4200,14 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
                        if (i == 0) {
                                FDEV(i).start_blk = 0;
                                FDEV(i).end_blk = FDEV(i).start_blk +
-                                   (FDEV(i).total_segments <<
-                                   sbi->log_blocks_per_seg) - 1 +
-                                   le32_to_cpu(raw_super->segment0_blkaddr);
+                                       SEGS_TO_BLKS(sbi,
+                                       FDEV(i).total_segments) - 1 +
+                                       le32_to_cpu(raw_super->segment0_blkaddr);
                        } else {
                                FDEV(i).start_blk = FDEV(i - 1).end_blk + 1;
                                FDEV(i).end_blk = FDEV(i).start_blk +
-                                       (FDEV(i).total_segments <<
-                                       sbi->log_blocks_per_seg) - 1;
+                                               SEGS_TO_BLKS(sbi,
+                                               FDEV(i).total_segments) - 1;
                                FDEV(i).bdev_handle = bdev_open_by_path(
                                        FDEV(i).path, mode, sbi->sb, NULL);
                        }