]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/btrfs/delayed-ref.h
Merge tag 'for-linus-4.13-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / fs / btrfs / delayed-ref.h
index 0e537f98f1a1c63c529c118baed1cac26efa194e..ce88e4ac5276f44901e4f882b2948233bb26b9a6 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef __DELAYED_REF__
 #define __DELAYED_REF__
 
+#include <linux/refcount.h>
+
 /* these are the possible values of struct btrfs_delayed_ref_node->action */
 #define BTRFS_ADD_DELAYED_REF    1 /* add one backref to the tree */
 #define BTRFS_DROP_DELAYED_REF   2 /* delete one backref from the tree */
@@ -53,7 +55,7 @@ struct btrfs_delayed_ref_node {
        u64 seq;
 
        /* ref count on this data structure */
-       atomic_t refs;
+       refcount_t refs;
 
        /*
         * how many refs is this entry adding or deleting.  For
@@ -220,8 +222,8 @@ btrfs_free_delayed_extent_op(struct btrfs_delayed_extent_op *op)
 
 static inline void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref)
 {
-       WARN_ON(atomic_read(&ref->refs) == 0);
-       if (atomic_dec_and_test(&ref->refs)) {
+       WARN_ON(refcount_read(&ref->refs) == 0);
+       if (refcount_dec_and_test(&ref->refs)) {
                WARN_ON(ref->in_tree);
                switch (ref->type) {
                case BTRFS_TREE_BLOCK_REF_KEY:
@@ -245,12 +247,14 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
                               struct btrfs_trans_handle *trans,
                               u64 bytenr, u64 num_bytes, u64 parent,
                               u64 ref_root, int level, int action,
-                              struct btrfs_delayed_extent_op *extent_op);
+                              struct btrfs_delayed_extent_op *extent_op,
+                              int *old_ref_mod, int *new_ref_mod);
 int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,
                               struct btrfs_trans_handle *trans,
                               u64 bytenr, u64 num_bytes,
                               u64 parent, u64 ref_root,
-                              u64 owner, u64 offset, u64 reserved, int action);
+                              u64 owner, u64 offset, u64 reserved, int action,
+                              int *old_ref_mod, int *new_ref_mod);
 int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,
                                struct btrfs_trans_handle *trans,
                                u64 bytenr, u64 num_bytes,