~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/btree_journal_iter.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _BCACHEFS_BTREE_JOURNAL_ITER_H
  3 #define _BCACHEFS_BTREE_JOURNAL_ITER_H
  4 
  5 #include "bkey.h"
  6 
  7 struct journal_iter {
  8         struct list_head        list;
  9         enum btree_id           btree_id;
 10         unsigned                level;
 11         size_t                  idx;
 12         struct journal_keys     *keys;
 13 };
 14 
 15 /*
 16  * Iterate over keys in the btree, with keys from the journal overlaid on top:
 17  */
 18 
 19 struct btree_and_journal_iter {
 20         struct btree_trans      *trans;
 21         struct btree            *b;
 22         struct btree_node_iter  node_iter;
 23         struct bkey             unpacked;
 24 
 25         struct journal_iter     journal;
 26         struct bpos             pos;
 27         bool                    at_end;
 28         bool                    prefetch;
 29 };
 30 
 31 static inline int __journal_key_cmp(enum btree_id       l_btree_id,
 32                                     unsigned            l_level,
 33                                     struct bpos l_pos,
 34                                     const struct journal_key *r)
 35 {
 36         return (cmp_int(l_btree_id,     r->btree_id) ?:
 37                 cmp_int(l_level,        r->level) ?:
 38                 bpos_cmp(l_pos, r->k->k.p));
 39 }
 40 
 41 static inline int journal_key_cmp(const struct journal_key *l, const struct journal_key *r)
 42 {
 43         return __journal_key_cmp(l->btree_id, l->level, l->k->k.p, r);
 44 }
 45 
 46 struct bkey_i *bch2_journal_keys_peek_upto(struct bch_fs *, enum btree_id,
 47                                 unsigned, struct bpos, struct bpos, size_t *);
 48 struct bkey_i *bch2_journal_keys_peek_slot(struct bch_fs *, enum btree_id,
 49                                            unsigned, struct bpos);
 50 
 51 int bch2_btree_and_journal_iter_prefetch(struct btree_trans *, struct btree_path *,
 52                                          struct btree_and_journal_iter *);
 53 
 54 int bch2_journal_key_insert_take(struct bch_fs *, enum btree_id,
 55                                  unsigned, struct bkey_i *);
 56 int bch2_journal_key_insert(struct bch_fs *, enum btree_id,
 57                             unsigned, struct bkey_i *);
 58 int bch2_journal_key_delete(struct bch_fs *, enum btree_id,
 59                             unsigned, struct bpos);
 60 bool bch2_key_deleted_in_journal(struct btree_trans *, enum btree_id, unsigned, struct bpos);
 61 void bch2_journal_key_overwritten(struct bch_fs *, enum btree_id, unsigned, struct bpos);
 62 
 63 void bch2_btree_and_journal_iter_advance(struct btree_and_journal_iter *);
 64 struct bkey_s_c bch2_btree_and_journal_iter_peek(struct btree_and_journal_iter *);
 65 
 66 void bch2_btree_and_journal_iter_exit(struct btree_and_journal_iter *);
 67 void __bch2_btree_and_journal_iter_init_node_iter(struct btree_trans *,
 68                                 struct btree_and_journal_iter *, struct btree *,
 69                                 struct btree_node_iter, struct bpos);
 70 void bch2_btree_and_journal_iter_init_node_iter(struct btree_trans *,
 71                                 struct btree_and_journal_iter *, struct btree *);
 72 
 73 void bch2_journal_keys_put(struct bch_fs *);
 74 
 75 static inline void bch2_journal_keys_put_initial(struct bch_fs *c)
 76 {
 77         if (c->journal_keys.initial_ref_held)
 78                 bch2_journal_keys_put(c);
 79         c->journal_keys.initial_ref_held = false;
 80 }
 81 
 82 void bch2_journal_entries_free(struct bch_fs *);
 83 
 84 int bch2_journal_keys_sort(struct bch_fs *);
 85 
 86 void bch2_shoot_down_journal_keys(struct bch_fs *, enum btree_id,
 87                                   unsigned, unsigned,
 88                                   struct bpos, struct bpos);
 89 
 90 void bch2_journal_keys_dump(struct bch_fs *);
 91 
 92 #endif /* _BCACHEFS_BTREE_JOURNAL_ITER_H */
 93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php