Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Fix assorted checkpatch nits

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+55 -39
+2 -2
fs/bcachefs/alloc_types.h
··· 105 105 struct dev_stripe_state stripe; 106 106 107 107 u64 sectors_allocated; 108 - } __attribute__((__aligned__(SMP_CACHE_BYTES))); 108 + } __aligned(SMP_CACHE_BYTES); 109 109 110 110 struct { 111 111 struct work_struct index_update_work; ··· 116 116 enum write_point_state state; 117 117 u64 last_state_change; 118 118 u64 time[WRITE_POINT_STATE_NR]; 119 - } __attribute__((__aligned__(SMP_CACHE_BYTES))); 119 + } __aligned(SMP_CACHE_BYTES); 120 120 }; 121 121 122 122 struct write_point_specifier {
+1 -1
fs/bcachefs/btree_gc.c
··· 535 535 536 536 bch2_trans_init(&trans, c, 0, 0); 537 537 538 - for (i = 0; i < btree_id_nr_alive(c)&& !ret; i++) { 538 + for (i = 0; i < btree_id_nr_alive(c) && !ret; i++) { 539 539 struct btree_root *r = bch2_btree_id_root(c, i); 540 540 541 541 if (!r->alive)
+2 -2
fs/bcachefs/btree_io.h
··· 143 143 __BTREE_WRITE_ONLY_IF_NEED = BTREE_WRITE_TYPE_BITS, 144 144 __BTREE_WRITE_ALREADY_STARTED, 145 145 }; 146 - #define BTREE_WRITE_ONLY_IF_NEED (1U << __BTREE_WRITE_ONLY_IF_NEED ) 147 - #define BTREE_WRITE_ALREADY_STARTED (1U << __BTREE_WRITE_ALREADY_STARTED) 146 + #define BTREE_WRITE_ONLY_IF_NEED BIT(__BTREE_WRITE_ONLY_IF_NEED) 147 + #define BTREE_WRITE_ALREADY_STARTED BIT(__BTREE_WRITE_ALREADY_STARTED) 148 148 149 149 void __bch2_btree_node_write(struct bch_fs *, struct btree *, unsigned); 150 150 void bch2_btree_node_write(struct bch_fs *, struct btree *,
+4 -4
fs/bcachefs/btree_iter.c
··· 1008 1008 /* 1009 1009 * We used to assert that all paths had been traversed here 1010 1010 * (path->uptodate < BTREE_ITER_NEED_TRAVERSE); however, since 1011 - * path->Should_be_locked is not set yet, we we might have unlocked and 1011 + * path->should_be_locked is not set yet, we might have unlocked and 1012 1012 * then failed to relock a path - that's fine. 1013 1013 */ 1014 1014 err: ··· 2738 2738 unsigned depth, 2739 2739 unsigned flags) 2740 2740 { 2741 - flags |= BTREE_ITER_NOT_EXTENTS; 2742 - flags |= __BTREE_ITER_ALL_SNAPSHOTS; 2743 - flags |= BTREE_ITER_ALL_SNAPSHOTS; 2741 + flags |= BTREE_ITER_NOT_EXTENTS; 2742 + flags |= __BTREE_ITER_ALL_SNAPSHOTS; 2743 + flags |= BTREE_ITER_ALL_SNAPSHOTS; 2744 2744 2745 2745 bch2_trans_iter_init_common(trans, iter, btree_id, pos, locks_want, depth, 2746 2746 __bch2_btree_iter_flags(trans, btree_id, flags),
+2 -2
fs/bcachefs/btree_update.h
··· 268 268 { 269 269 struct bkey_s_c k = __bch2_bkey_get_iter(trans, iter, 270 270 btree_id, pos, flags|BTREE_ITER_INTENT, type); 271 - struct bkey_i *ret = unlikely(IS_ERR(k.k)) 271 + struct bkey_i *ret = IS_ERR(k.k) 272 272 ? ERR_CAST(k.k) 273 273 : __bch2_bkey_make_mut_noupdate(trans, k, 0, min_bytes); 274 - if (unlikely(IS_ERR(ret))) 274 + if (IS_ERR(ret)) 275 275 bch2_trans_iter_exit(trans, iter); 276 276 return ret; 277 277 }
+1
fs/bcachefs/buckets.c
··· 1924 1924 int bch2_trans_mark_dev_sb(struct bch_fs *c, struct bch_dev *ca) 1925 1925 { 1926 1926 int ret = bch2_trans_run(c, __bch2_trans_mark_dev_sb(&trans, ca)); 1927 + 1927 1928 if (ret) 1928 1929 bch_err_fn(c, ret); 1929 1930 return ret;
+1 -1
fs/bcachefs/chardev.h
··· 17 17 static inline long bch2_fs_ioctl(struct bch_fs *c, 18 18 unsigned cmd, void __user * arg) 19 19 { 20 - return -ENOSYS; 20 + return -ENOTTY; 21 21 } 22 22 23 23 static inline void bch2_fs_chardev_exit(struct bch_fs *c) {}
+7 -5
fs/bcachefs/checksum.c
··· 265 265 266 266 #ifdef CONFIG_HIGHMEM 267 267 __bio_for_each_segment(bv, bio, *iter, *iter) { 268 - void *p = kmap_atomic(bv.bv_page) + bv.bv_offset; 268 + void *p = kmap_local_page(bv.bv_page) + bv.bv_offset; 269 + 269 270 bch2_checksum_update(&state, p, bv.bv_len); 270 - kunmap_atomic(p); 271 + kunmap_local(p); 271 272 } 272 273 #else 273 274 __bio_for_each_bvec(bv, bio, *iter, *iter) ··· 288 287 289 288 #ifdef CONFIG_HIGHMEM 290 289 __bio_for_each_segment(bv, bio, *iter, *iter) { 291 - void *p = kmap_atomic(bv.bv_page) + bv.bv_offset; 290 + void *p = kmap_local_page(bv.bv_page) + bv.bv_offset; 292 291 293 292 crypto_shash_update(desc, p, bv.bv_len); 294 - kunmap_atomic(p); 293 + kunmap_local(p); 295 294 } 296 295 #else 297 296 __bio_for_each_bvec(bv, bio, *iter, *iter) ··· 428 427 extent_nonce(version, crc_old), bio); 429 428 430 429 if (bch2_crc_cmp(merged, crc_old.csum) && !c->opts.no_data_io) { 431 - bch_err(c, "checksum error in bch2_rechecksum_bio() (memory corruption or bug?)\n" 430 + bch_err(c, "checksum error in %s() (memory corruption or bug?)\n" 432 431 "expected %0llx:%0llx got %0llx:%0llx (old type %s new type %s)", 432 + __func__, 433 433 crc_old.csum.hi, 434 434 crc_old.csum.lo, 435 435 merged.hi,
+2 -1
fs/bcachefs/compress.c
··· 643 643 static u64 compression_opt_to_feature(unsigned v) 644 644 { 645 645 unsigned type = bch2_compression_decode(v).type; 646 - return 1ULL << bch2_compression_opt_to_feature[type]; 646 + 647 + return BIT_ULL(bch2_compression_opt_to_feature[type]); 647 648 } 648 649 649 650 int bch2_fs_compress_init(struct bch_fs *c)
+6 -6
fs/bcachefs/extents.c
··· 517 517 switch (type) { 518 518 case BCH_EXTENT_ENTRY_crc32: 519 519 set_common_fields(dst->crc32, src); 520 - dst->crc32.csum = (u32 __force) *((__le32 *) &src.csum.lo); 520 + dst->crc32.csum = (u32 __force) *((__le32 *) &src.csum.lo); 521 521 break; 522 522 case BCH_EXTENT_ENTRY_crc64: 523 523 set_common_fields(dst->crc64, src); ··· 915 915 916 916 bkey_for_each_ptr_decode(k1.k, ptrs1, p1, entry1) 917 917 bkey_for_each_ptr_decode(k2.k, ptrs2, p2, entry2) 918 - if (p1.ptr.dev == p2.ptr.dev && 919 - p1.ptr.gen == p2.ptr.gen && 920 - (s64) p1.ptr.offset + p1.crc.offset - bkey_start_offset(k1.k) == 921 - (s64) p2.ptr.offset + p2.crc.offset - bkey_start_offset(k2.k)) 922 - return true; 918 + if (p1.ptr.dev == p2.ptr.dev && 919 + p1.ptr.gen == p2.ptr.gen && 920 + (s64) p1.ptr.offset + p1.crc.offset - bkey_start_offset(k1.k) == 921 + (s64) p2.ptr.offset + p2.crc.offset - bkey_start_offset(k2.k)) 922 + return true; 923 923 924 924 return false; 925 925 } else {
+1 -1
fs/bcachefs/fs-io.c
··· 2867 2867 2868 2868 folio = __filemap_get_folio(mapping, index, 2869 2869 FGP_LOCK|FGP_CREAT, GFP_KERNEL); 2870 - if (unlikely(IS_ERR_OR_NULL(folio))) { 2870 + if (IS_ERR_OR_NULL(folio)) { 2871 2871 ret = -ENOMEM; 2872 2872 goto out; 2873 2873 }
+1
fs/bcachefs/io.c
··· 2435 2435 2436 2436 if (rbio->bounce) { 2437 2437 struct bvec_iter src_iter = src->bi_iter; 2438 + 2438 2439 bio_copy_data_iter(dst, &dst_iter, src, &src_iter); 2439 2440 } 2440 2441 }
+1 -1
fs/bcachefs/io.h
··· 52 52 }; 53 53 54 54 enum bch_write_flags { 55 - #define x(f) BCH_WRITE_##f = 1U << __BCH_WRITE_##f, 55 + #define x(f) BCH_WRITE_##f = BIT(__BCH_WRITE_##f), 56 56 BCH_WRITE_FLAGS() 57 57 #undef x 58 58 };
+2 -2
fs/bcachefs/journal.c
··· 63 63 static void journal_pin_list_init(struct journal_entry_pin_list *p, int count) 64 64 { 65 65 unsigned i; 66 + 66 67 for (i = 0; i < ARRAY_SIZE(p->list); i++) 67 68 INIT_LIST_HEAD(&p->list[i]); 68 69 INIT_LIST_HEAD(&p->flushed); ··· 515 514 int ret; 516 515 517 516 closure_wait_event(&j->async_wait, 518 - (ret = __journal_res_get(j, res, flags)) != 519 - -BCH_ERR_journal_res_get_blocked|| 517 + (ret = __journal_res_get(j, res, flags)) != -BCH_ERR_journal_res_get_blocked || 520 518 (flags & JOURNAL_RES_GET_NONBLOCK)); 521 519 return ret; 522 520 }
+1 -1
fs/bcachefs/journal_io.c
··· 1053 1053 bch_err(c, "cur_idx %u/%u", ja->cur_idx, ja->nr); 1054 1054 for (i = 0; i < 3; i++) { 1055 1055 unsigned idx = (ja->cur_idx + ja->nr - 1 + i) % ja->nr; 1056 + 1056 1057 bch_err(c, "bucket_seq[%u] = %llu", idx, ja->bucket_seq[idx]); 1057 1058 } 1058 1059 ja->sectors_free = 0; ··· 1630 1629 } 1631 1630 1632 1631 continue_at(cl, journal_write_done, c->io_complete_wq); 1633 - return; 1634 1632 } 1635 1633 1636 1634 static void bch2_journal_entries_postprocess(struct bch_fs *c, struct jset *jset)
+1 -1
fs/bcachefs/journal_reclaim.c
··· 345 345 list_del_init(&pin->list); 346 346 347 347 /* 348 - * Unpinning a journal entry make make journal_next_bucket() succeed, if 348 + * Unpinning a journal entry may make journal_next_bucket() succeed, if 349 349 * writing a new last_seq will now make another bucket available: 350 350 */ 351 351 return atomic_dec_and_test(&pin_list->count) &&
+2 -2
fs/bcachefs/recovery.c
··· 648 648 move_gap(keys->d, keys->nr, keys->size, keys->gap, keys->nr); 649 649 keys->gap = keys->nr; 650 650 651 - keys_sorted = kvmalloc_array(sizeof(*keys_sorted), keys->nr, GFP_KERNEL); 651 + keys_sorted = kvmalloc_array(keys->nr, sizeof(*keys_sorted), GFP_KERNEL); 652 652 if (!keys_sorted) 653 653 return -BCH_ERR_ENOMEM_journal_replay; 654 654 ··· 1403 1403 } 1404 1404 1405 1405 c->journal_replay_seq_start = last_seq; 1406 - c->journal_replay_seq_end = blacklist_seq - 1;; 1406 + c->journal_replay_seq_end = blacklist_seq - 1; 1407 1407 1408 1408 if (c->opts.reconstruct_alloc) { 1409 1409 c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
+3 -1
fs/bcachefs/super-io.c
··· 553 553 d = (src_f ? le32_to_cpu(src_f->u64s) : 0) - 554 554 (dst_f ? le32_to_cpu(dst_f->u64s) : 0); 555 555 if (d > 0) { 556 - int ret = bch2_sb_realloc(dst_handle, le32_to_cpu(dst_handle->sb->u64s) + d); 556 + int ret = bch2_sb_realloc(dst_handle, 557 + le32_to_cpu(dst_handle->sb->u64s) + d); 558 + 557 559 if (ret) 558 560 return ret; 559 561
+1
fs/bcachefs/super-io.h
··· 58 58 static inline __le64 bch2_sb_magic(struct bch_fs *c) 59 59 { 60 60 __le64 ret; 61 + 61 62 memcpy(&ret, &c->sb.uuid, sizeof(ret)); 62 63 return ret; 63 64 }
+7 -4
fs/bcachefs/util.c
··· 216 216 217 217 while ((p = strsep(&s, ","))) { 218 218 int flag = match_string(list, -1, p); 219 + 219 220 if (flag < 0) { 220 221 ret = -1; 221 222 break; ··· 798 797 struct bvec_iter iter; 799 798 800 799 __bio_for_each_segment(bv, dst, iter, dst_iter) { 801 - void *dstp = kmap_atomic(bv.bv_page); 800 + void *dstp = kmap_local_page(bv.bv_page); 801 + 802 802 memcpy(dstp + bv.bv_offset, src, bv.bv_len); 803 - kunmap_atomic(dstp); 803 + kunmap_local(dstp); 804 804 805 805 src += bv.bv_len; 806 806 } ··· 813 811 struct bvec_iter iter; 814 812 815 813 __bio_for_each_segment(bv, src, iter, src_iter) { 816 - void *srcp = kmap_atomic(bv.bv_page); 814 + void *srcp = kmap_local_page(bv.bv_page); 815 + 817 816 memcpy(dst, srcp + bv.bv_offset, bv.bv_len); 818 - kunmap_atomic(srcp); 817 + kunmap_local(srcp); 819 818 820 819 dst += bv.bv_len; 821 820 }
+6 -2
fs/bcachefs/util.h
··· 467 467 s64 last_change; 468 468 s64 last_target; 469 469 470 - /* If true, the rate will not increase if bch2_ratelimit_delay() 471 - * is not being called often enough. */ 470 + /* 471 + * If true, the rate will not increase if bch2_ratelimit_delay() 472 + * is not being called often enough. 473 + */ 472 474 bool backpressure; 473 475 }; 474 476 ··· 606 604 { 607 605 #ifdef CONFIG_X86_64 608 606 long d0, d1, d2; 607 + 609 608 asm volatile("rep ; movsq" 610 609 : "=&c" (d0), "=&D" (d1), "=&S" (d2) 611 610 : "0" (u64s), "1" (dst), "2" (src) ··· 683 680 684 681 #ifdef CONFIG_X86_64 685 682 long d0, d1, d2; 683 + 686 684 asm volatile("std ;\n" 687 685 "rep ; movsq\n" 688 686 "cld ;\n"
+1
fs/bcachefs/varint.c
··· 59 59 60 60 if (likely(bytes < 9)) { 61 61 __le64 v_le = 0; 62 + 62 63 memcpy(&v_le, in, bytes); 63 64 v = le64_to_cpu(v_le); 64 65 v >>= bytes;