diff options
author | Chandan Rajendra <chandan@linux.vnet.ibm.com> | 2016-04-04 02:53:06 +0530 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-04-28 10:41:47 +0200 |
commit | a2af23b7d7cb0de89570e97da84f6fb642e990a4 (patch) | |
tree | 532456ad565847ddd9d1369709efe83bcbd01712 /fs/btrfs/file.c | |
parent | 894b36e35ae01186b77b083f3f67569a349062a6 (diff) | |
download | blackbird-op-linux-a2af23b7d7cb0de89570e97da84f6fb642e990a4.tar.gz blackbird-op-linux-a2af23b7d7cb0de89570e97da84f6fb642e990a4.zip |
Btrfs: __btrfs_buffered_write: Pass valid file offset when releasing delalloc space
The delalloc reserved space is calculated in terms of number of bytes
used by an integral number of blocks. This is done by rounding down the
value of 'pos' to the nearest multiple of sectorsize.
The file offset value held by 'pos' variable may not be aligned to
sectorsize and hence when passing it as an argument to
btrfs_delalloc_release_space(), we may end up releasing larger delalloc
space than we originally had reserved.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 751daacd268d..af059c44684d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1696,7 +1696,9 @@ again: btrfs_end_write_no_snapshoting(root); btrfs_delalloc_release_metadata(inode, release_bytes); } else { - btrfs_delalloc_release_space(inode, pos, release_bytes); + btrfs_delalloc_release_space(inode, + round_down(pos, root->sectorsize), + release_bytes); } } |