On Saturday 24 May 2008, Mark Fasheh wrote: > From: Josef Bacik <jbacik@xxxxxxxxxx> > > Here is my updated generic block based fiemap implementation with the fixes > that Andreas suggested. Basically any block based fs (this patch includes > ext3) just has to declare its own fiemap() function and then call this > generic function with its own get_block_t. > > +int generic_block_fiemap(struct inode *inode, > + struct fiemap_extent_info *fieinfo, u64 start, > + u64 len, get_block_t *get_block) > +{ > + struct buffer_head tmp; [ ... ] > + do { > + /* > + * we set b_size to the total size we want so it will map as > + * many contiguous blocks as possible at once > + */ > + memset(&tmp, 0, sizeof(struct buffer_head)); > + tmp.b_size = map_len; > + > + ret = get_block(inode, start_blk, &tmp, 0); > + if (ret) > + break; > + > + /* HOLE */ > + if (!tmp.b_blocknr) { This should be if (!buffer_mapped(&tmp)). You can't be sure that filesystems returning a hole will use a b_blocknr of zero, and you can't be sure that a block number of zero is a hole. -chris -chris -- 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