ec.c (53b1c6f44b1a98ea6def11b74c1fde9710f2a0b9) ec.c (facafdcbc157686311dbe58649ef9d29fcf8e610)
1// SPDX-License-Identifier: GPL-2.0
2
3/* erasure coding */
4
5#include "bcachefs.h"
6#include "alloc_foreground.h"
7#include "backpointers.h"
8#include "bkey_buf.h"

--- 91 unchanged lines hidden (view full) ---

100 struct ec_stripe_buf *buf;
101 size_t idx;
102 struct bio bio;
103};
104
105/* Stripes btree keys: */
106
107int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k,
1// SPDX-License-Identifier: GPL-2.0
2
3/* erasure coding */
4
5#include "bcachefs.h"
6#include "alloc_foreground.h"
7#include "backpointers.h"
8#include "bkey_buf.h"

--- 91 unchanged lines hidden (view full) ---

100 struct ec_stripe_buf *buf;
101 size_t idx;
102 struct bio bio;
103};
104
105/* Stripes btree keys: */
106
107int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k,
108 int rw, struct printbuf *err)
108 unsigned flags, struct printbuf *err)
109{
110 const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
111
112 if (bkey_eq(k.k->p, POS_MIN)) {
113 prt_printf(err, "stripe at POS_MIN");
114 return -BCH_ERR_invalid_bkey;
115 }
116

--- 9 unchanged lines hidden (view full) ---

126 }
127
128 if (bkey_val_u64s(k.k) < stripe_val_u64s(s)) {
129 prt_printf(err, "incorrect value size (%zu < %u)",
130 bkey_val_u64s(k.k), stripe_val_u64s(s));
131 return -BCH_ERR_invalid_bkey;
132 }
133
109{
110 const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
111
112 if (bkey_eq(k.k->p, POS_MIN)) {
113 prt_printf(err, "stripe at POS_MIN");
114 return -BCH_ERR_invalid_bkey;
115 }
116

--- 9 unchanged lines hidden (view full) ---

126 }
127
128 if (bkey_val_u64s(k.k) < stripe_val_u64s(s)) {
129 prt_printf(err, "incorrect value size (%zu < %u)",
130 bkey_val_u64s(k.k), stripe_val_u64s(s));
131 return -BCH_ERR_invalid_bkey;
132 }
133
134 return bch2_bkey_ptrs_invalid(c, k, rw, err);
134 return bch2_bkey_ptrs_invalid(c, k, flags, err);
135}
136
137void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c,
138 struct bkey_s_c k)
139{
140 const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
141 unsigned i;
142

--- 1553 unchanged lines hidden ---
135}
136
137void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c,
138 struct bkey_s_c k)
139{
140 const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
141 unsigned i;
142

--- 1553 unchanged lines hidden ---