@@ -881,7 +881,8 @@ static unsigned long long __calculate_block_age(unsigned long long new,
881881}
882882
883883/* This returns a new age and allocated blocks in ei */
884- static int __get_new_block_age (struct inode * inode , struct extent_info * ei )
884+ static int __get_new_block_age (struct inode * inode , struct extent_info * ei ,
885+ block_t blkaddr )
885886{
886887 struct f2fs_sb_info * sbi = F2FS_I_SB (inode );
887888 loff_t f_size = i_size_read (inode );
@@ -894,7 +895,7 @@ static int __get_new_block_age(struct inode *inode, struct extent_info *ei)
894895 * block here.
895896 */
896897 if ((f_size >> PAGE_SHIFT ) == ei -> fofs && f_size & (PAGE_SIZE - 1 ) &&
897- ei -> blk == NEW_ADDR )
898+ blkaddr == NEW_ADDR )
898899 return - EINVAL ;
899900
900901 if (__lookup_extent_tree (inode , ei -> fofs , ei , EX_BLOCK_AGE )) {
@@ -915,14 +916,14 @@ static int __get_new_block_age(struct inode *inode, struct extent_info *ei)
915916 return 0 ;
916917 }
917918
918- f2fs_bug_on (sbi , ei -> blk == NULL_ADDR );
919+ f2fs_bug_on (sbi , blkaddr == NULL_ADDR );
919920
920921 /* the data block was allocated for the first time */
921- if (ei -> blk == NEW_ADDR )
922+ if (blkaddr == NEW_ADDR )
922923 goto out ;
923924
924- if (__is_valid_data_blkaddr (ei -> blk ) &&
925- !f2fs_is_valid_blkaddr (sbi , ei -> blk , DATA_GENERIC_ENHANCE )) {
925+ if (__is_valid_data_blkaddr (blkaddr ) &&
926+ !f2fs_is_valid_blkaddr (sbi , blkaddr , DATA_GENERIC_ENHANCE )) {
926927 f2fs_bug_on (sbi , 1 );
927928 return - EINVAL ;
928929 }
@@ -953,8 +954,7 @@ static void __update_extent_cache(struct dnode_of_data *dn, enum extent_type typ
953954 else
954955 ei .blk = dn -> data_blkaddr ;
955956 } else if (type == EX_BLOCK_AGE ) {
956- ei .blk = dn -> data_blkaddr ;
957- if (__get_new_block_age (dn -> inode , & ei ))
957+ if (__get_new_block_age (dn -> inode , & ei , dn -> data_blkaddr ))
958958 return ;
959959 }
960960 __update_extent_tree_range (dn -> inode , & ei , type );
0 commit comments