extents.c (a8b3a677e786fa869d220a6a78b5532a36dc2f4d) | extents.c (facafdcbc157686311dbe58649ef9d29fcf8e610) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2010 Kent Overstreet <kent.overstreet@gmail.com> 4 * 5 * Code for managing the extent btree and dynamically updating the writeback 6 * dirty sector count. 7 */ 8 --- 151 unchanged lines hidden (view full) --- 160 } 161 162 return ret; 163} 164 165/* KEY_TYPE_btree_ptr: */ 166 167int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2010 Kent Overstreet <kent.overstreet@gmail.com> 4 * 5 * Code for managing the extent btree and dynamically updating the writeback 6 * dirty sector count. 7 */ 8 --- 151 unchanged lines hidden (view full) --- 160 } 161 162 return ret; 163} 164 165/* KEY_TYPE_btree_ptr: */ 166 167int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, |
168 int rw, struct printbuf *err) | 168 unsigned flags, struct printbuf *err) |
169{ 170 if (bkey_val_u64s(k.k) > BCH_REPLICAS_MAX) { 171 prt_printf(err, "value too big (%zu > %u)", 172 bkey_val_u64s(k.k), BCH_REPLICAS_MAX); 173 return -BCH_ERR_invalid_bkey; 174 } 175 | 169{ 170 if (bkey_val_u64s(k.k) > BCH_REPLICAS_MAX) { 171 prt_printf(err, "value too big (%zu > %u)", 172 bkey_val_u64s(k.k), BCH_REPLICAS_MAX); 173 return -BCH_ERR_invalid_bkey; 174 } 175 |
176 return bch2_bkey_ptrs_invalid(c, k, rw, err); | 176 return bch2_bkey_ptrs_invalid(c, k, flags, err); |
177} 178 179void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c, 180 struct bkey_s_c k) 181{ 182 bch2_bkey_ptrs_to_text(out, c, k); 183} 184 185int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, | 177} 178 179void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c, 180 struct bkey_s_c k) 181{ 182 bch2_bkey_ptrs_to_text(out, c, k); 183} 184 185int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, |
186 int rw, struct printbuf *err) | 186 unsigned flags, struct printbuf *err) |
187{ 188 struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); 189 190 if (bkey_val_bytes(k.k) <= sizeof(*bp.v)) { 191 prt_printf(err, "value too small (%zu <= %zu)", 192 bkey_val_bytes(k.k), sizeof(*bp.v)); 193 return -BCH_ERR_invalid_bkey; 194 } --- 6 unchanged lines hidden (view full) --- 201 202 if (c->sb.version < bcachefs_metadata_version_snapshot && 203 bp.v->min_key.snapshot) { 204 prt_printf(err, "invalid min_key.snapshot (%u != 0)", 205 bp.v->min_key.snapshot); 206 return -BCH_ERR_invalid_bkey; 207 } 208 | 187{ 188 struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); 189 190 if (bkey_val_bytes(k.k) <= sizeof(*bp.v)) { 191 prt_printf(err, "value too small (%zu <= %zu)", 192 bkey_val_bytes(k.k), sizeof(*bp.v)); 193 return -BCH_ERR_invalid_bkey; 194 } --- 6 unchanged lines hidden (view full) --- 201 202 if (c->sb.version < bcachefs_metadata_version_snapshot && 203 bp.v->min_key.snapshot) { 204 prt_printf(err, "invalid min_key.snapshot (%u != 0)", 205 bp.v->min_key.snapshot); 206 return -BCH_ERR_invalid_bkey; 207 } 208 |
209 return bch2_bkey_ptrs_invalid(c, k, rw, err); | 209 return bch2_bkey_ptrs_invalid(c, k, flags, err); |
210} 211 212void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c, 213 struct bkey_s_c k) 214{ 215 struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); 216 217 prt_printf(out, "seq %llx written %u min_key %s", --- 165 unchanged lines hidden (view full) --- 383 384 bch2_key_resize(l.k, l.k->size + r.k->size); 385 return true; 386} 387 388/* KEY_TYPE_reservation: */ 389 390int bch2_reservation_invalid(const struct bch_fs *c, struct bkey_s_c k, | 210} 211 212void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c, 213 struct bkey_s_c k) 214{ 215 struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); 216 217 prt_printf(out, "seq %llx written %u min_key %s", --- 165 unchanged lines hidden (view full) --- 383 384 bch2_key_resize(l.k, l.k->size + r.k->size); 385 return true; 386} 387 388/* KEY_TYPE_reservation: */ 389 390int bch2_reservation_invalid(const struct bch_fs *c, struct bkey_s_c k, |
391 int rw, struct printbuf *err) | 391 unsigned flags, struct printbuf *err) |
392{ 393 struct bkey_s_c_reservation r = bkey_s_c_to_reservation(k); 394 395 if (bkey_val_bytes(k.k) != sizeof(struct bch_reservation)) { 396 prt_printf(err, "incorrect value size (%zu != %zu)", 397 bkey_val_bytes(k.k), sizeof(*r.v)); 398 return -BCH_ERR_invalid_bkey; 399 } --- 680 unchanged lines hidden (view full) --- 1080 bucket_offset, size_ondisk, ca->mi.bucket_size); 1081 return -BCH_ERR_invalid_bkey; 1082 } 1083 1084 return 0; 1085} 1086 1087int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k, | 392{ 393 struct bkey_s_c_reservation r = bkey_s_c_to_reservation(k); 394 395 if (bkey_val_bytes(k.k) != sizeof(struct bch_reservation)) { 396 prt_printf(err, "incorrect value size (%zu != %zu)", 397 bkey_val_bytes(k.k), sizeof(*r.v)); 398 return -BCH_ERR_invalid_bkey; 399 } --- 680 unchanged lines hidden (view full) --- 1080 bucket_offset, size_ondisk, ca->mi.bucket_size); 1081 return -BCH_ERR_invalid_bkey; 1082 } 1083 1084 return 0; 1085} 1086 1087int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k, |
1088 int rw, struct printbuf *err) | 1088 unsigned flags, struct printbuf *err) |
1089{ 1090 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); 1091 const union bch_extent_entry *entry; 1092 struct bch_extent_crc_unpacked crc; 1093 unsigned size_ondisk = k.k->size; 1094 unsigned nonce = UINT_MAX; 1095 unsigned nr_ptrs = 0; 1096 bool unwritten = false; --- 237 unchanged lines hidden --- | 1089{ 1090 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); 1091 const union bch_extent_entry *entry; 1092 struct bch_extent_crc_unpacked crc; 1093 unsigned size_ondisk = k.k->size; 1094 unsigned nonce = UINT_MAX; 1095 unsigned nr_ptrs = 0; 1096 bool unwritten = false; --- 237 unchanged lines hidden --- |