aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/checkpoint.c32
-rw-r--r--fs/f2fs/data.c2
-rw-r--r--fs/f2fs/debug.c2
-rw-r--r--fs/f2fs/dir.c8
-rw-r--r--fs/f2fs/f2fs.h25
-rw-r--r--fs/f2fs/hash.c3
-rw-r--r--fs/f2fs/node.c4
-rw-r--r--fs/f2fs/node.h2
-rw-r--r--fs/f2fs/recovery.c2
-rw-r--r--fs/f2fs/segment.c14
-rw-r--r--fs/f2fs/super.c8
-rw-r--r--include/linux/f2fs_fs.h6
12 files changed, 65 insertions, 43 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index ab743f92ee06..7c18f8efaadc 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -268,7 +268,7 @@ int recover_orphan_inodes(struct f2fs_sb_info *sbi)
268{ 268{
269 block_t start_blk, orphan_blkaddr, i, j; 269 block_t start_blk, orphan_blkaddr, i, j;
270 270
271 if (!(F2FS_CKPT(sbi)->ckpt_flags & CP_ORPHAN_PRESENT_FLAG)) 271 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
272 return 0; 272 return 0;
273 273
274 sbi->por_doing = 1; 274 sbi->por_doing = 1;
@@ -287,7 +287,7 @@ int recover_orphan_inodes(struct f2fs_sb_info *sbi)
287 f2fs_put_page(page, 1); 287 f2fs_put_page(page, 1);
288 } 288 }
289 /* clear Orphan Flag */ 289 /* clear Orphan Flag */
290 F2FS_CKPT(sbi)->ckpt_flags &= (~CP_ORPHAN_PRESENT_FLAG); 290 clear_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG);
291 sbi->por_doing = 0; 291 sbi->por_doing = 0;
292 return 0; 292 return 0;
293} 293}
@@ -376,7 +376,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
376 pre_version = le64_to_cpu(cp_block->checkpoint_ver); 376 pre_version = le64_to_cpu(cp_block->checkpoint_ver);
377 377
378 /* Read the 2nd cp block in this CP pack */ 378 /* Read the 2nd cp block in this CP pack */
379 cp_addr += le64_to_cpu(cp_block->cp_pack_total_block_count) - 1; 379 cp_addr += le32_to_cpu(cp_block->cp_pack_total_block_count) - 1;
380 cp_page_2 = get_meta_page(sbi, cp_addr); 380 cp_page_2 = get_meta_page(sbi, cp_addr);
381 381
382 cp_block = (struct f2fs_checkpoint *)page_address(cp_page_2); 382 cp_block = (struct f2fs_checkpoint *)page_address(cp_page_2);
@@ -605,8 +605,8 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
605 block_t start_blk; 605 block_t start_blk;
606 struct page *cp_page; 606 struct page *cp_page;
607 unsigned int data_sum_blocks, orphan_blocks; 607 unsigned int data_sum_blocks, orphan_blocks;
608 unsigned int crc32 = 0;
608 void *kaddr; 609 void *kaddr;
609 __u32 crc32 = 0;
610 int i; 610 int i;
611 611
612 /* Flush all the NAT/SIT pages */ 612 /* Flush all the NAT/SIT pages */
@@ -646,33 +646,35 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
646 /* 2 cp + n data seg summary + orphan inode blocks */ 646 /* 2 cp + n data seg summary + orphan inode blocks */
647 data_sum_blocks = npages_for_summary_flush(sbi); 647 data_sum_blocks = npages_for_summary_flush(sbi);
648 if (data_sum_blocks < 3) 648 if (data_sum_blocks < 3)
649 ckpt->ckpt_flags |= CP_COMPACT_SUM_FLAG; 649 set_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG);
650 else 650 else
651 ckpt->ckpt_flags &= (~CP_COMPACT_SUM_FLAG); 651 clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG);
652 652
653 orphan_blocks = (sbi->n_orphans + F2FS_ORPHANS_PER_BLOCK - 1) 653 orphan_blocks = (sbi->n_orphans + F2FS_ORPHANS_PER_BLOCK - 1)
654 / F2FS_ORPHANS_PER_BLOCK; 654 / F2FS_ORPHANS_PER_BLOCK;
655 ckpt->cp_pack_start_sum = 1 + orphan_blocks; 655 ckpt->cp_pack_start_sum = cpu_to_le32(1 + orphan_blocks);
656 ckpt->cp_pack_total_block_count = 2 + data_sum_blocks + orphan_blocks;
657 656
658 if (is_umount) { 657 if (is_umount) {
659 ckpt->ckpt_flags |= CP_UMOUNT_FLAG; 658 set_ckpt_flags(ckpt, CP_UMOUNT_FLAG);
660 ckpt->cp_pack_total_block_count += NR_CURSEG_NODE_TYPE; 659 ckpt->cp_pack_total_block_count = cpu_to_le32(2 +
660 data_sum_blocks + orphan_blocks + NR_CURSEG_NODE_TYPE);
661 } else { 661 } else {
662 ckpt->ckpt_flags &= (~CP_UMOUNT_FLAG); 662 clear_ckpt_flags(ckpt, CP_UMOUNT_FLAG);
663 ckpt->cp_pack_total_block_count = cpu_to_le32(2 +
664 data_sum_blocks + orphan_blocks);
663 } 665 }
664 666
665 if (sbi->n_orphans) 667 if (sbi->n_orphans)
666 ckpt->ckpt_flags |= CP_ORPHAN_PRESENT_FLAG; 668 set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
667 else 669 else
668 ckpt->ckpt_flags &= (~CP_ORPHAN_PRESENT_FLAG); 670 clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
669 671
670 /* update SIT/NAT bitmap */ 672 /* update SIT/NAT bitmap */
671 get_sit_bitmap(sbi, __bitmap_ptr(sbi, SIT_BITMAP)); 673 get_sit_bitmap(sbi, __bitmap_ptr(sbi, SIT_BITMAP));
672 get_nat_bitmap(sbi, __bitmap_ptr(sbi, NAT_BITMAP)); 674 get_nat_bitmap(sbi, __bitmap_ptr(sbi, NAT_BITMAP));
673 675
674 crc32 = f2fs_crc32(ckpt, le32_to_cpu(ckpt->checksum_offset)); 676 crc32 = f2fs_crc32(ckpt, le32_to_cpu(ckpt->checksum_offset));
675 *(__u32 *)((unsigned char *)ckpt + 677 *(__le32 *)((unsigned char *)ckpt +
676 le32_to_cpu(ckpt->checksum_offset)) 678 le32_to_cpu(ckpt->checksum_offset))
677 = cpu_to_le32(crc32); 679 = cpu_to_le32(crc32);
678 680
@@ -716,7 +718,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
716 sbi->alloc_valid_block_count = 0; 718 sbi->alloc_valid_block_count = 0;
717 719
718 /* Here, we only have one bio having CP pack */ 720 /* Here, we only have one bio having CP pack */
719 if (sbi->ckpt->ckpt_flags & CP_ERROR_FLAG) 721 if (is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))
720 sbi->sb->s_flags |= MS_RDONLY; 722 sbi->sb->s_flags |= MS_RDONLY;
721 else 723 else
722 sync_meta_pages(sbi, META_FLUSH, LONG_MAX); 724 sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c2fd0a80db16..5635cc5a9d4d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -545,7 +545,7 @@ redirty_out:
545 545
546#define MAX_DESIRED_PAGES_WP 4096 546#define MAX_DESIRED_PAGES_WP 4096
547 547
548int f2fs_write_data_pages(struct address_space *mapping, 548static int f2fs_write_data_pages(struct address_space *mapping,
549 struct writeback_control *wbc) 549 struct writeback_control *wbc)
550{ 550{
551 struct inode *inode = mapping->host; 551 struct inode *inode = mapping->host;
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index a56181c1b28b..fb62960a1dc1 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -27,7 +27,7 @@
27static LIST_HEAD(f2fs_stat_list); 27static LIST_HEAD(f2fs_stat_list);
28static struct dentry *debugfs_root; 28static struct dentry *debugfs_root;
29 29
30void update_general_status(struct f2fs_sb_info *sbi) 30static void update_general_status(struct f2fs_sb_info *sbi)
31{ 31{
32 struct f2fs_stat_info *si = sbi->stat_info; 32 struct f2fs_stat_info *si = sbi->stat_info;
33 int i; 33 int i;
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 5975568d03df..5ec7a06120e1 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -80,7 +80,7 @@ static bool early_match_name(const char *name, int namelen,
80 if (le16_to_cpu(de->name_len) != namelen) 80 if (le16_to_cpu(de->name_len) != namelen)
81 return false; 81 return false;
82 82
83 if (le32_to_cpu(de->hash_code) != namehash) 83 if (de->hash_code != namehash)
84 return false; 84 return false;
85 85
86 return true; 86 return true;
@@ -143,7 +143,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
143 nbucket = dir_buckets(level); 143 nbucket = dir_buckets(level);
144 nblock = bucket_blocks(level); 144 nblock = bucket_blocks(level);
145 145
146 bidx = dir_block_index(level, namehash % nbucket); 146 bidx = dir_block_index(level, le32_to_cpu(namehash) % nbucket);
147 end_block = bidx + nblock; 147 end_block = bidx + nblock;
148 148
149 for (; bidx < end_block; bidx++) { 149 for (; bidx < end_block; bidx++) {
@@ -406,7 +406,7 @@ start:
406 nbucket = dir_buckets(level); 406 nbucket = dir_buckets(level);
407 nblock = bucket_blocks(level); 407 nblock = bucket_blocks(level);
408 408
409 bidx = dir_block_index(level, (dentry_hash % nbucket)); 409 bidx = dir_block_index(level, (le32_to_cpu(dentry_hash) % nbucket));
410 410
411 for (block = bidx; block <= (bidx + nblock - 1); block++) { 411 for (block = bidx; block <= (bidx + nblock - 1); block++) {
412 mutex_lock_op(sbi, DENTRY_OPS); 412 mutex_lock_op(sbi, DENTRY_OPS);
@@ -437,7 +437,7 @@ add_dentry:
437 wait_on_page_writeback(dentry_page); 437 wait_on_page_writeback(dentry_page);
438 438
439 de = &dentry_blk->dentry[bit_pos]; 439 de = &dentry_blk->dentry[bit_pos];
440 de->hash_code = cpu_to_le32(dentry_hash); 440 de->hash_code = dentry_hash;
441 de->name_len = cpu_to_le16(namelen); 441 de->name_len = cpu_to_le16(namelen);
442 memcpy(dentry_blk->filename[bit_pos], name, namelen); 442 memcpy(dentry_blk->filename[bit_pos], name, namelen);
443 de->ino = cpu_to_le32(inode->i_ino); 443 de->ino = cpu_to_le32(inode->i_ino);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d3f5a70e2a49..8d7fde1bda1e 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -463,6 +463,26 @@ static inline void F2FS_RESET_SB_DIRT(struct f2fs_sb_info *sbi)
463 sbi->s_dirty = 0; 463 sbi->s_dirty = 0;
464} 464}
465 465
466static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
467{
468 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
469 return ckpt_flags & f;
470}
471
472static inline void set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
473{
474 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
475 ckpt_flags |= f;
476 cp->ckpt_flags = cpu_to_le32(ckpt_flags);
477}
478
479static inline void clear_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
480{
481 unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
482 ckpt_flags &= (~f);
483 cp->ckpt_flags = cpu_to_le32(ckpt_flags);
484}
485
466static inline void mutex_lock_op(struct f2fs_sb_info *sbi, enum lock_type t) 486static inline void mutex_lock_op(struct f2fs_sb_info *sbi, enum lock_type t)
467{ 487{
468 mutex_lock_nested(&sbi->fs_lock[t], t); 488 mutex_lock_nested(&sbi->fs_lock[t], t);
@@ -577,7 +597,8 @@ static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag)
577static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag) 597static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag)
578{ 598{
579 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); 599 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
580 int offset = (flag == NAT_BITMAP) ? ckpt->sit_ver_bitmap_bytesize : 0; 600 int offset = (flag == NAT_BITMAP) ?
601 le32_to_cpu(ckpt->sit_ver_bitmap_bytesize) : 0;
581 return &ckpt->sit_nat_version_bitmap + offset; 602 return &ckpt->sit_nat_version_bitmap + offset;
582} 603}
583 604
@@ -587,7 +608,7 @@ static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi)
587 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); 608 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
588 unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver); 609 unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver);
589 610
590 start_addr = le64_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr); 611 start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
591 612
592 /* 613 /*
593 * odd numbered checkpoint should at cp segment 0 614 * odd numbered checkpoint should at cp segment 0
diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c
index 098a1963d7c7..beb155e8d06d 100644
--- a/fs/f2fs/hash.c
+++ b/fs/f2fs/hash.c
@@ -92,7 +92,6 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, int len)
92 hash = buf[0]; 92 hash = buf[0];
93 minor_hash = buf[1]; 93 minor_hash = buf[1];
94 94
95 f2fs_hash = hash; 95 f2fs_hash = cpu_to_le32(hash & ~F2FS_HASH_COL_BIT);
96 f2fs_hash &= ~F2FS_HASH_COL_BIT;
97 return f2fs_hash; 96 return f2fs_hash;
98} 97}
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 216f04dc1177..5d421fe22575 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1445,8 +1445,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
1445 1445
1446 memcpy(dst, src, (unsigned long)&src->i.i_ext - (unsigned long)&src->i); 1446 memcpy(dst, src, (unsigned long)&src->i.i_ext - (unsigned long)&src->i);
1447 dst->i.i_size = 0; 1447 dst->i.i_size = 0;
1448 dst->i.i_blocks = 1; 1448 dst->i.i_blocks = cpu_to_le64(1);
1449 dst->i.i_links = 1; 1449 dst->i.i_links = cpu_to_le32(1);
1450 dst->i.i_xattr_nid = 0; 1450 dst->i.i_xattr_nid = 0;
1451 1451
1452 new_ni = old_ni; 1452 new_ni = old_ni;
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 5d525ed312ba..0ab92d643052 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -177,7 +177,7 @@ static inline void fill_node_footer_blkaddr(struct page *page, block_t blkaddr)
177 void *kaddr = page_address(page); 177 void *kaddr = page_address(page);
178 struct f2fs_node *rn = (struct f2fs_node *)kaddr; 178 struct f2fs_node *rn = (struct f2fs_node *)kaddr;
179 rn->footer.cp_ver = ckpt->checkpoint_ver; 179 rn->footer.cp_ver = ckpt->checkpoint_ver;
180 rn->footer.next_blkaddr = blkaddr; 180 rn->footer.next_blkaddr = cpu_to_le32(blkaddr);
181} 181}
182 182
183static inline nid_t ino_of_node(struct page *node_page) 183static inline nid_t ino_of_node(struct page *node_page)
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 7a43df0b72c1..222a7bb92214 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -81,7 +81,7 @@ static int recover_inode(struct inode *inode, struct page *node_page)
81 struct f2fs_node *raw_node = (struct f2fs_node *)kaddr; 81 struct f2fs_node *raw_node = (struct f2fs_node *)kaddr;
82 struct f2fs_inode *raw_inode = &(raw_node->i); 82 struct f2fs_inode *raw_inode = &(raw_node->i);
83 83
84 inode->i_mode = le32_to_cpu(raw_inode->i_mode); 84 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
85 i_size_write(inode, le64_to_cpu(raw_inode->i_size)); 85 i_size_write(inode, le64_to_cpu(raw_inode->i_size));
86 inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime); 86 inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
87 inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime); 87 inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ed7c079cfc7f..d973c56e8bd6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -630,7 +630,7 @@ static void f2fs_end_io_write(struct bio *bio, int err)
630 SetPageError(page); 630 SetPageError(page);
631 if (page->mapping) 631 if (page->mapping)
632 set_bit(AS_EIO, &page->mapping->flags); 632 set_bit(AS_EIO, &page->mapping->flags);
633 p->sbi->ckpt->ckpt_flags |= CP_ERROR_FLAG; 633 set_ckpt_flags(p->sbi->ckpt, CP_ERROR_FLAG);
634 set_page_dirty(page); 634 set_page_dirty(page);
635 } 635 }
636 end_page_writeback(page); 636 end_page_writeback(page);
@@ -1067,7 +1067,7 @@ static int read_normal_summaries(struct f2fs_sb_info *sbi, int type)
1067 segno = le32_to_cpu(ckpt->cur_data_segno[type]); 1067 segno = le32_to_cpu(ckpt->cur_data_segno[type]);
1068 blk_off = le16_to_cpu(ckpt->cur_data_blkoff[type - 1068 blk_off = le16_to_cpu(ckpt->cur_data_blkoff[type -
1069 CURSEG_HOT_DATA]); 1069 CURSEG_HOT_DATA]);
1070 if (ckpt->ckpt_flags & CP_UMOUNT_FLAG) 1070 if (is_set_ckpt_flags(ckpt, CP_UMOUNT_FLAG))
1071 blk_addr = sum_blk_addr(sbi, NR_CURSEG_TYPE, type); 1071 blk_addr = sum_blk_addr(sbi, NR_CURSEG_TYPE, type);
1072 else 1072 else
1073 blk_addr = sum_blk_addr(sbi, NR_CURSEG_DATA_TYPE, type); 1073 blk_addr = sum_blk_addr(sbi, NR_CURSEG_DATA_TYPE, type);
@@ -1076,7 +1076,7 @@ static int read_normal_summaries(struct f2fs_sb_info *sbi, int type)
1076 CURSEG_HOT_NODE]); 1076 CURSEG_HOT_NODE]);
1077 blk_off = le16_to_cpu(ckpt->cur_node_blkoff[type - 1077 blk_off = le16_to_cpu(ckpt->cur_node_blkoff[type -
1078 CURSEG_HOT_NODE]); 1078 CURSEG_HOT_NODE]);
1079 if (ckpt->ckpt_flags & CP_UMOUNT_FLAG) 1079 if (is_set_ckpt_flags(ckpt, CP_UMOUNT_FLAG))
1080 blk_addr = sum_blk_addr(sbi, NR_CURSEG_NODE_TYPE, 1080 blk_addr = sum_blk_addr(sbi, NR_CURSEG_NODE_TYPE,
1081 type - CURSEG_HOT_NODE); 1081 type - CURSEG_HOT_NODE);
1082 else 1082 else
@@ -1087,7 +1087,7 @@ static int read_normal_summaries(struct f2fs_sb_info *sbi, int type)
1087 sum = (struct f2fs_summary_block *)page_address(new); 1087 sum = (struct f2fs_summary_block *)page_address(new);
1088 1088
1089 if (IS_NODESEG(type)) { 1089 if (IS_NODESEG(type)) {
1090 if (ckpt->ckpt_flags & CP_UMOUNT_FLAG) { 1090 if (is_set_ckpt_flags(ckpt, CP_UMOUNT_FLAG)) {
1091 struct f2fs_summary *ns = &sum->entries[0]; 1091 struct f2fs_summary *ns = &sum->entries[0];
1092 int i; 1092 int i;
1093 for (i = 0; i < sbi->blocks_per_seg; i++, ns++) { 1093 for (i = 0; i < sbi->blocks_per_seg; i++, ns++) {
@@ -1119,7 +1119,7 @@ static int restore_curseg_summaries(struct f2fs_sb_info *sbi)
1119{ 1119{
1120 int type = CURSEG_HOT_DATA; 1120 int type = CURSEG_HOT_DATA;
1121 1121
1122 if (sbi->ckpt->ckpt_flags & CP_COMPACT_SUM_FLAG) { 1122 if (is_set_ckpt_flags(F2FS_CKPT(sbi), CP_COMPACT_SUM_FLAG)) {
1123 /* restore for compacted data summary */ 1123 /* restore for compacted data summary */
1124 if (read_compacted_summaries(sbi)) 1124 if (read_compacted_summaries(sbi))
1125 return -EINVAL; 1125 return -EINVAL;
@@ -1208,7 +1208,7 @@ static void write_normal_summaries(struct f2fs_sb_info *sbi,
1208 1208
1209void write_data_summaries(struct f2fs_sb_info *sbi, block_t start_blk) 1209void write_data_summaries(struct f2fs_sb_info *sbi, block_t start_blk)
1210{ 1210{
1211 if (sbi->ckpt->ckpt_flags & CP_COMPACT_SUM_FLAG) 1211 if (is_set_ckpt_flags(F2FS_CKPT(sbi), CP_COMPACT_SUM_FLAG))
1212 write_compacted_summaries(sbi, start_blk); 1212 write_compacted_summaries(sbi, start_blk);
1213 else 1213 else
1214 write_normal_summaries(sbi, start_blk, CURSEG_HOT_DATA); 1214 write_normal_summaries(sbi, start_blk, CURSEG_HOT_DATA);
@@ -1216,7 +1216,7 @@ void write_data_summaries(struct f2fs_sb_info *sbi, block_t start_blk)
1216 1216
1217void write_node_summaries(struct f2fs_sb_info *sbi, block_t start_blk) 1217void write_node_summaries(struct f2fs_sb_info *sbi, block_t start_blk)
1218{ 1218{
1219 if (sbi->ckpt->ckpt_flags & CP_UMOUNT_FLAG) 1219 if (is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG))
1220 write_normal_summaries(sbi, start_blk, CURSEG_HOT_NODE); 1220 write_normal_summaries(sbi, start_blk, CURSEG_HOT_NODE);
1221 return; 1221 return;
1222} 1222}
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8661c93538af..878bf382f848 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -89,7 +89,7 @@ static void f2fs_i_callback(struct rcu_head *head)
89 kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode)); 89 kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode));
90} 90}
91 91
92void f2fs_destroy_inode(struct inode *inode) 92static void f2fs_destroy_inode(struct inode *inode)
93{ 93{
94 call_rcu(&inode->i_rcu, f2fs_i_callback); 94 call_rcu(&inode->i_rcu, f2fs_i_callback);
95} 95}
@@ -445,7 +445,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
445 if (sanity_check_raw_super(raw_super)) 445 if (sanity_check_raw_super(raw_super))
446 goto free_sb_buf; 446 goto free_sb_buf;
447 447
448 sb->s_maxbytes = max_file_size(raw_super->log_blocksize); 448 sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize));
449 sb->s_max_links = F2FS_LINK_MAX; 449 sb->s_max_links = F2FS_LINK_MAX;
450 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 450 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
451 451
@@ -527,7 +527,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
527 527
528 /* if there are nt orphan nodes free them */ 528 /* if there are nt orphan nodes free them */
529 err = -EINVAL; 529 err = -EINVAL;
530 if (!(sbi->ckpt->ckpt_flags & CP_UMOUNT_FLAG) && 530 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) &&
531 recover_orphan_inodes(sbi)) 531 recover_orphan_inodes(sbi))
532 goto free_node_inode; 532 goto free_node_inode;
533 533
@@ -547,7 +547,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
547 } 547 }
548 548
549 /* recover fsynced data */ 549 /* recover fsynced data */
550 if (!(sbi->ckpt->ckpt_flags & CP_UMOUNT_FLAG) && 550 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) &&
551 !test_opt(sbi, DISABLE_ROLL_FORWARD)) 551 !test_opt(sbi, DISABLE_ROLL_FORWARD))
552 recover_fsync_data(sbi); 552 recover_fsync_data(sbi);
553 553
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 1429ece7caab..c2fbbc35c1e6 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -272,8 +272,8 @@ struct f2fs_sit_block {
272 * ex) data_blkaddr = (block_t)(nodepage_start_address + ofs_in_node) 272 * ex) data_blkaddr = (block_t)(nodepage_start_address + ofs_in_node)
273 */ 273 */
274#define ENTRIES_IN_SUM 512 274#define ENTRIES_IN_SUM 512
275#define SUMMARY_SIZE (sizeof(struct f2fs_summary)) 275#define SUMMARY_SIZE (7) /* sizeof(struct summary) */
276#define SUM_FOOTER_SIZE (sizeof(struct summary_footer)) 276#define SUM_FOOTER_SIZE (5) /* sizeof(struct summary_footer) */
277#define SUM_ENTRY_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM) 277#define SUM_ENTRY_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM)
278 278
279/* a summary entry for a 4KB-sized block in a segment */ 279/* a summary entry for a 4KB-sized block in a segment */
@@ -297,7 +297,7 @@ struct summary_footer {
297 __u32 check_sum; /* summary checksum */ 297 __u32 check_sum; /* summary checksum */
298} __packed; 298} __packed;
299 299
300#define SUM_JOURNAL_SIZE (PAGE_CACHE_SIZE - SUM_FOOTER_SIZE -\ 300#define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
301 SUM_ENTRY_SIZE) 301 SUM_ENTRY_SIZE)
302#define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\ 302#define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
303 sizeof(struct nat_journal_entry)) 303 sizeof(struct nat_journal_entry))