diff options
author | Josef Bacik <jbacik@redhat.com> | 2008-10-03 23:32:43 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-10-03 23:32:43 +0200 |
commit | 68c9d702bb72f367f3b148963ec6cf5e07ff7f65 (patch) | |
tree | 16fc61a1bd973c14a7858ab1fbcb306d3ae75184 /fs/ext3/inode.c | |
parent | ocfs2: fiemap support (diff) | |
download | linux-68c9d702bb72f367f3b148963ec6cf5e07ff7f65.tar.xz linux-68c9d702bb72f367f3b148963ec6cf5e07ff7f65.zip |
generic block based fiemap implementation
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. This works well for block based filesystems that will map
multiple contiguous blocks at one time, but will work for filesystems that
only map one block at a time, you will just end up with an "extent" for each
block. One gotcha is this will not play nicely where there is hole+data
after the EOF. This function will assume its hit the end of the data as soon
as it hits a hole after the EOF, so if there is any data past that it will
not pick that up. AFAIK no block based fs does this anyway, but its in the
comments of the function anyway just in case.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r-- | fs/ext3/inode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 507d8689b111..ebfec4d0148e 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -36,6 +36,7 @@ #include <linux/mpage.h> #include <linux/uio.h> #include <linux/bio.h> +#include <linux/fiemap.h> #include "xattr.h" #include "acl.h" @@ -981,6 +982,13 @@ out: return ret; } +int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, + u64 start, u64 len) +{ + return generic_block_fiemap(inode, fieinfo, start, len, + ext3_get_block); +} + /* * `handle' can be NULL if create is zero */ |