btrfs: use the flags of an extent map to identify the compression type
[linux-2.6-microblaze.git] / fs / btrfs / file.c
index 7a71720..98ef859 100644 (file)
@@ -2150,7 +2150,6 @@ out:
                hole_em->block_start = EXTENT_MAP_HOLE;
                hole_em->block_len = 0;
                hole_em->orig_block_len = 0;
-               hole_em->compress_type = BTRFS_COMPRESS_NONE;
                hole_em->generation = trans->transid;
 
                ret = btrfs_replace_extent_map_range(inode, hole_em, true);
@@ -2839,7 +2838,7 @@ static int btrfs_zero_range_check_range_boundary(struct btrfs_inode *inode,
 
        if (em->block_start == EXTENT_MAP_HOLE)
                ret = RANGE_BOUNDARY_HOLE;
-       else if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
+       else if (em->flags & EXTENT_FLAG_PREALLOC)
                ret = RANGE_BOUNDARY_PREALLOC_EXTENT;
        else
                ret = RANGE_BOUNDARY_WRITTEN_EXTENT;
@@ -2879,8 +2878,7 @@ static int btrfs_zero_range(struct inode *inode,
         * extents and holes, we drop all the existing extents and allocate a
         * new prealloc extent, so that we get a larger contiguous disk extent.
         */
-       if (em->start <= alloc_start &&
-           test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
+       if (em->start <= alloc_start && (em->flags & EXTENT_FLAG_PREALLOC)) {
                const u64 em_end = em->start + em->len;
 
                if (em_end >= offset + len) {
@@ -2915,7 +2913,7 @@ static int btrfs_zero_range(struct inode *inode,
                        goto out;
                }
 
-               if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
+               if (em->flags & EXTENT_FLAG_PREALLOC) {
                        free_extent_map(em);
                        ret = btrfs_fallocate_update_isize(inode, offset + len,
                                                           mode);
@@ -3136,7 +3134,7 @@ static long btrfs_fallocate(struct file *file, int mode,
                last_byte = ALIGN(last_byte, blocksize);
                if (em->block_start == EXTENT_MAP_HOLE ||
                    (cur_offset >= inode->i_size &&
-                    !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) {
+                    !(em->flags & EXTENT_FLAG_PREALLOC))) {
                        const u64 range_len = last_byte - cur_offset;
 
                        ret = add_falloc_range(&reserve_list, cur_offset, range_len);