btrfs: let the assertion expression compile in all configs
[sfrench/cifs-2.6.git] / fs / btrfs / ctree.h
index 7a2a2621f0d9d7402ab2bfc2b10d9421c96dbbb0..2399f56d8a544f6891716d0599b94c730fffc00c 100644 (file)
@@ -1199,6 +1199,24 @@ enum {
        BTRFS_ROOT_MULTI_LOG_TASKS,
        BTRFS_ROOT_DIRTY,
        BTRFS_ROOT_DELETING,
+
+       /*
+        * Reloc tree is orphan, only kept here for qgroup delayed subtree scan
+        *
+        * Set for the subvolume tree owning the reloc tree.
+        */
+       BTRFS_ROOT_DEAD_RELOC_TREE,
+};
+
+/*
+ * Record swapped tree blocks of a subvolume tree for delayed subtree trace
+ * code. For detail check comment in fs/btrfs/qgroup.c.
+ */
+struct btrfs_qgroup_swapped_blocks {
+       spinlock_t lock;
+       /* RM_EMPTY_ROOT() of above blocks[] */
+       bool swapped;
+       struct rb_root blocks[BTRFS_MAX_LEVEL];
 };
 
 /*
@@ -1311,6 +1329,14 @@ struct btrfs_root {
        struct list_head ordered_root;
        u64 nr_ordered_extents;
 
+       /*
+        * Not empty if this subvolume root has gone through tree block swap
+        * (relocation)
+        *
+        * Will be used by reloc_control::dirty_subvol_roots.
+        */
+       struct list_head reloc_dirty_list;
+
        /*
         * Number of currently running SEND ioctls to prevent
         * manipulation with the read-only status via SUBVOL_SETFLAGS
@@ -1328,6 +1354,9 @@ struct btrfs_root {
        /* Number of active swapfiles */
        atomic_t nr_swapfiles;
 
+       /* Record pairs of swapped blocks for qgroup */
+       struct btrfs_qgroup_swapped_blocks swapped_blocks;
+
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
        u64 alloc_bytenr;
 #endif
@@ -3181,8 +3210,7 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
 
 /* inode.c */
 struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
-               struct page *page, size_t pg_offset, u64 start,
-               u64 len, int create);
+                                          u64 start, u64 len);
 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                              u64 *orig_start, u64 *orig_block_len,
                              u64 *ram_bytes);
@@ -3261,7 +3289,7 @@ int btrfs_prealloc_file_range_trans(struct inode *inode,
                                    struct btrfs_trans_handle *trans, int mode,
                                    u64 start, u64 num_bytes, u64 min_size,
                                    loff_t actual_len, u64 *alloc_hint);
-int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
+int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
                u64 start, u64 end, int *page_started, unsigned long *nr_written,
                struct writeback_control *wbc);
 int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end);
@@ -3490,21 +3518,18 @@ do {                                                            \
        rcu_read_unlock();                                      \
 } while (0)
 
-#ifdef CONFIG_BTRFS_ASSERT
-
 __cold
 static inline void assfail(const char *expr, const char *file, int line)
 {
-       pr_err("assertion failed: %s, file: %s, line: %d\n",
-              expr, file, line);
-       BUG();
+       if (IS_ENABLED(CONFIG_BTRFS_ASSERT)) {
+               pr_err("assertion failed: %s, file: %s, line: %d\n",
+                      expr, file, line);
+               BUG();
+       }
 }
 
 #define ASSERT(expr)   \
        (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
-#else
-#define ASSERT(expr)   ((void)0)
-#endif
 
 /*
  * Use that for functions that are conditionally exported for sanity tests but