summaryrefslogtreecommitdiff
path: root/fs/bcachefs/reflink.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-04 23:05:55 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:55 -0400
commitac2ccddc2689d5889fd1520383738b60dbafc1d0 (patch)
treec090c0f7749633a7d03ba3790fc2f9ec1b396318 /fs/bcachefs/reflink.c
parent45dd05b3ecc371560f9e36e4b57295ee338ee879 (diff)
bcachefs: Drop some anonymous structs, unions
Rust bindgen doesn't cope well with anonymous structs and unions. This patch drops the fancy anonymous structs & unions in bkey_i that let us use the same helpers for bkey_i and bkey_packed; since bkey_packed is an internal type that's never exposed to outside code, it's only a minor inconvenienc. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/reflink.c')
-rw-r--r--fs/bcachefs/reflink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index 87446f7bad4f..d2e6adc13fb1 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -233,7 +233,13 @@ static int bch2_make_extent_indirect(struct btree_trans *trans,
orig->k.type = KEY_TYPE_reflink_p;
r_p = bkey_i_to_reflink_p(orig);
set_bkey_val_bytes(&r_p->k, sizeof(r_p->v));
+
+ /* FORTIFY_SOURCE is broken here, and doesn't provide unsafe_memset() */
+#if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE)
+ __underlying_memset(&r_p->v, 0, sizeof(r_p->v));
+#else
memset(&r_p->v, 0, sizeof(r_p->v));
+#endif
r_p->v.idx = cpu_to_le64(bkey_start_offset(&r_v->k));