diff options
author | Gao Xiang <hsiangkao@linux.alibaba.com> | 2021-08-13 07:29:31 +0200 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2021-08-18 18:13:43 +0200 |
commit | eadcd6b5a1eb39866ab8d8a3e4f2e51bc51a2350 (patch) | |
tree | 6675343c98541503c6fbfd91d8ced4cec1ead430 /fs/erofs/data.c | |
parent | erofs: add support for the full decompressed length (diff) | |
download | linux-eadcd6b5a1eb39866ab8d8a3e4f2e51bc51a2350.tar.xz linux-eadcd6b5a1eb39866ab8d8a3e4f2e51bc51a2350.zip |
erofs: add fiemap support with iomap
This adds fiemap support for both uncompressed files and compressed
files by using iomap infrastructure.
Link: https://lore.kernel.org/r/20210813052931.203280-3-hsiangkao@linux.alibaba.com
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/data.c')
-rw-r--r-- | fs/erofs/data.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/erofs/data.c b/fs/erofs/data.c index b2a22aabc9bc..09c46fbdb9b2 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -5,7 +5,6 @@ */ #include "internal.h" #include <linux/prefetch.h> -#include <linux/iomap.h> #include <linux/dax.h> #include <trace/events/erofs.h> @@ -152,6 +151,20 @@ static const struct iomap_ops erofs_iomap_ops = { .iomap_end = erofs_iomap_end, }; +int erofs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, + u64 start, u64 len) +{ + if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) { +#ifdef CONFIG_EROFS_FS_ZIP + return iomap_fiemap(inode, fieinfo, start, len, + &z_erofs_iomap_report_ops); +#else + return -EOPNOTSUPP; +#endif + } + return iomap_fiemap(inode, fieinfo, start, len, &erofs_iomap_ops); +} + /* * since we dont have write or truncate flows, so no inode * locking needs to be held at the moment. |