Hi, On Fri, Oct 03, 2008 at 05:59:04PM -0400, Theodore Ts'o wrote: > From: Mark Fasheh <mfasheh@xxxxxxxx> > > Basic vfs-level fiemap infrastructure, which sets up a new ->fiemap > inode operation. > [snip] > +/** > + * fiemap_fill_next_extent - Fiemap helper function > + * @fieinfo: Fiemap context passed into ->fiemap > + * @logical: Extent logical start offset, in bytes > + * @phys: Extent physical start offset, in bytes > + * @len: Extent length, in bytes > + * @flags: FIEMAP_EXTENT flags that describe this extent > + * > + * Called from file system ->fiemap callback. Will populate extent > + * info as passed in via arguments and copy to user memory. On > + * success, extent count on fieinfo is incremented. > + * > + * Returns 0 on success, -errno on error, 1 if this was the last > + * extent that will fit in user array. > + */ > +#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC) > +#define SET_NO_MOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED) > +#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE) > +int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, > + u64 phys, u64 len, u32 flags) > +{ > + struct fiemap_extent extent; > + struct fiemap_extent *dest = fieinfo->fi_extents_start; > + > + /* only count the extents */ > + if (fieinfo->fi_extents_max == 0) { > + fieinfo->fi_extents_mapped++; > + return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; > + } > + > + if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max) > + return 1; > + > + if (flags & SET_UNKNOWN_FLAGS) > + flags |= FIEMAP_EXTENT_UNKNOWN; > + if (flags & SET_NO_MOUNTED_IO_FLAGS) > + flags |= FIEMAP_EXTENT_NO_MOUNTED_IO; > + if (flags & SET_NOT_ALIGNED_FLAGS) > + flags |= FIEMAP_EXTENT_NOT_ALIGNED; > + > + memset(extent, 0, sizeof(extent)); The above ^^^^^^ fails to compile due to a missing & Steve. -- 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