* bio we were passed and then call the bio end_io calls
  */
 void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
-                                 int mirror_num, unsigned long bio_flags)
+                                 int mirror_num)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        struct extent_map_tree *em_tree;
        em_len = em->len;
        em_start = em->start;
 
-       free_extent_map(em);
-       em = NULL;
-
        cb->len = bio->bi_iter.bi_size;
        cb->compressed_len = compressed_len;
-       cb->compress_type = extent_compress_type(bio_flags);
+       cb->compress_type = em->compress_type;
        cb->orig_bio = bio;
 
+       free_extent_map(em);
+       em = NULL;
+
        cb->nr_pages = DIV_ROUND_UP(compressed_len, PAGE_SIZE);
        cb->compressed_pages = kcalloc(cb->nr_pages, sizeof(struct page *), GFP_NOFS);
        if (!cb->compressed_pages) {
 
                                  struct cgroup_subsys_state *blkcg_css,
                                  bool writeback);
 void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
-                                 int mirror_num, unsigned long bio_flags);
+                                 int mirror_num);
 
 unsigned int btrfs_compress_str2level(unsigned int type, const char *str);
 
 
                         * the bio if there were any errors, so just return
                         * here.
                         */
-                       btrfs_submit_compressed_read(inode, bio, mirror_num,
-                                                    bio_flags);
+                       btrfs_submit_compressed_read(inode, bio, mirror_num);
                        return;
                } else {
                        /*