diff options
author | Brett Holman <bpholman5@gmail.com> | 2021-05-16 21:53:55 -0600 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-03 22:51:23 -0400 |
commit | 00b7615103ddd32462ee7b7e88b7100f2e90fe7c (patch) | |
tree | 4bdddd43b008ecb31a1d83be423425ff50a6459a | |
parent | 64dc5809e9c38082ac353b1d2de941d33e1d6dbc (diff) |
bcachefs: made changes to support clang, fixed a couple bugs
fs/bcachefs/bset.c edited prefetch macro to add clang support
fs/bcachefs/btree_iter.c bugfix: initialize iter->real_pos in bch2_btree_iter_init for later use
fs/bcachefs/io.c bugfix: eliminated undefined behavior (negative bitshift)
fs/bcachefs/buckets.c bugfix: invert sign to handle 64bit abs()
-rw-r--r-- | fs/bcachefs/bset.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/btree_iter.c | 1 | ||||
-rw-r--r-- | fs/bcachefs/buckets.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/io.c | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index 0a3e3b63828b..61d29cc92079 100644 --- a/fs/bcachefs/bset.c +++ b/fs/bcachefs/bset.c @@ -1193,7 +1193,7 @@ static struct bkey_packed *bset_search_write_set(const struct btree *b, static inline void prefetch_four_cachelines(void *p) { -#ifdef CONFIG_X86_64 +#if (CONFIG_X86_64 && !defined(__clang__)) asm(".intel_syntax noprefix;" "prefetcht0 [%0 - 127 + 64 * 0];" "prefetcht0 [%0 - 127 + 64 * 1];" diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 134d4cf8ea89..b301d763b78c 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1899,6 +1899,7 @@ static inline void bch2_btree_iter_init(struct btree_trans *trans, iter->trans = trans; iter->uptodate = BTREE_ITER_NEED_TRAVERSE; iter->btree_id = btree_id; + iter->real_pos = POS_MIN; iter->level = 0; iter->min_depth = 0; iter->locks_want = 0; diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 696f8dc91019..0cfb144ae718 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1798,7 +1798,9 @@ static int bch2_trans_mark_reflink_p(struct btree_trans *trans, unsigned front_frag, back_frag; s64 ret = 0; - sectors = abs(sectors); + if (sectors < 0) + sectors = -sectors; + BUG_ON(offset + sectors > p.k->size); front_frag = offset; diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index 1fa2c0bd7508..fb0a9789421f 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -120,7 +120,7 @@ void bch2_latency_acct(struct bch_dev *ca, u64 submit_time, int rw) * the time: */ if (abs((int) (old - io_latency)) < (old >> 1) && - now & ~(~0 << 5)) + now & ~(~0U << 5)) break; new = ewma_add(old, io_latency, 5); |