diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2009-01-21 22:39:14 +0300 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-01-21 22:39:14 +0300 |
commit | 1506fcc8189cdd4b95e06df7845a09f18b4526a6 (patch) | |
tree | bf737082390c26c517d7449135045e3f6d4ba055 /fs/btrfs/inode.c | |
parent | 35054394c4b3cecd52577c2662c84da1f3e73525 (diff) | |
download | linux-1506fcc8189cdd4b95e06df7845a09f18b4526a6.tar.xz |
Btrfs: fiemap support
Now that bmap support is gone, this is the only way to get extent
mappings for userland. These are still not valid for IO, but they
can tell us if a file has holes or how much fragmentation there is.
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2e25d698bab0..288c2cdc7543 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4156,6 +4156,12 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, return -EINVAL; } +static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, + __u64 start, __u64 len) +{ + return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); +} + int btrfs_readpage(struct file *file, struct page *page) { struct extent_io_tree *tree; @@ -5021,6 +5027,7 @@ static struct inode_operations btrfs_file_inode_operations = { .removexattr = btrfs_removexattr, .permission = btrfs_permission, .fallocate = btrfs_fallocate, + .fiemap = btrfs_fiemap, }; static struct inode_operations btrfs_special_inode_operations = { .getattr = btrfs_getattr, |