19888c340SDavid Sterba /* SPDX-License-Identifier: GPL-2.0 */ 256bec294SChris Mason /* 356bec294SChris Mason * Copyright (C) 2008 Oracle. All rights reserved. 456bec294SChris Mason */ 59888c340SDavid Sterba 69888c340SDavid Sterba #ifndef BTRFS_DELAYED_REF_H 79888c340SDavid Sterba #define BTRFS_DELAYED_REF_H 856bec294SChris Mason 96df8cdf5SElena Reshetova #include <linux/refcount.h> 106df8cdf5SElena Reshetova 1144a075bdSWang Sheng-Hui /* these are the possible values of struct btrfs_delayed_ref_node->action */ 1256bec294SChris Mason #define BTRFS_ADD_DELAYED_REF 1 /* add one backref to the tree */ 1356bec294SChris Mason #define BTRFS_DROP_DELAYED_REF 2 /* delete one backref from the tree */ 1456bec294SChris Mason #define BTRFS_ADD_DELAYED_EXTENT 3 /* record a full extent allocation */ 151a81af4dSChris Mason #define BTRFS_UPDATE_DELAYED_HEAD 4 /* not changing ref count on head ref */ 1656bec294SChris Mason 1756bec294SChris Mason struct btrfs_delayed_ref_node { 180e0adbcfSJosef Bacik struct rb_node ref_node; 191d57ee94SWang Xiaoguang /* 201d57ee94SWang Xiaoguang * If action is BTRFS_ADD_DELAYED_REF, also link this node to 211d57ee94SWang Xiaoguang * ref_head->ref_add_list, then we do not need to iterate the 221d57ee94SWang Xiaoguang * whole ref_head->ref_list to find BTRFS_ADD_DELAYED_REF nodes. 231d57ee94SWang Xiaoguang */ 241d57ee94SWang Xiaoguang struct list_head add_list; 25c6fc2454SQu Wenruo 2656bec294SChris Mason /* the starting bytenr of the extent */ 2756bec294SChris Mason u64 bytenr; 2856bec294SChris Mason 2956bec294SChris Mason /* the size of the extent */ 3056bec294SChris Mason u64 num_bytes; 3156bec294SChris Mason 3200f04b88SArne Jansen /* seq number to keep track of insertion order */ 3300f04b88SArne Jansen u64 seq; 3400f04b88SArne Jansen 3556bec294SChris Mason /* ref count on this data structure */ 366df8cdf5SElena Reshetova refcount_t refs; 3756bec294SChris Mason 3856bec294SChris Mason /* 3956bec294SChris Mason * how many refs is this entry adding or deleting. For 4056bec294SChris Mason * head refs, this may be a negative number because it is keeping 4156bec294SChris Mason * track of the total mods done to the reference count. 4256bec294SChris Mason * For individual refs, this will always be a positive number 4356bec294SChris Mason * 4456bec294SChris Mason * It may be more than one, since it is possible for a single 4556bec294SChris Mason * parent to have more than one ref on an extent 4656bec294SChris Mason */ 4756bec294SChris Mason int ref_mod; 4856bec294SChris Mason 495d4f98a2SYan Zheng unsigned int action:8; 505d4f98a2SYan Zheng unsigned int type:8; 5156bec294SChris Mason /* is this node still in the rbtree? */ 525d4f98a2SYan Zheng unsigned int is_head:1; 5356bec294SChris Mason unsigned int in_tree:1; 5456bec294SChris Mason }; 5556bec294SChris Mason 565d4f98a2SYan Zheng struct btrfs_delayed_extent_op { 575d4f98a2SYan Zheng struct btrfs_disk_key key; 5835b3ad50SDavid Sterba u8 level; 5935b3ad50SDavid Sterba bool update_key; 6035b3ad50SDavid Sterba bool update_flags; 6135b3ad50SDavid Sterba bool is_data; 625d4f98a2SYan Zheng u64 flags_to_set; 635d4f98a2SYan Zheng }; 645d4f98a2SYan Zheng 6556bec294SChris Mason /* 6656bec294SChris Mason * the head refs are used to hold a lock on a given extent, which allows us 6756bec294SChris Mason * to make sure that only one process is running the delayed refs 6856bec294SChris Mason * at a time for a single extent. They also store the sum of all the 6956bec294SChris Mason * reference count modifications we've queued up. 7056bec294SChris Mason */ 7156bec294SChris Mason struct btrfs_delayed_ref_head { 72d278850eSJosef Bacik u64 bytenr; 73d278850eSJosef Bacik u64 num_bytes; 74d278850eSJosef Bacik refcount_t refs; 7556bec294SChris Mason /* 7656bec294SChris Mason * the mutex is held while running the refs, and it is also 7756bec294SChris Mason * held when checking the sum of reference modifications. 7856bec294SChris Mason */ 7956bec294SChris Mason struct mutex mutex; 8056bec294SChris Mason 81d7df2c79SJosef Bacik spinlock_t lock; 82e3d03965SLiu Bo struct rb_root_cached ref_tree; 831d57ee94SWang Xiaoguang /* accumulate add BTRFS_ADD_DELAYED_REF nodes to this ref_add_list. */ 841d57ee94SWang Xiaoguang struct list_head ref_add_list; 85c3e69d58SChris Mason 86c46effa6SLiu Bo struct rb_node href_node; 87c46effa6SLiu Bo 885d4f98a2SYan Zheng struct btrfs_delayed_extent_op *extent_op; 891262133bSJosef Bacik 901262133bSJosef Bacik /* 911262133bSJosef Bacik * This is used to track the final ref_mod from all the refs associated 921262133bSJosef Bacik * with this head ref, this is not adjusted as delayed refs are run, 931262133bSJosef Bacik * this is meant to track if we need to do the csum accounting or not. 941262133bSJosef Bacik */ 951262133bSJosef Bacik int total_ref_mod; 961262133bSJosef Bacik 9756bec294SChris Mason /* 98d278850eSJosef Bacik * This is the current outstanding mod references for this bytenr. This 99d278850eSJosef Bacik * is used with lookup_extent_info to get an accurate reference count 100d278850eSJosef Bacik * for a bytenr, so it is adjusted as delayed refs are run so that any 101d278850eSJosef Bacik * on disk reference count + ref_mod is accurate. 102d278850eSJosef Bacik */ 103d278850eSJosef Bacik int ref_mod; 104d278850eSJosef Bacik 105d278850eSJosef Bacik /* 10656bec294SChris Mason * when a new extent is allocated, it is just reserved in memory 10756bec294SChris Mason * The actual extent isn't inserted into the extent allocation tree 10856bec294SChris Mason * until the delayed ref is processed. must_insert_reserved is 10956bec294SChris Mason * used to flag a delayed ref so the accounting can be updated 11056bec294SChris Mason * when a full insert is done. 11156bec294SChris Mason * 11256bec294SChris Mason * It is possible the extent will be freed before it is ever 11356bec294SChris Mason * inserted into the extent allocation tree. In this case 11456bec294SChris Mason * we need to update the in ram accounting to properly reflect 11556bec294SChris Mason * the free has happened. 11656bec294SChris Mason */ 11756bec294SChris Mason unsigned int must_insert_reserved:1; 1185d4f98a2SYan Zheng unsigned int is_data:1; 1195e388e95SNikolay Borisov unsigned int is_system:1; 120d7df2c79SJosef Bacik unsigned int processing:1; 12156bec294SChris Mason }; 12256bec294SChris Mason 1235d4f98a2SYan Zheng struct btrfs_delayed_tree_ref { 12456bec294SChris Mason struct btrfs_delayed_ref_node node; 12556bec294SChris Mason u64 root; 1265d4f98a2SYan Zheng u64 parent; 1275d4f98a2SYan Zheng int level; 1285d4f98a2SYan Zheng }; 12956bec294SChris Mason 1305d4f98a2SYan Zheng struct btrfs_delayed_data_ref { 1315d4f98a2SYan Zheng struct btrfs_delayed_ref_node node; 1325d4f98a2SYan Zheng u64 root; 1335d4f98a2SYan Zheng u64 parent; 1345d4f98a2SYan Zheng u64 objectid; 1355d4f98a2SYan Zheng u64 offset; 13656bec294SChris Mason }; 13756bec294SChris Mason 13856bec294SChris Mason struct btrfs_delayed_ref_root { 139c46effa6SLiu Bo /* head ref rbtree */ 1405c9d028bSLiu Bo struct rb_root_cached href_root; 141c46effa6SLiu Bo 1423368d001SQu Wenruo /* dirty extent records */ 1433368d001SQu Wenruo struct rb_root dirty_extent_root; 1443368d001SQu Wenruo 14556bec294SChris Mason /* this spin lock protects the rbtree and the entries inside */ 14656bec294SChris Mason spinlock_t lock; 14756bec294SChris Mason 14856bec294SChris Mason /* how many delayed ref updates we've queued, used by the 14956bec294SChris Mason * throttling code 15056bec294SChris Mason */ 151d7df2c79SJosef Bacik atomic_t num_entries; 15256bec294SChris Mason 153c3e69d58SChris Mason /* total number of head nodes in tree */ 154c3e69d58SChris Mason unsigned long num_heads; 155c3e69d58SChris Mason 156c3e69d58SChris Mason /* total number of head nodes ready for processing */ 157c3e69d58SChris Mason unsigned long num_heads_ready; 158c3e69d58SChris Mason 1591262133bSJosef Bacik u64 pending_csums; 1601262133bSJosef Bacik 16156bec294SChris Mason /* 16256bec294SChris Mason * set when the tree is flushing before a transaction commit, 16356bec294SChris Mason * used by the throttling code to decide if new updates need 16456bec294SChris Mason * to be run right away 16556bec294SChris Mason */ 16656bec294SChris Mason int flushing; 167c3e69d58SChris Mason 168c3e69d58SChris Mason u64 run_delayed_start; 1699086db86SQu Wenruo 1709086db86SQu Wenruo /* 1719086db86SQu Wenruo * To make qgroup to skip given root. 17201327610SNicholas D Steeves * This is for snapshot, as btrfs_qgroup_inherit() will manually 1739086db86SQu Wenruo * modify counters for snapshot and its source, so we should skip 1749086db86SQu Wenruo * the snapshot in new_root/old_roots or it will get calculated twice 1759086db86SQu Wenruo */ 1769086db86SQu Wenruo u64 qgroup_to_skip; 17756bec294SChris Mason }; 17856bec294SChris Mason 179b28b1f0cSQu Wenruo enum btrfs_ref_type { 180b28b1f0cSQu Wenruo BTRFS_REF_NOT_SET, 181b28b1f0cSQu Wenruo BTRFS_REF_DATA, 182b28b1f0cSQu Wenruo BTRFS_REF_METADATA, 183b28b1f0cSQu Wenruo BTRFS_REF_LAST, 184b28b1f0cSQu Wenruo }; 185b28b1f0cSQu Wenruo 186b28b1f0cSQu Wenruo struct btrfs_data_ref { 187b28b1f0cSQu Wenruo /* For EXTENT_DATA_REF */ 188b28b1f0cSQu Wenruo 189b28b1f0cSQu Wenruo /* Root which refers to this data extent */ 190b28b1f0cSQu Wenruo u64 ref_root; 191b28b1f0cSQu Wenruo 192b28b1f0cSQu Wenruo /* Inode which refers to this data extent */ 193b28b1f0cSQu Wenruo u64 ino; 194b28b1f0cSQu Wenruo 195b28b1f0cSQu Wenruo /* 196b28b1f0cSQu Wenruo * file_offset - extent_offset 197b28b1f0cSQu Wenruo * 198b28b1f0cSQu Wenruo * file_offset is the key.offset of the EXTENT_DATA key. 199b28b1f0cSQu Wenruo * extent_offset is btrfs_file_extent_offset() of the EXTENT_DATA data. 200b28b1f0cSQu Wenruo */ 201b28b1f0cSQu Wenruo u64 offset; 202b28b1f0cSQu Wenruo }; 203b28b1f0cSQu Wenruo 204b28b1f0cSQu Wenruo struct btrfs_tree_ref { 205b28b1f0cSQu Wenruo /* 206b28b1f0cSQu Wenruo * Level of this tree block 207b28b1f0cSQu Wenruo * 208b28b1f0cSQu Wenruo * Shared for skinny (TREE_BLOCK_REF) and normal tree ref. 209b28b1f0cSQu Wenruo */ 210b28b1f0cSQu Wenruo int level; 211b28b1f0cSQu Wenruo 212b28b1f0cSQu Wenruo /* 213b28b1f0cSQu Wenruo * Root which refers to this tree block. 214b28b1f0cSQu Wenruo * 215b28b1f0cSQu Wenruo * For TREE_BLOCK_REF (skinny metadata, either inline or keyed) 216b28b1f0cSQu Wenruo */ 217b28b1f0cSQu Wenruo u64 root; 218b28b1f0cSQu Wenruo 219b28b1f0cSQu Wenruo /* For non-skinny metadata, no special member needed */ 220b28b1f0cSQu Wenruo }; 221b28b1f0cSQu Wenruo 222b28b1f0cSQu Wenruo struct btrfs_ref { 223b28b1f0cSQu Wenruo enum btrfs_ref_type type; 224b28b1f0cSQu Wenruo int action; 225b28b1f0cSQu Wenruo 226b28b1f0cSQu Wenruo /* 227b28b1f0cSQu Wenruo * Whether this extent should go through qgroup record. 228b28b1f0cSQu Wenruo * 229b28b1f0cSQu Wenruo * Normally false, but for certain cases like delayed subtree scan, 230b28b1f0cSQu Wenruo * setting this flag can hugely reduce qgroup overhead. 231b28b1f0cSQu Wenruo */ 232b28b1f0cSQu Wenruo bool skip_qgroup; 233b28b1f0cSQu Wenruo 234b28b1f0cSQu Wenruo /* 235b28b1f0cSQu Wenruo * Optional. For which root is this modification. 236b28b1f0cSQu Wenruo * Mostly used for qgroup optimization. 237b28b1f0cSQu Wenruo * 238b28b1f0cSQu Wenruo * When unset, data/tree ref init code will populate it. 239b28b1f0cSQu Wenruo * In certain cases, we're modifying reference for a different root. 240b28b1f0cSQu Wenruo * E.g. COW fs tree blocks for balance. 241b28b1f0cSQu Wenruo * In that case, tree_ref::root will be fs tree, but we're doing this 242b28b1f0cSQu Wenruo * for reloc tree, then we should set @real_root to reloc tree. 243b28b1f0cSQu Wenruo */ 244b28b1f0cSQu Wenruo u64 real_root; 245b28b1f0cSQu Wenruo u64 bytenr; 246b28b1f0cSQu Wenruo u64 len; 247b28b1f0cSQu Wenruo 248b28b1f0cSQu Wenruo /* Bytenr of the parent tree block */ 249b28b1f0cSQu Wenruo u64 parent; 250b28b1f0cSQu Wenruo union { 251b28b1f0cSQu Wenruo struct btrfs_data_ref data_ref; 252b28b1f0cSQu Wenruo struct btrfs_tree_ref tree_ref; 253b28b1f0cSQu Wenruo }; 254b28b1f0cSQu Wenruo }; 255b28b1f0cSQu Wenruo 25678a6184aSMiao Xie extern struct kmem_cache *btrfs_delayed_ref_head_cachep; 25778a6184aSMiao Xie extern struct kmem_cache *btrfs_delayed_tree_ref_cachep; 25878a6184aSMiao Xie extern struct kmem_cache *btrfs_delayed_data_ref_cachep; 25978a6184aSMiao Xie extern struct kmem_cache *btrfs_delayed_extent_op_cachep; 26078a6184aSMiao Xie 261f5c29bd9SLiu Bo int __init btrfs_delayed_ref_init(void); 262e67c718bSDavid Sterba void __cold btrfs_delayed_ref_exit(void); 26378a6184aSMiao Xie 264b28b1f0cSQu Wenruo static inline void btrfs_init_generic_ref(struct btrfs_ref *generic_ref, 265b28b1f0cSQu Wenruo int action, u64 bytenr, u64 len, u64 parent) 266b28b1f0cSQu Wenruo { 267b28b1f0cSQu Wenruo generic_ref->action = action; 268b28b1f0cSQu Wenruo generic_ref->bytenr = bytenr; 269b28b1f0cSQu Wenruo generic_ref->len = len; 270b28b1f0cSQu Wenruo generic_ref->parent = parent; 271b28b1f0cSQu Wenruo } 272b28b1f0cSQu Wenruo 273b28b1f0cSQu Wenruo static inline void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, 274b28b1f0cSQu Wenruo int level, u64 root) 275b28b1f0cSQu Wenruo { 276b28b1f0cSQu Wenruo /* If @real_root not set, use @root as fallback */ 277b28b1f0cSQu Wenruo if (!generic_ref->real_root) 278b28b1f0cSQu Wenruo generic_ref->real_root = root; 279b28b1f0cSQu Wenruo generic_ref->tree_ref.level = level; 280b28b1f0cSQu Wenruo generic_ref->tree_ref.root = root; 281b28b1f0cSQu Wenruo generic_ref->type = BTRFS_REF_METADATA; 282b28b1f0cSQu Wenruo } 283b28b1f0cSQu Wenruo 284b28b1f0cSQu Wenruo static inline void btrfs_init_data_ref(struct btrfs_ref *generic_ref, 285b28b1f0cSQu Wenruo u64 ref_root, u64 ino, u64 offset) 286b28b1f0cSQu Wenruo { 287b28b1f0cSQu Wenruo /* If @real_root not set, use @root as fallback */ 288b28b1f0cSQu Wenruo if (!generic_ref->real_root) 289b28b1f0cSQu Wenruo generic_ref->real_root = ref_root; 290b28b1f0cSQu Wenruo generic_ref->data_ref.ref_root = ref_root; 291b28b1f0cSQu Wenruo generic_ref->data_ref.ino = ino; 292b28b1f0cSQu Wenruo generic_ref->data_ref.offset = offset; 293b28b1f0cSQu Wenruo generic_ref->type = BTRFS_REF_DATA; 294b28b1f0cSQu Wenruo } 295b28b1f0cSQu Wenruo 29678a6184aSMiao Xie static inline struct btrfs_delayed_extent_op * 29778a6184aSMiao Xie btrfs_alloc_delayed_extent_op(void) 29878a6184aSMiao Xie { 29978a6184aSMiao Xie return kmem_cache_alloc(btrfs_delayed_extent_op_cachep, GFP_NOFS); 30078a6184aSMiao Xie } 30178a6184aSMiao Xie 30278a6184aSMiao Xie static inline void 30378a6184aSMiao Xie btrfs_free_delayed_extent_op(struct btrfs_delayed_extent_op *op) 30478a6184aSMiao Xie { 30578a6184aSMiao Xie if (op) 30678a6184aSMiao Xie kmem_cache_free(btrfs_delayed_extent_op_cachep, op); 30778a6184aSMiao Xie } 30878a6184aSMiao Xie 30956bec294SChris Mason static inline void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref) 31056bec294SChris Mason { 3116df8cdf5SElena Reshetova WARN_ON(refcount_read(&ref->refs) == 0); 3126df8cdf5SElena Reshetova if (refcount_dec_and_test(&ref->refs)) { 31356bec294SChris Mason WARN_ON(ref->in_tree); 31478a6184aSMiao Xie switch (ref->type) { 31578a6184aSMiao Xie case BTRFS_TREE_BLOCK_REF_KEY: 31678a6184aSMiao Xie case BTRFS_SHARED_BLOCK_REF_KEY: 31778a6184aSMiao Xie kmem_cache_free(btrfs_delayed_tree_ref_cachep, ref); 31878a6184aSMiao Xie break; 31978a6184aSMiao Xie case BTRFS_EXTENT_DATA_REF_KEY: 32078a6184aSMiao Xie case BTRFS_SHARED_DATA_REF_KEY: 32178a6184aSMiao Xie kmem_cache_free(btrfs_delayed_data_ref_cachep, ref); 32278a6184aSMiao Xie break; 32378a6184aSMiao Xie default: 32478a6184aSMiao Xie BUG(); 32578a6184aSMiao Xie } 32656bec294SChris Mason } 32756bec294SChris Mason } 32856bec294SChris Mason 329d278850eSJosef Bacik static inline void btrfs_put_delayed_ref_head(struct btrfs_delayed_ref_head *head) 330d278850eSJosef Bacik { 331d278850eSJosef Bacik if (refcount_dec_and_test(&head->refs)) 332d278850eSJosef Bacik kmem_cache_free(btrfs_delayed_ref_head_cachep, head); 333d278850eSJosef Bacik } 334d278850eSJosef Bacik 33544e1c47dSNikolay Borisov int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans, 336ed4f255bSQu Wenruo struct btrfs_ref *generic_ref, 3377be07912SOmar Sandoval struct btrfs_delayed_extent_op *extent_op, 3387be07912SOmar Sandoval int *old_ref_mod, int *new_ref_mod); 33988a979c6SNikolay Borisov int btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans, 34076675593SQu Wenruo struct btrfs_ref *generic_ref, 34176675593SQu Wenruo u64 reserved, int *old_ref_mod, 34276675593SQu Wenruo int *new_ref_mod); 343c6e340bcSDavid Sterba int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans, 3445d4f98a2SYan Zheng u64 bytenr, u64 num_bytes, 3455d4f98a2SYan Zheng struct btrfs_delayed_extent_op *extent_op); 346ae1e206bSJosef Bacik void btrfs_merge_delayed_refs(struct btrfs_trans_handle *trans, 347ae1e206bSJosef Bacik struct btrfs_delayed_ref_root *delayed_refs, 348ae1e206bSJosef Bacik struct btrfs_delayed_ref_head *head); 34956bec294SChris Mason 3501887be66SChris Mason struct btrfs_delayed_ref_head * 351f72ad18eSLiu Bo btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs, 352f72ad18eSLiu Bo u64 bytenr); 3539e920a6fSLu Fengqi int btrfs_delayed_ref_lock(struct btrfs_delayed_ref_root *delayed_refs, 354c3e69d58SChris Mason struct btrfs_delayed_ref_head *head); 355093486c4SMiao Xie static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head) 356093486c4SMiao Xie { 357093486c4SMiao Xie mutex_unlock(&head->mutex); 358093486c4SMiao Xie } 359d7baffdaSJosef Bacik void btrfs_delete_ref_head(struct btrfs_delayed_ref_root *delayed_refs, 360d7baffdaSJosef Bacik struct btrfs_delayed_ref_head *head); 361d7df2c79SJosef Bacik 3625637c74bSLu Fengqi struct btrfs_delayed_ref_head *btrfs_select_ref_head( 3635637c74bSLu Fengqi struct btrfs_delayed_ref_root *delayed_refs); 36400f04b88SArne Jansen 36541d0bd3bSNikolay Borisov int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info, u64 seq); 36600f04b88SArne Jansen 3676ef03debSJosef Bacik void btrfs_delayed_refs_rsv_release(struct btrfs_fs_info *fs_info, int nr); 3686ef03debSJosef Bacik void btrfs_update_delayed_refs_rsv(struct btrfs_trans_handle *trans); 3696ef03debSJosef Bacik int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, 3706ef03debSJosef Bacik enum btrfs_reserve_flush_enum flush); 3716ef03debSJosef Bacik void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info, 3726ef03debSJosef Bacik struct btrfs_block_rsv *src, 3736ef03debSJosef Bacik u64 num_bytes); 3746ef03debSJosef Bacik int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans); 3756ef03debSJosef Bacik bool btrfs_check_space_for_delayed_refs(struct btrfs_fs_info *fs_info); 3766ef03debSJosef Bacik 37700f04b88SArne Jansen /* 37856bec294SChris Mason * helper functions to cast a node into its container 37956bec294SChris Mason */ 3805d4f98a2SYan Zheng static inline struct btrfs_delayed_tree_ref * 3815d4f98a2SYan Zheng btrfs_delayed_node_to_tree_ref(struct btrfs_delayed_ref_node *node) 38256bec294SChris Mason { 3835d4f98a2SYan Zheng return container_of(node, struct btrfs_delayed_tree_ref, node); 3845d4f98a2SYan Zheng } 38556bec294SChris Mason 3865d4f98a2SYan Zheng static inline struct btrfs_delayed_data_ref * 3875d4f98a2SYan Zheng btrfs_delayed_node_to_data_ref(struct btrfs_delayed_ref_node *node) 3885d4f98a2SYan Zheng { 3895d4f98a2SYan Zheng return container_of(node, struct btrfs_delayed_data_ref, node); 39056bec294SChris Mason } 3919888c340SDavid Sterba 39256bec294SChris Mason #endif 393