diff options
author | Jan Kara <jack@suse.cz> | 2016-03-10 05:11:13 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-03-10 05:11:13 +0100 |
commit | 2d90c160e5f1d784e180f1e1458d56eee4d7f4f4 (patch) | |
tree | 883dc6e8433bbe315fa8fce00154d51ac52b3dd7 /fs/ext4/ext4.h | |
parent | ext4: cleanup handling of bh->b_state in DAX mmap (diff) | |
download | linux-2d90c160e5f1d784e180f1e1458d56eee4d7f4f4.tar.xz linux-2d90c160e5f1d784e180f1e1458d56eee4d7f4f4.zip |
ext4: more efficient SEEK_DATA implementation
Using SEEK_DATA in a huge sparse file can easily lead to sotflockups as
ext4_seek_data() iterates hole block-by-block. Fix the problem by using
returned hole size from ext4_map_blocks() and thus skip the hole in one
go.
Update also SEEK_HOLE implementation to follow the same pattern as
SEEK_DATA to make future maintenance easier.
Furthermore we add cond_resched() to both ext4_seek_data() and
ext4_seek_hole() to avoid softlockups in case evil user creates huge
fragmented file and we have to go through lots of extents.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 70b8e0409566..5623eec7fd22 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2546,6 +2546,9 @@ extern void ext4_da_update_reserve_space(struct inode *inode, int used, int quota_claim); extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk, ext4_lblk_t len); +extern int ext4_get_next_extent(struct inode *inode, ext4_lblk_t lblk, + unsigned int map_len, + struct extent_status *result); /* indirect.c */ extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, |