diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2012-11-28 05:28:54 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-12-16 20:46:15 -0500 |
commit | 0ff6fabdb0a862b22df4dd75873578392478e64d (patch) | |
tree | cc9766f343a57433232b6cbc0aab8f04024850a8 /fs/btrfs | |
parent | 797f4277113bff142b6c64a55abaef64d7d67d5c (diff) |
Btrfs: fix off-by-one error of the reserved size of btrfs_allocate()
alloc_end is not the real end of the current extent, it is the start of the
next adjoining extent. So we needn't +1 when calculating the size the space
that is about to be reserved.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a43d0aef6ee1..8e3d6788d6dd 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2072,7 +2072,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
2072 | * Make sure we have enough space before we do the | 2072 | * Make sure we have enough space before we do the |
2073 | * allocation. | 2073 | * allocation. |
2074 | */ | 2074 | */ |
2075 | ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start + 1); | 2075 | ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start); |
2076 | if (ret) | 2076 | if (ret) |
2077 | return ret; | 2077 | return ret; |
2078 | 2078 | ||
@@ -2179,7 +2179,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
2179 | out: | 2179 | out: |
2180 | mutex_unlock(&inode->i_mutex); | 2180 | mutex_unlock(&inode->i_mutex); |
2181 | /* Let go of our reservation. */ | 2181 | /* Let go of our reservation. */ |
2182 | btrfs_free_reserved_data_space(inode, alloc_end - alloc_start + 1); | 2182 | btrfs_free_reserved_data_space(inode, alloc_end - alloc_start); |
2183 | return ret; | 2183 | return ret; |
2184 | } | 2184 | } |
2185 | 2185 | ||