diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-13 09:43:29 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:07 +0300 |
commit | 6132c84cacbff39e7b060abffc4175244347885d (patch) | |
tree | b43cb579edb64c3a2ad66fe6d851c3c428ef6106 /fs/bcachefs/subvolume_types.h | |
parent | 5eaa76d813d48a524a1ce040539048b851a0a20c (diff) | |
download | linux-6132c84cacbff39e7b060abffc4175244347885d.tar.xz |
bcachefs: is_ancestor bitmap
Further optimization for bch2_snapshot_is_ancestor(). We add a small
inline bitmap to snapshot_t, which indicates which of the next 128
snapshot IDs are ancestors of the current id - eliminating the last few
iterations of the loop in bch2_snapshot_is_ancestor().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/subvolume_types.h')
-rw-r--r-- | fs/bcachefs/subvolume_types.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/subvolume_types.h b/fs/bcachefs/subvolume_types.h index c596e4270690..86833445af20 100644 --- a/fs/bcachefs/subvolume_types.h +++ b/fs/bcachefs/subvolume_types.h @@ -6,6 +6,8 @@ typedef DARRAY(u32) snapshot_id_list; +#define IS_ANCESTOR_BITMAP 128 + struct snapshot_t { u32 parent; u32 skip[3]; @@ -14,6 +16,7 @@ struct snapshot_t { u32 subvol; /* Nonzero only if a subvolume points to this node: */ u32 tree; u32 equiv; + unsigned long is_ancestor[BITS_TO_LONGS(IS_ANCESTOR_BITMAP)]; }; struct snapshot_table { |