aboutsummaryrefslogtreecommitdiff
path: root/fs/iomap.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher2017-06-29 11:43:20 -0700
committerDarrick J. Wong2017-07-02 22:46:13 -0700
commit334fd34d76f237c0ee58dfc400d2c4e34d660544 (patch)
tree66f3e447de5bc9efc02a7366145ba7730ed49c62 /fs/iomap.c
parent7175a11214f02e6184690c17cf5366012b667531 (diff)
vfs: Add page_cache_seek_hole_data helper
Both ext4 and xfs implement seeking for the next hole or piece of data in unwritten extents by scanning the page cache, and both versions share the same bug when iterating the buffers of a page: the start offset into the page isn't taken into account, so when a page fits more than two filesystem blocks, things will go wrong. For example, on a filesystem with a block size of 1k, the following command will fail: xfs_io -f -c "falloc 0 4k" \ -c "pwrite 1k 1k" \ -c "pwrite 3k 1k" \ -c "seek -a -r 0" foo In this example, neither lseek(fd, 1024, SEEK_HOLE) nor lseek(fd, 2048, SEEK_DATA) will return the correct result. Introduce a generic vfs helper for seeking in the page cache that gets this right. The next commits will replace the filesystem specific implementations. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> [hch: dropped the export] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/iomap.c')
0 files changed, 0 insertions, 0 deletions