summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.h
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2020-03-03 13:24:06 +0800
committerDavid Sterba <dsterba@suse.com>2020-05-25 11:25:20 +0200
commitf39911e5527e8be7ab56cadde306237092bcc78f (patch)
treeb2a2dbe670cd5ea673d58feb070395e099dbaae0 /fs/btrfs/backref.h
parent47254d07f37590fddc1516006e3e79453e755424 (diff)
downloadlinux-f39911e5527e8be7ab56cadde306237092bcc78f.tar.gz
linux-f39911e5527e8be7ab56cadde306237092bcc78f.tar.bz2
linux-f39911e5527e8be7ab56cadde306237092bcc78f.zip
btrfs: backref: rename and move link_backref_edge()
Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/backref.h')
-rw-r--r--fs/btrfs/backref.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
index 4f140a0ebe1c..01c559543133 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -275,4 +275,20 @@ struct btrfs_backref_node *btrfs_backref_alloc_node(
struct btrfs_backref_edge *btrfs_backref_alloc_edge(
struct btrfs_backref_cache *cache);
+#define LINK_LOWER (1 << 0)
+#define LINK_UPPER (1 << 1)
+static inline void btrfs_backref_link_edge(struct btrfs_backref_edge *edge,
+ struct btrfs_backref_node *lower,
+ struct btrfs_backref_node *upper,
+ int link_which)
+{
+ ASSERT(upper && lower && upper->level == lower->level + 1);
+ edge->node[LOWER] = lower;
+ edge->node[UPPER] = upper;
+ if (link_which & LINK_LOWER)
+ list_add_tail(&edge->list[LOWER], &lower->upper);
+ if (link_which & LINK_UPPER)
+ list_add_tail(&edge->list[UPPER], &upper->lower);
+}
+
#endif