]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/btrfs/ctree.h
Btrfs: fix race between using extent maps and merging them
[linux.git] / fs / btrfs / ctree.h
index 486b9d1532eb37f8f8e4c23a96c3e922b898786c..36df977b64d91d1f3bbdd90edcb9da91751e87e4 100644 (file)
@@ -473,6 +473,9 @@ struct btrfs_discard_ctl {
        unsigned long delay;
        u32 iops_limit;
        u32 kbps_limit;
+       u64 discard_extent_bytes;
+       u64 discard_bitmap_bytes;
+       atomic64_t discard_bytes_saved;
 };
 
 /* delayed seq elem */
@@ -711,14 +714,12 @@ struct btrfs_fs_info {
        atomic_t nr_delayed_iputs;
        wait_queue_head_t delayed_iputs_wait;
 
-       /* this protects tree_mod_seq_list */
-       spinlock_t tree_mod_seq_lock;
        atomic64_t tree_mod_seq;
-       struct list_head tree_mod_seq_list;
 
-       /* this protects tree_mod_log */
+       /* this protects tree_mod_log and tree_mod_seq_list */
        rwlock_t tree_mod_log_lock;
        struct rb_root tree_mod_log;
+       struct list_head tree_mod_seq_list;
 
        atomic_t async_delalloc_pages;
 
@@ -3154,17 +3155,21 @@ do {                                                            \
        rcu_read_unlock();                                      \
 } while (0)
 
-__cold
-static inline void assfail(const char *expr, const char *file, int line)
+#ifdef CONFIG_BTRFS_ASSERT
+__cold __noreturn
+static inline void assertfail(const char *expr, const char *file, int line)
 {
-       if (IS_ENABLED(CONFIG_BTRFS_ASSERT)) {
-               pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
-               BUG();
-       }
+       pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
+       BUG();
 }
 
-#define ASSERT(expr)   \
-       (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
+#define ASSERT(expr)                                           \
+       (likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__))
+
+#else
+static inline void assertfail(const char *expr, const char* file, int line) { }
+#define ASSERT(expr)   (void)(expr)
+#endif
 
 /*
  * Use that for functions that are conditionally exported for sanity tests but