summaryrefslogtreecommitdiff
path: root/fs/erofs/data.c
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2021-08-13 08:29:31 +0300
committerGao Xiang <hsiangkao@linux.alibaba.com>2021-08-18 19:13:43 +0300
commiteadcd6b5a1eb39866ab8d8a3e4f2e51bc51a2350 (patch)
tree6675343c98541503c6fbfd91d8ced4cec1ead430 /fs/erofs/data.c
parentd95ae5e25326092d61613acf98280270dde22778 (diff)
downloadlinux-eadcd6b5a1eb39866ab8d8a3e4f2e51bc51a2350.tar.xz
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.c15
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.