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

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/journal_io.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_JOURNAL_IO_H
  3 #define _BCACHEFS_JOURNAL_IO_H
  4 
  5 #include "darray.h"
  6 
  7 void bch2_journal_pos_from_member_info_set(struct bch_fs *);
  8 void bch2_journal_pos_from_member_info_resume(struct bch_fs *);
  9 
 10 struct journal_ptr {
 11         bool            csum_good;
 12         u8              dev;
 13         u32             bucket;
 14         u32             bucket_offset;
 15         u64             sector;
 16 };
 17 
 18 /*
 19  * Only used for holding the journal entries we read in btree_journal_read()
 20  * during cache_registration
 21  */
 22 struct journal_replay {
 23         DARRAY_PREALLOCATED(struct journal_ptr, 8) ptrs;
 24 
 25         bool                    csum_good;
 26         bool                    ignore_blacklisted;
 27         bool                    ignore_not_dirty;
 28         /* must be last: */
 29         struct jset             j;
 30 };
 31 
 32 static inline bool journal_replay_ignore(struct journal_replay *i)
 33 {
 34         return !i || i->ignore_blacklisted || i->ignore_not_dirty;
 35 }
 36 
 37 static inline struct jset_entry *__jset_entry_type_next(struct jset *jset,
 38                                         struct jset_entry *entry, unsigned type)
 39 {
 40         while (entry < vstruct_last(jset)) {
 41                 if (entry->type == type)
 42                         return entry;
 43 
 44                 entry = vstruct_next(entry);
 45         }
 46 
 47         return NULL;
 48 }
 49 
 50 #define for_each_jset_entry_type(entry, jset, type)                     \
 51         for (struct jset_entry *entry = (jset)->start;                  \
 52              (entry = __jset_entry_type_next(jset, entry, type));       \
 53              entry = vstruct_next(entry))
 54 
 55 #define jset_entry_for_each_key(_e, _k)                                 \
 56         for (struct bkey_i *_k = (_e)->start;                           \
 57              _k < vstruct_last(_e);                                     \
 58              _k = bkey_next(_k))
 59 
 60 #define for_each_jset_key(k, entry, jset)                               \
 61         for_each_jset_entry_type(entry, jset, BCH_JSET_ENTRY_btree_keys)\
 62                 jset_entry_for_each_key(entry, k)
 63 
 64 int bch2_journal_entry_validate(struct bch_fs *, struct jset *,
 65                                 struct jset_entry *, unsigned, int,
 66                                 enum bch_validate_flags);
 67 void bch2_journal_entry_to_text(struct printbuf *, struct bch_fs *,
 68                                 struct jset_entry *);
 69 
 70 void bch2_journal_ptrs_to_text(struct printbuf *, struct bch_fs *,
 71                                struct journal_replay *);
 72 
 73 int bch2_journal_read(struct bch_fs *, u64 *, u64 *, u64 *);
 74 
 75 CLOSURE_CALLBACK(bch2_journal_write);
 76 
 77 static inline struct jset_entry *jset_entry_init(struct jset_entry **end, size_t size)
 78 {
 79         struct jset_entry *entry = *end;
 80         unsigned u64s = DIV_ROUND_UP(size, sizeof(u64));
 81 
 82         memset(entry, 0, u64s * sizeof(u64));
 83         /*
 84          * The u64s field counts from the start of data, ignoring the shared
 85          * fields.
 86          */
 87         entry->u64s = cpu_to_le16(u64s - 1);
 88 
 89         *end = vstruct_next(*end);
 90         return entry;
 91 }
 92 
 93 #endif /* _BCACHEFS_JOURNAL_IO_H */
 94 

~ [ 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