f2fs: clean up with F2FS_BLK_ALIGN
Clean up F2FS_BYTES_TO_BLK(x + F2FS_BLKSIZE - 1) with F2FS_BLK_ALIGN(x). Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
0833721ec3
commit
df033caf51
|
@ -573,7 +573,6 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
|
||||||
int truncate_blocks(struct inode *inode, u64 from, bool lock)
|
int truncate_blocks(struct inode *inode, u64 from, bool lock)
|
||||||
{
|
{
|
||||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||||
unsigned int blocksize = inode->i_sb->s_blocksize;
|
|
||||||
struct dnode_of_data dn;
|
struct dnode_of_data dn;
|
||||||
pgoff_t free_from;
|
pgoff_t free_from;
|
||||||
int count = 0, err = 0;
|
int count = 0, err = 0;
|
||||||
|
@ -582,7 +581,7 @@ int truncate_blocks(struct inode *inode, u64 from, bool lock)
|
||||||
|
|
||||||
trace_f2fs_truncate_blocks_enter(inode, from);
|
trace_f2fs_truncate_blocks_enter(inode, from);
|
||||||
|
|
||||||
free_from = (pgoff_t)F2FS_BYTES_TO_BLK(from + blocksize - 1);
|
free_from = (pgoff_t)F2FS_BLK_ALIGN(from);
|
||||||
|
|
||||||
if (free_from >= sbi->max_file_blocks)
|
if (free_from >= sbi->max_file_blocks)
|
||||||
goto free_partial;
|
goto free_partial;
|
||||||
|
|
|
@ -2581,8 +2581,7 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)
|
||||||
if (!enabled_nat_bits(sbi, NULL))
|
if (!enabled_nat_bits(sbi, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nm_i->nat_bits_blocks = F2FS_BYTES_TO_BLK((nat_bits_bytes << 1) + 8 +
|
nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8);
|
||||||
F2FS_BLKSIZE - 1);
|
|
||||||
nm_i->nat_bits = f2fs_kzalloc(sbi,
|
nm_i->nat_bits = f2fs_kzalloc(sbi,
|
||||||
nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL);
|
nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL);
|
||||||
if (!nm_i->nat_bits)
|
if (!nm_i->nat_bits)
|
||||||
|
|
Loading…
Reference in New Issue