diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-03-20 11:08:29 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-03-27 23:09:32 -0400 |
commit | df033caf51c01edf3d2bfc61b41a9f1e566743ed (patch) | |
tree | 2cb6bf6d09b90fc21649e2a5a82ee0a1a9829281 | |
parent | 0833721ec3658a4e9d5e58b6fa82cf9edc431e59 (diff) |
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>
-rw-r--r-- | fs/f2fs/file.c | 3 | ||||
-rw-r--r-- | fs/f2fs/node.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ee88058acd63..8068b015ece5 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -573,7 +573,6 @@ truncate_out: | |||
573 | int truncate_blocks(struct inode *inode, u64 from, bool lock) | 573 | int truncate_blocks(struct inode *inode, u64 from, bool lock) |
574 | { | 574 | { |
575 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); | 575 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); |
576 | unsigned int blocksize = inode->i_sb->s_blocksize; | ||
577 | struct dnode_of_data dn; | 576 | struct dnode_of_data dn; |
578 | pgoff_t free_from; | 577 | pgoff_t free_from; |
579 | int count = 0, err = 0; | 578 | int count = 0, err = 0; |
@@ -582,7 +581,7 @@ int truncate_blocks(struct inode *inode, u64 from, bool lock) | |||
582 | 581 | ||
583 | trace_f2fs_truncate_blocks_enter(inode, from); | 582 | trace_f2fs_truncate_blocks_enter(inode, from); |
584 | 583 | ||
585 | free_from = (pgoff_t)F2FS_BYTES_TO_BLK(from + blocksize - 1); | 584 | free_from = (pgoff_t)F2FS_BLK_ALIGN(from); |
586 | 585 | ||
587 | if (free_from >= sbi->max_file_blocks) | 586 | if (free_from >= sbi->max_file_blocks) |
588 | goto free_partial; | 587 | goto free_partial; |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index f7886b46478d..ecfc2465da9b 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -2581,8 +2581,7 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) | |||
2581 | if (!enabled_nat_bits(sbi, NULL)) | 2581 | if (!enabled_nat_bits(sbi, NULL)) |
2582 | return 0; | 2582 | return 0; |
2583 | 2583 | ||
2584 | nm_i->nat_bits_blocks = F2FS_BYTES_TO_BLK((nat_bits_bytes << 1) + 8 + | 2584 | nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); |
2585 | F2FS_BLKSIZE - 1); | ||
2586 | nm_i->nat_bits = f2fs_kzalloc(sbi, | 2585 | nm_i->nat_bits = f2fs_kzalloc(sbi, |
2587 | nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); | 2586 | nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); |
2588 | if (!nm_i->nat_bits) | 2587 | if (!nm_i->nat_bits) |