From: Chris Mason Date: Fri, 9 Dec 2016 01:55:03 +0000 (-0800) Subject: Revert "Btrfs: adjust len of writes if following a preallocated extent" X-Git-Tag: v4.10-rc1~68^2~2 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=7c4c71ac8a72aea595f4cc7e09c2bcc61929c4ac;p=linux.git Revert "Btrfs: adjust len of writes if following a preallocated extent" This is exposing an existing deadlock between fsync and AIO. Until we have the deadlock fixed, I'm pulling this one out. This reverts commit a23eaa875f0f1d89eb866b8c9860e78273ff5daf. Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index dbcec1ced85a..a713d9d324b0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7765,12 +7765,10 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, } /* - * this will cow the extent, if em is within [start, len], then - * probably we've found a preallocated/existing extent, let's - * give it a chance to use preallocated space. + * this will cow the extent, reset the len in case we changed + * it above */ - len = min_t(u64, bh_result->b_size, em->len - (start - em->start)); - len = ALIGN(len, fs_info->sectorsize); + len = bh_result->b_size; free_extent_map(em); em = btrfs_new_extent_direct(inode, start, len); if (IS_ERR(em)) {