ext4: Use clean_bdev_aliases() instead of iteration
Use clean_bdev_aliases() instead of iterating through blocks one by one. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
f734c89cc9
commit
64e1c57fa4
|
@ -3777,14 +3777,6 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmap_underlying_metadata_blocks(struct block_device *bdev,
|
|
||||||
sector_t block, int count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
unmap_underlying_metadata(bdev, block + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle EOFBLOCKS_FL flag, clearing it if necessary
|
* Handle EOFBLOCKS_FL flag, clearing it if necessary
|
||||||
*/
|
*/
|
||||||
|
@ -4121,9 +4113,8 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
|
||||||
* new.
|
* new.
|
||||||
*/
|
*/
|
||||||
if (allocated > map->m_len) {
|
if (allocated > map->m_len) {
|
||||||
unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
|
clean_bdev_aliases(inode->i_sb->s_bdev, newblock + map->m_len,
|
||||||
newblock + map->m_len,
|
allocated - map->m_len);
|
||||||
allocated - map->m_len);
|
|
||||||
allocated = map->m_len;
|
allocated = map->m_len;
|
||||||
}
|
}
|
||||||
map->m_len = allocated;
|
map->m_len = allocated;
|
||||||
|
|
|
@ -654,12 +654,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
|
||||||
if (flags & EXT4_GET_BLOCKS_ZERO &&
|
if (flags & EXT4_GET_BLOCKS_ZERO &&
|
||||||
map->m_flags & EXT4_MAP_MAPPED &&
|
map->m_flags & EXT4_MAP_MAPPED &&
|
||||||
map->m_flags & EXT4_MAP_NEW) {
|
map->m_flags & EXT4_MAP_NEW) {
|
||||||
ext4_lblk_t i;
|
clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
|
||||||
|
map->m_len);
|
||||||
for (i = 0; i < map->m_len; i++) {
|
|
||||||
unmap_underlying_metadata(inode->i_sb->s_bdev,
|
|
||||||
map->m_pblk + i);
|
|
||||||
}
|
|
||||||
ret = ext4_issue_zeroout(inode, map->m_lblk,
|
ret = ext4_issue_zeroout(inode, map->m_lblk,
|
||||||
map->m_pblk, map->m_len);
|
map->m_pblk, map->m_len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -2360,11 +2356,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
|
||||||
|
|
||||||
BUG_ON(map->m_len == 0);
|
BUG_ON(map->m_len == 0);
|
||||||
if (map->m_flags & EXT4_MAP_NEW) {
|
if (map->m_flags & EXT4_MAP_NEW) {
|
||||||
struct block_device *bdev = inode->i_sb->s_bdev;
|
clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
|
||||||
int i;
|
map->m_len);
|
||||||
|
|
||||||
for (i = 0; i < map->m_len; i++)
|
|
||||||
unmap_underlying_metadata(bdev, map->m_pblk + i);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue