|
@@ -1686,18 +1686,20 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
|
|
|
sbi->total_valid_block_count -= diff;
|
|
|
if (!*count) {
|
|
|
spin_unlock(&sbi->stat_lock);
|
|
|
- percpu_counter_sub(&sbi->alloc_valid_block_count, diff);
|
|
|
goto enospc;
|
|
|
}
|
|
|
}
|
|
|
spin_unlock(&sbi->stat_lock);
|
|
|
|
|
|
- if (unlikely(release))
|
|
|
+ if (unlikely(release)) {
|
|
|
+ percpu_counter_sub(&sbi->alloc_valid_block_count, release);
|
|
|
dquot_release_reservation_block(inode, release);
|
|
|
+ }
|
|
|
f2fs_i_blocks_write(inode, *count, true, true);
|
|
|
return 0;
|
|
|
|
|
|
enospc:
|
|
|
+ percpu_counter_sub(&sbi->alloc_valid_block_count, release);
|
|
|
dquot_release_reservation_block(inode, release);
|
|
|
return -ENOSPC;
|
|
|
}
|