ext4: introduce lseek SEEK_DATA/SEEK_HOLE support
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 9 Nov 2012 02:57:40 +0000 (21:57 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 9 Nov 2012 02:57:40 +0000 (21:57 -0500)
commitc8c0df241cc2719b1262e627f999638411934f60
tree0961d5d82c43240e03951b2f1b942aad7cfbe7cb
parentb3aff3e3f61d13586fd46d1ee6f7353ab3050b6d
ext4: introduce lseek SEEK_DATA/SEEK_HOLE support

This patch makes ext4 really support SEEK_DATA/SEEK_HOLE flags.  Block-mapped
and extent-mapped files are fully implemented together because ext4_map_blocks
hides this differences.

After applying this patch, it will cause a failure in xfstest #285 when the file
is block-mapped due to block-mapped file isn't support fallocate(2).

I had tried to use ext4_ext_walk_space() to retrieve the offset for a
extent-mapped file.  But finally I decide to keep using ext4_map_blocks() to
support SEEK_DATA/SEEK_HOLE because ext4_map_blocks() can hide the difference
between block-mapped file and extent-mapped file.  Moreover, in next step,
extent status tree will track all extent status, and we can get all mappings
from this tree.  So I think that using ext4_map_blocks() is a better choice.

CC: Hugh Dickins <hughd@google.com>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/file.c