• Zheng Liu's avatar
    ext4: introduce lseek SEEK_DATA/SEEK_HOLE support · c8c0df24
    Zheng Liu authored
    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: default avatarJie Liu <jeff.liu@oracle.com>
    Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    c8c0df24
file.c 16.5 KB