OSDN Git Service

Merge tag 'sched-core-2020-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git...
[tomoyo/tomoyo-test1.git] / fs / btrfs / block-group.h
index 107bb55..b6ee70a 100644 (file)
@@ -129,8 +129,17 @@ struct btrfs_block_group {
        /* For read-only block groups */
        struct list_head ro_list;
 
+       /*
+        * When non-zero it means the block group's logical address and its
+        * device extents can not be reused for future block group allocations
+        * until the counter goes down to 0. This is to prevent them from being
+        * reused while some task is still using the block group after it was
+        * deleted - we want to make sure they can only be reused for new block
+        * groups after that task is done with the deleted block group.
+        */
+       atomic_t frozen;
+
        /* For discard operations */
-       atomic_t trimming;
        struct list_head discard_list;
        int discard_index;
        u64 discard_eligible_time;
@@ -283,6 +292,9 @@ static inline int btrfs_block_group_done(struct btrfs_block_group *cache)
                cache->cached == BTRFS_CACHE_ERROR;
 }
 
+void btrfs_freeze_block_group(struct btrfs_block_group *cache);
+void btrfs_unfreeze_block_group(struct btrfs_block_group *cache);
+
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
 int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start,
                     u64 physical, u64 **logical, int *naddrs, int *stripe_len);