> +int fiemap_fill_kernel_extent(struct fiemap_extent_info *fieinfo, u64 logical, > + u64 phys, u64 len, u32 flags) Any reason this function isn't in inode.c next to the caller and marked static? Otherwise looks fine except for the additional sanity checking pointed out by Darrick. > + /* only count the extents */ > + if (fieinfo->fi_extents_max == 0) { > + fieinfo->fi_extents_mapped++; > + return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; Maybe do a 'goto out' here? > + return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; And reuse this return. Bonus points for using a good old if here: if (flags & FIEMAP_EXTENT_LAST) return 1; return 0;