mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
Btrfs: clean up btrfs_ordered_update_i_size
Since we have a good helper entry_end, use it for ordered extent. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> [ whitespace reformatting ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5416034f7a
commit
62c821a8e2
@ -1042,25 +1042,22 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
|
|||||||
/* We treat this entry as if it doesn't exist */
|
/* We treat this entry as if it doesn't exist */
|
||||||
if (test_bit(BTRFS_ORDERED_UPDATED_ISIZE, &test->flags))
|
if (test_bit(BTRFS_ORDERED_UPDATED_ISIZE, &test->flags))
|
||||||
continue;
|
continue;
|
||||||
if (test->file_offset + test->len <= disk_i_size)
|
|
||||||
|
if (entry_end(test) <= disk_i_size)
|
||||||
break;
|
break;
|
||||||
if (test->file_offset >= i_size)
|
if (test->file_offset >= i_size)
|
||||||
break;
|
break;
|
||||||
if (entry_end(test) > disk_i_size) {
|
|
||||||
/*
|
/*
|
||||||
* we don't update disk_i_size now, so record this
|
* We don't update disk_i_size now, so record this undealt
|
||||||
* undealt i_size. Or we will not know the real
|
* i_size. Or we will not know the real i_size.
|
||||||
* i_size.
|
*/
|
||||||
*/
|
if (test->outstanding_isize < offset)
|
||||||
if (test->outstanding_isize < offset)
|
test->outstanding_isize = offset;
|
||||||
test->outstanding_isize = offset;
|
if (ordered &&
|
||||||
if (ordered &&
|
ordered->outstanding_isize > test->outstanding_isize)
|
||||||
ordered->outstanding_isize >
|
test->outstanding_isize = ordered->outstanding_isize;
|
||||||
test->outstanding_isize)
|
goto out;
|
||||||
test->outstanding_isize =
|
|
||||||
ordered->outstanding_isize;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
new_i_size = min_t(u64, offset, i_size);
|
new_i_size = min_t(u64, offset, i_size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user