提交 e21139c6 编写于 作者: Q Qu Wenruo 提交者: David Sterba

btrfs: cleanup calculation of lockend in lock_and_cleanup_extent_if_need()

We're just doing rounding up to sectorsize to calculate the lockend.
There is no need to do the unnecessary length calculation, just direct
round_up() is enough.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NQu Wenruo <wqu@suse.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 c4923027
...@@ -1477,9 +1477,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, ...@@ -1477,9 +1477,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
int ret = 0; int ret = 0;
start_pos = round_down(pos, fs_info->sectorsize); start_pos = round_down(pos, fs_info->sectorsize);
last_pos = start_pos last_pos = round_up(pos + write_bytes, fs_info->sectorsize) - 1;
+ round_up(pos + write_bytes - start_pos,
fs_info->sectorsize) - 1;
if (start_pos < inode->vfs_inode.i_size) { if (start_pos < inode->vfs_inode.i_size) {
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册