Back in October 2014, I proposed an improvement to fiemap to accomodate very large sparse files. This was done because the existing blockmap-based code skips holes one block at a time, which is extremely slow when it comes to large holes. For example, doing fiemap on a 1PB file whose only byte exists at EOF can take an extremely long time. To recreate: dd if=/dev/zero of=/mnt/holey-P bs=1 count=1 seek=1P time filefrag -v /mnt/holey-P At that time, someone suggested I use the iomap interface proposed by Dave Chinner a long time ago, and so my patches never got off the ground (until now). Since then, Christoph apparently added the basics of iomap to exportfs.h. This patch set expands the use of the iomap infrastructure, which today is minimal, and limited to exportfs users. The first patch moves it from exportfs.h to its own iomap.h, and adds an iomap function to aops. The second patch adds a new __generic_iomap_fiemap interface to be used by file systems who want it. My original version of this function looked nearly identical to the blockmap version, so if people don't like my implementation, I can revert to that one. This one is smaller and simpler. The third patch introduces a new __gfs2_io_map to the GFS2 file system. To keep things simple, I omitted block allocations from this function for now. The fourth patch hooks the new function into GFS2's fiemap to take advantage of the new code. Signed-off-by: Bob Peterson <rpeterso@xxxxxxxxxx> --- Bob Peterson (4): VFS: move iomap infrastructure from exportfs.h, add iomap to aops VFS: Add new __generic_iomap_fiemap interface GFS2: Add function __gfs2_io_map GFS2: Use new iomap interface for fiemap fs/gfs2/aops.c | 3 + fs/gfs2/bmap.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++ fs/gfs2/bmap.h | 2 + fs/gfs2/inode.c | 3 +- fs/ioctl.c | 97 ++++++++++++++++++++++++++++ include/linux/exportfs.h | 16 +---- include/linux/fs.h | 10 +++ include/linux/iomap.h | 39 ++++++++++++ 8 files changed, 313 insertions(+), 17 deletions(-) create mode 100644 include/linux/iomap.h -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html