]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: more efficient SEEK_DATA implementation
authorJan Kara <jack@suse.cz>
Thu, 10 Mar 2016 04:11:13 +0000 (23:11 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 10 Mar 2016 04:11:13 +0000 (23:11 -0500)
commitc76e03c0dfa1d918cee111d9309e1a1c85d3c930
tree883dc6e8433bbe315fa8fce00154d51ac52b3dd7
parent15dc01af203f2d18913611a2e45d3829098b3294
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>
fs/ext4/ext4.h
fs/ext4/file.c
fs/ext4/inode.c