diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2012-11-29 00:08:26 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-12-16 20:46:16 -0500 |
commit | 05dadc09f52ad5a631da1aa8767c5b80e121f0c4 (patch) | |
tree | 291dd56862b5f58f5c64b01ec7797212206bf26c /fs/btrfs | |
parent | 01e6deb25ae11e7b85484bf5e550eb540c50c63e (diff) |
Btrfs: add fiemap's flag check
When the flag not supported is specified, it is necessary to return the error
to the caller.
So, we add the validity check of the fiemap's flag.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d7bf2e7ee8a0..a1761f01cf11 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -6595,9 +6595,17 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
6595 | btrfs_submit_direct, 0); | 6595 | btrfs_submit_direct, 0); |
6596 | } | 6596 | } |
6597 | 6597 | ||
6598 | #define BTRFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC) | ||
6599 | |||
6598 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 6600 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
6599 | __u64 start, __u64 len) | 6601 | __u64 start, __u64 len) |
6600 | { | 6602 | { |
6603 | int ret; | ||
6604 | |||
6605 | ret = fiemap_check_flags(fieinfo, BTRFS_FIEMAP_FLAGS); | ||
6606 | if (ret) | ||
6607 | return ret; | ||
6608 | |||
6601 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap); | 6609 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap); |
6602 | } | 6610 | } |
6603 | 6611 | ||