diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-08-29 13:57:21 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:16:34 -0400 |
commit | 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc (patch) | |
tree | edc2b57493ccebe4dc4ad48daf03a2ac25f24a10 /fs/btrfs/tests | |
parent | b12d6869f67a95692017d26313ea5736d4043d0f (diff) | |
download | linux-77cef2ec5484564eca6bd12a2b4a1e88fd766fbc.tar.bz2 |
Btrfs: allow partial ordered extent completion
We currently have this problem where you can truncate pages that have not yet
been written for an ordered extent. We do this because the truncate will be
coming behind to clean us up anyway so what's the harm right? Well if truncate
fails for whatever reason we leave an orphan item around for the file to be
cleaned up later. But if the user goes and truncates up the file and tries to
read from the area that had been discarded previously they will get a csum error
because we never actually wrote that data out.
This patch fixes this by allowing us to either discard the ordered extent
completely, by which I mean we just free up the space we had allocated and not
add the file extent, or adjust the length of the file extent we write. We do
this by setting the length we truncated down to in the ordered extent, and then
we set the file extent length and ram bytes to this length. The total disk
space stays unchanged since we may be compressed and we can't just chop off the
disk space, but at least this way the file extent only points to the valid data.
Then when the file extent is free'd the extent and csums will be freed normally.
This patch is needed for the next series which will give us more graceful
recovery of failed truncates. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/tests')
0 files changed, 0 insertions, 0 deletions