ext4: fix suboptimal seek_{data,hole} extents traversial
authorDmitry Monakhov <dmonakhov@openvz.org>
Tue, 2 Dec 2014 23:08:53 +0000 (18:08 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 2 Dec 2014 23:08:53 +0000 (18:08 -0500)
commit14516bb7bb6ffbd49f35389f9ece3b2045ba5815
tree23cbe197595d9dc8534dd1dbab7e1237fbb74226
parentd952d69e268f833c85c0bafee9f67f9dba85044b
ext4: fix suboptimal seek_{data,hole} extents traversial

It is ridiculous practice to scan inode block by block, this technique
applicable only for old indirect files. This takes significant amount
of time for really large files. Let's reuse ext4_fiemap which already
traverse inode-tree in most optimal meaner.

TESTCASE:
ftruncate64(fd, 0);
ftruncate64(fd, 1ULL << 40);
/* lseek will spin very long time */
lseek64(fd, 0, SEEK_DATA);
lseek64(fd, 0, SEEK_HOLE);

Original report: https://lkml.org/lkml/2014/10/16/620

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/file.c