aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r--fs/f2fs/gc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index e6b3ffd5ff6a..eb89037e3312 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -461,7 +461,7 @@ next_step:
461 * as indirect or double indirect node blocks, are given, it must be a caller's 461 * as indirect or double indirect node blocks, are given, it must be a caller's
462 * bug. 462 * bug.
463 */ 463 */
464block_t start_bidx_of_node(unsigned int node_ofs) 464block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
465{ 465{
466 unsigned int indirect_blks = 2 * NIDS_PER_BLOCK + 4; 466 unsigned int indirect_blks = 2 * NIDS_PER_BLOCK + 4;
467 unsigned int bidx; 467 unsigned int bidx;
@@ -478,7 +478,7 @@ block_t start_bidx_of_node(unsigned int node_ofs)
478 int dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); 478 int dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1);
479 bidx = node_ofs - 5 - dec; 479 bidx = node_ofs - 5 - dec;
480 } 480 }
481 return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE; 481 return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
482} 482}
483 483
484static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, 484static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
@@ -586,7 +586,6 @@ next_step:
586 continue; 586 continue;
587 } 587 }
588 588
589 start_bidx = start_bidx_of_node(nofs);
590 ofs_in_node = le16_to_cpu(entry->ofs_in_node); 589 ofs_in_node = le16_to_cpu(entry->ofs_in_node);
591 590
592 if (phase == 2) { 591 if (phase == 2) {
@@ -594,6 +593,8 @@ next_step:
594 if (IS_ERR(inode)) 593 if (IS_ERR(inode))
595 continue; 594 continue;
596 595
596 start_bidx = start_bidx_of_node(nofs, F2FS_I(inode));
597
597 data_page = find_data_page(inode, 598 data_page = find_data_page(inode,
598 start_bidx + ofs_in_node, false); 599 start_bidx + ofs_in_node, false);
599 if (IS_ERR(data_page)) 600 if (IS_ERR(data_page))
@@ -604,6 +605,8 @@ next_step:
604 } else { 605 } else {
605 inode = find_gc_inode(dni.ino, ilist); 606 inode = find_gc_inode(dni.ino, ilist);
606 if (inode) { 607 if (inode) {
608 start_bidx = start_bidx_of_node(nofs,
609 F2FS_I(inode));
607 data_page = get_lock_data_page(inode, 610 data_page = get_lock_data_page(inode,
608 start_bidx + ofs_in_node); 611 start_bidx + ofs_in_node);
609 if (IS_ERR(data_page)) 612 if (IS_ERR(data_page))