diff options
author | Liu Hui <onlyflyer@gmail.com> | 2009-01-05 15:57:51 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-01-05 15:57:51 -0500 |
commit | 1f3c79a28c8837e8572b98f6d14142d9a6133c56 (patch) | |
tree | 09c7a7c46186806ec1ecd34f03780ef15e397245 /fs/locks.c | |
parent | ec051c0f929afe5c42c24bb07abf577c616c208c (diff) |
Btrfs: Fix free block discard calls down to the block layer
This is a patch to fix discard semantic to make Btrfs work with FTL and SSD.
We can improve FTL's performance by telling it which sectors are freed by file
system. But if we don't tell FTL the information of free sectors in proper
time, the transaction mechanism of Btrfs will be destroyed and Btrfs could not
roll back the previous transaction under the power loss condition.
There are some problems in the old implementation:
1, In __free_extent(), the pinned down extents should not be discarded.
2, In free_extents(), the free extents are all pinned, so they need to
be discarded in transaction committing time instead of free_extents().
3, The reserved extent used by log tree should be discard too.
This patch change discard behavior as follows:
1, For the extents which need to be free at once,
we discard them in update_block_group().
2, Delay discarding the pinned extent in btrfs_finish_extent_commit()
when committing transaction.
3, Remove discarding from free_extents() and __free_extent()
4, Add discard interface into btrfs_free_reserved_extent()
5, Discard sectors before updating the free space cache, otherwise,
FTL will destroy file system data.
Diffstat (limited to 'fs/locks.c')
0 files changed, 0 insertions, 0 deletions