]> git.hungrycats.org Git - linux/commitdiff
Btrfs: don't set and clear delalloc for O_DIRECT writes
authorJosef Bacik <jbacik@fb.com>
Wed, 11 Feb 2015 20:08:58 +0000 (15:08 -0500)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 27 Feb 2015 05:33:45 +0000 (00:33 -0500)
We do this to get the space accounting, but this is just needless churn on the
io_tree, so just drop setting/clearing delalloc and just drop the reserved data
space when we have a successfull allocation.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 3266789f9d08b27275bae5ab1dcd27d1bbf15e79)

fs/btrfs/inode.c

index 6ed47888b960a82672b1eac027d3f9056dcc09aa..e14d2c8a1be98a22638b5ed94b1cf9caa4862414 100644 (file)
@@ -7099,7 +7099,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
        int ret = 0;
 
        if (create)
-               unlock_bits |= EXTENT_DELALLOC | EXTENT_DIRTY;
+               unlock_bits |= EXTENT_DIRTY;
        else
                len = min_t(u64, len, root->sectorsize);
 
@@ -7235,11 +7235,7 @@ unlock:
                        BTRFS_I(inode)->outstanding_extents++;
                        spin_unlock(&BTRFS_I(inode)->lock);
                }
-
-               ret = set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
-                                    lockstart + len - 1, EXTENT_DELALLOC, NULL,
-                                    &cached_state, GFP_NOFS);
-               BUG_ON(ret);
+               btrfs_free_reserved_data_space(inode, len);
        }
 
        /*