mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
Btrfs: update nodatacow code v2
This patch simplifies the nodatacow checker. If all references were created after the latest snapshot, then we can avoid COW safely. This patch also updates run_delalloc_nocow to do more fine-grained checking. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
This commit is contained in:
parent
6643558db2
commit
80ff385665
7 changed files with 154 additions and 213 deletions
|
@ -165,8 +165,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree,
|
|||
* inserted.
|
||||
*/
|
||||
int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
|
||||
u64 start, u64 len, u64 disk_len, int nocow,
|
||||
int compressed)
|
||||
u64 start, u64 len, u64 disk_len, int type)
|
||||
{
|
||||
struct btrfs_ordered_inode_tree *tree;
|
||||
struct rb_node *node;
|
||||
|
@ -183,10 +182,8 @@ int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
|
|||
entry->len = len;
|
||||
entry->disk_len = disk_len;
|
||||
entry->inode = inode;
|
||||
if (nocow)
|
||||
set_bit(BTRFS_ORDERED_NOCOW, &entry->flags);
|
||||
if (compressed)
|
||||
set_bit(BTRFS_ORDERED_COMPRESSED, &entry->flags);
|
||||
if (type == BTRFS_ORDERED_NOCOW || type == BTRFS_ORDERED_COMPRESSED)
|
||||
set_bit(type, &entry->flags);
|
||||
|
||||
/* one ref for the tree */
|
||||
atomic_set(&entry->refs, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue