Lines Matching refs:jset
74 static struct nonce journal_nonce(const struct jset *jset) in journal_nonce() argument
78 [1] = ((__le32 *) &jset->seq)[0], in journal_nonce()
79 [2] = ((__le32 *) &jset->seq)[1], in journal_nonce()
84 static bool jset_csum_good(struct bch_fs *c, struct jset *j, struct bch_csum *csum) in jset_csum_good()
139 struct journal_list *jlist, struct jset *j) in journal_entry_add()
269 struct jset *jset, in journal_entry_err_msg() argument
280 if (!jset) { in journal_entry_err_msg()
284 prt_printf(out, " seq=%llu", le64_to_cpu(jset->seq)); in journal_entry_err_msg()
288 (u64 *) entry - jset->_data, in journal_entry_err_msg()
289 le32_to_cpu(jset->u64s)); in journal_entry_err_msg()
295 #define journal_entry_err(c, version, jset, entry, _err, msg, ...) \ argument
299 journal_entry_err_msg(&_buf, version, jset, entry); \
326 struct jset *jset, in journal_validate_key() argument
338 c, version, jset, entry, in journal_validate_key()
348 c, version, jset, entry, in journal_validate_key()
357 c, version, jset, entry, in journal_validate_key()
389 struct jset *jset, in journal_entry_btree_keys_validate() argument
397 int ret = journal_validate_key(c, jset, entry, in journal_entry_btree_keys_validate()
431 struct jset *jset, in journal_entry_btree_root_validate() argument
441 c, version, jset, entry, in journal_entry_btree_root_validate()
455 ret = journal_validate_key(c, jset, entry, 1, entry->btree_id, k, in journal_entry_btree_root_validate()
470 struct jset *jset, in journal_entry_prio_ptrs_validate() argument
485 struct jset *jset, in journal_entry_blacklist_validate() argument
493 c, version, jset, entry, in journal_entry_blacklist_validate()
512 struct jset *jset, in journal_entry_blacklist_v2_validate() argument
521 c, version, jset, entry, in journal_entry_blacklist_v2_validate()
532 c, version, jset, entry, in journal_entry_blacklist_v2_validate()
554 struct jset *jset, in journal_entry_usage_validate() argument
565 c, version, jset, entry, in journal_entry_usage_validate()
588 struct jset *jset, in journal_entry_data_usage_validate() argument
601 c, version, jset, entry, in journal_entry_data_usage_validate()
609 c, version, jset, entry, in journal_entry_data_usage_validate()
632 struct jset *jset, in journal_entry_clock_validate() argument
643 c, version, jset, entry, in journal_entry_clock_validate()
651 c, version, jset, entry, in journal_entry_clock_validate()
672 struct jset *jset, in journal_entry_dev_usage_validate() argument
684 c, version, jset, entry, in journal_entry_dev_usage_validate()
693 c, version, jset, entry, in journal_entry_dev_usage_validate()
729 struct jset *jset, in journal_entry_log_validate() argument
747 struct jset *jset, in journal_entry_overwrite_validate() argument
752 return journal_entry_btree_keys_validate(c, jset, entry, in journal_entry_overwrite_validate()
763 struct jset *jset, in journal_entry_write_buffer_keys_validate() argument
768 return journal_entry_btree_keys_validate(c, jset, entry, in journal_entry_write_buffer_keys_validate()
779 struct jset *jset, in journal_entry_datetime_validate() argument
789 c, version, jset, entry, in journal_entry_datetime_validate()
810 int (*validate)(struct bch_fs *, struct jset *,
827 struct jset *jset, in bch2_journal_entry_validate() argument
833 ? bch2_jset_entry_ops[entry->type].validate(c, jset, entry, in bch2_journal_entry_validate()
849 static int jset_validate_entries(struct bch_fs *c, struct jset *jset, in jset_validate_entries() argument
852 unsigned version = le32_to_cpu(jset->version); in jset_validate_entries()
855 vstruct_for_each(jset, entry) { in jset_validate_entries()
856 if (journal_entry_err_on(vstruct_next(entry) > vstruct_last(jset), in jset_validate_entries()
857 c, version, jset, entry, in jset_validate_entries()
860 jset->u64s = cpu_to_le32((u64 *) entry - jset->_data); in jset_validate_entries()
864 ret = bch2_journal_entry_validate(c, jset, entry, in jset_validate_entries()
865 version, JSET_BIG_ENDIAN(jset), flags); in jset_validate_entries()
875 struct jset *jset, u64 sector, in jset_validate() argument
881 if (le64_to_cpu(jset->magic) != jset_magic(c)) in jset_validate()
884 version = le32_to_cpu(jset->version); in jset_validate()
886 c, version, jset, NULL, in jset_validate()
890 sector, le64_to_cpu(jset->seq), in jset_validate()
897 if (journal_entry_err_on(!bch2_checksum_type_valid(c, JSET_CSUM_TYPE(jset)), in jset_validate()
898 c, version, jset, NULL, in jset_validate()
902 sector, le64_to_cpu(jset->seq), in jset_validate()
903 JSET_CSUM_TYPE(jset))) in jset_validate()
907 if (journal_entry_err_on(!JSET_NO_FLUSH(jset) && in jset_validate()
908 le64_to_cpu(jset->last_seq) > le64_to_cpu(jset->seq), in jset_validate()
909 c, version, jset, NULL, in jset_validate()
912 le64_to_cpu(jset->last_seq), in jset_validate()
913 le64_to_cpu(jset->seq))) { in jset_validate()
914 jset->last_seq = jset->seq; in jset_validate()
918 ret = jset_validate_entries(c, jset, flags); in jset_validate()
925 struct jset *jset, u64 sector, in jset_validate_early() argument
929 size_t bytes = vstruct_bytes(jset); in jset_validate_early()
934 if (le64_to_cpu(jset->magic) != jset_magic(c)) in jset_validate_early()
937 version = le32_to_cpu(jset->version); in jset_validate_early()
939 c, version, jset, NULL, in jset_validate_early()
943 sector, le64_to_cpu(jset->seq), in jset_validate_early()
955 c, version, jset, NULL, in jset_validate_early()
959 sector, le64_to_cpu(jset->seq), bytes)) in jset_validate_early()
960 le32_add_cpu(&jset->u64s, in jset_validate_early()
998 struct jset *j = NULL; in journal_read_bucket()
1799 struct jset *jset = w->data; in bch2_journal_write_prep() local
1804 u64 seq = le64_to_cpu(jset->seq); in bch2_journal_write_prep()
1815 vstruct_for_each(jset, i) { in bch2_journal_write_prep()
1870 start = end = vstruct_last(jset); in bch2_journal_write_prep()
1884 le32_add_cpu(&jset->u64s, u64s); in bch2_journal_write_prep()
1886 sectors = vstruct_sectors(jset, c->block_bits); in bch2_journal_write_prep()
1887 bytes = vstruct_bytes(jset); in bch2_journal_write_prep()
1891 vstruct_bytes(jset), w->sectors << 9, in bch2_journal_write_prep()
1896 jset->magic = cpu_to_le64(jset_magic(c)); in bch2_journal_write_prep()
1897 jset->version = cpu_to_le32(c->sb.version); in bch2_journal_write_prep()
1899 SET_JSET_BIG_ENDIAN(jset, CPU_BIG_ENDIAN); in bch2_journal_write_prep()
1900 SET_JSET_CSUM_TYPE(jset, bch2_meta_checksum_type(c)); in bch2_journal_write_prep()
1902 if (!JSET_NO_FLUSH(jset) && journal_entry_empty(jset)) in bch2_journal_write_prep()
1905 if (bch2_csum_type_is_encryption(JSET_CSUM_TYPE(jset))) in bch2_journal_write_prep()
1908 if (le32_to_cpu(jset->version) < bcachefs_metadata_version_current) in bch2_journal_write_prep()
1912 (ret = jset_validate(c, NULL, jset, 0, WRITE))) in bch2_journal_write_prep()
1915 ret = bch2_encrypt(c, JSET_CSUM_TYPE(jset), journal_nonce(jset), in bch2_journal_write_prep()
1916 jset->encrypted_start, in bch2_journal_write_prep()
1917 vstruct_end(jset) - (void *) jset->encrypted_start); in bch2_journal_write_prep()
1921 jset->csum = csum_vstruct(c, JSET_CSUM_TYPE(jset), in bch2_journal_write_prep()
1922 journal_nonce(jset), jset); in bch2_journal_write_prep()
1925 (ret = jset_validate(c, NULL, jset, 0, WRITE))) in bch2_journal_write_prep()
1928 memset((void *) jset + bytes, 0, (sectors << 9) - bytes); in bch2_journal_write_prep()