diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-06-17 18:40:37 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-07 12:34:30 -0800 |
commit | ae1da59e4ce94b09c9e28293e6d0526084121eef (patch) | |
tree | fa846610ed6a04de56ad49ac8e609f5b08d6f784 | |
parent | 66eff9266491dfb77f2fe6209554f11b592a155a (diff) |
bcachefs: more fiemap fixes
-rw-r--r-- | drivers/md/bcache/fs.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/md/bcache/fs.c b/drivers/md/bcache/fs.c index dbafaac01e35..7fe55b683c2f 100644 --- a/drivers/md/bcache/fs.c +++ b/drivers/md/bcache/fs.c @@ -718,16 +718,30 @@ static int bch_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) } static int bch_fill_extent(struct fiemap_extent_info *info, - struct bkey_i *k, int flags) + struct bkey_i *k, unsigned flags) { struct bkey_s_c_extent e = bkey_i_to_s_c_extent(k); const struct bch_extent_ptr *ptr; + const union bch_extent_crc *crc; + int ret; + + extent_for_each_ptr_crc(e, ptr, crc) { + int flags2 = 0; + u64 offset = ptr->offset; + + if (crc_to_64(crc).compression_type) + flags2 |= FIEMAP_EXTENT_ENCODED; + else + offset += crc_to_64(crc).offset; + + if ((offset & (PAGE_SECTORS - 1)) || + (e.k->size & (PAGE_SECTORS - 1))) + flags2 |= FIEMAP_EXTENT_NOT_ALIGNED; - extent_for_each_ptr(e, ptr) { - int ret = fiemap_fill_next_extent(info, + ret = fiemap_fill_next_extent(info, bkey_start_offset(e.k) << 9, - ptr->offset << 9, - e.k->size << 9, flags); + offset << 9, + e.k->size << 9, flags|flags2); if (ret) return ret; } |