Skip to content

Commit 9b8cfca

Browse files
committed
Fix file size rebuild and i_blocks in file log replaying
1 parent e6d7c87 commit 9b8cfca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/nova/rebuild.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static void nova_rebuild_handle_write_entry(struct super_block *sb,
368368
nova_assign_write_entry(sb, sih, entry, entryc, false);
369369
}
370370

371-
if (entryc->trans_id >= sih->trans_id) {
371+
if (entryc->trans_id >= reb->trans_id) {
372372
nova_rebuild_file_time_and_size(sb, reb,
373373
entryc->mtime, entryc->mtime,
374374
entryc->size);
@@ -497,6 +497,8 @@ static int nova_rebuild_file_inode_tree(struct super_block *sb,
497497

498498
ret = nova_rebuild_inode_finish(sb, pi, sih, reb, curr_p);
499499
sih->i_blocks = sih->i_size >> data_bits;
500+
if (sih->i_size % (1 << data_bits) > 0)
501+
++sih->i_blocks;
500502

501503
out:
502504
// nova_print_inode_log_page(sb, inode);
@@ -845,6 +847,8 @@ int nova_restore_snapshot_table(struct super_block *sb, int just_init)
845847

846848
ret = nova_rebuild_inode_finish(sb, pi, sih, reb, curr_p);
847849
sih->i_blocks = sih->i_size >> data_bits;
850+
if (sih->i_size % (1 << data_bits) > 0)
851+
++sih->i_blocks;
848852

849853
out:
850854
// nova_print_inode_log_page(sb, inode);

0 commit comments

Comments
 (0)