diff --git a/PKGBUILD b/PKGBUILD index 37dc486..ea20ac9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -835,7 +835,7 @@ case $_basever in '19661ec0d39f9663452b34433214c755179894528bf73a42f6ba52ccf572832a' '9df628fd530950e37d31da854cb314d536f33c83935adf5c47e71266a55f7004' 'd2255d8f60d90d1c1d76ab7808d4a04844b6a1b3c83390ac44de0e4b721c3577' - '40e7ecc52af379df1e362b32e5b9827815284dae895328556336cb0d10979b63' + '829631f803f11579972aa19f3f7f2ae11b0e380c01745a05776dd02b8e6c8855' '9fad4a40449e09522899955762c8928ae17f4cdaa16e01239fd12592e9d58177' 'a557b342111849a5f920bbe1c129f3ff1fc1eff62c6bd6685e0972fc88e39911' '6592ae4cadf0cfddd63fa77416a07131a926d3426df351c41490f361fc56495b' diff --git a/linux-tkg-patches/5.19/0008-5.19-bcachefs.patch b/linux-tkg-patches/5.19/0008-5.19-bcachefs.patch index d85f4e6..f1f6223 100644 --- a/linux-tkg-patches/5.19/0008-5.19-bcachefs.patch +++ b/linux-tkg-patches/5.19/0008-5.19-bcachefs.patch @@ -1,7 +1,7 @@ -From db2079ca2ce5000c3dfe3656c1c7f580b053a325 Mon Sep 17 00:00:00 2001 +From bb574d84674f3be67f0cf87aaa6bf99033c7db33 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Fri, 22 Jul 2022 14:23:53 +0200 -Subject: [PATCH] 5.19-bcachefs +Date: Fri, 5 Aug 2022 21:43:09 +0200 +Subject: [PATCH] bcachefs Signed-off-by: Peter Jung --- @@ -11,7 +11,7 @@ Signed-off-by: Peter Jung arch/powerpc/kernel/security.c | 75 +- arch/powerpc/platforms/pseries/papr_scm.c | 34 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 +- - block/bio.c | 34 +- + block/bio.c | 8 +- block/blk-core.c | 1 + block/blk.h | 1 - drivers/acpi/apei/erst-dbg.c | 1 + @@ -32,8 +32,8 @@ Signed-off-by: Peter Jung fs/bcachefs/acl.h | 58 + fs/bcachefs/alloc_background.c | 1552 ++++++++ fs/bcachefs/alloc_background.h | 183 + - fs/bcachefs/alloc_foreground.c | 1380 +++++++ - fs/bcachefs/alloc_foreground.h | 181 + + fs/bcachefs/alloc_foreground.c | 1305 ++++++ + fs/bcachefs/alloc_foreground.h | 173 + fs/bcachefs/alloc_types.h | 87 + fs/bcachefs/backpointers.c | 875 ++++ fs/bcachefs/backpointers.h | 38 + @@ -55,14 +55,14 @@ Signed-off-by: Peter Jung fs/bcachefs/btree_gc.h | 112 + fs/bcachefs/btree_io.c | 2150 ++++++++++ fs/bcachefs/btree_io.h | 222 ++ - fs/bcachefs/btree_iter.c | 3515 +++++++++++++++++ - fs/bcachefs/btree_iter.h | 556 +++ + fs/bcachefs/btree_iter.c | 3513 +++++++++++++++++ + fs/bcachefs/btree_iter.h | 550 +++ fs/bcachefs/btree_key_cache.c | 855 ++++ fs/bcachefs/btree_key_cache.h | 47 + fs/bcachefs/btree_locking.h | 289 ++ fs/bcachefs/btree_types.h | 697 ++++ fs/bcachefs/btree_update.h | 158 + - fs/bcachefs/btree_update_interior.c | 2266 +++++++++++ + fs/bcachefs/btree_update_interior.c | 2252 +++++++++++ fs/bcachefs/btree_update_interior.h | 321 ++ fs/bcachefs/btree_update_leaf.c | 1800 +++++++++ fs/bcachefs/buckets.c | 2113 ++++++++++ @@ -95,7 +95,7 @@ Signed-off-by: Peter Jung fs/bcachefs/ec.h | 230 ++ fs/bcachefs/ec_types.h | 46 + fs/bcachefs/errcode.c | 51 + - fs/bcachefs/errcode.h | 64 + + fs/bcachefs/errcode.h | 65 + fs/bcachefs/error.c | 184 + fs/bcachefs/error.h | 223 ++ fs/bcachefs/extent_update.c | 178 + @@ -107,7 +107,7 @@ Signed-off-by: Peter Jung fs/bcachefs/fifo.h | 127 + fs/bcachefs/fs-common.c | 496 +++ fs/bcachefs/fs-common.h | 43 + - fs/bcachefs/fs-io.c | 3496 ++++++++++++++++ + fs/bcachefs/fs-io.c | 3492 ++++++++++++++++ fs/bcachefs/fs-io.h | 56 + fs/bcachefs/fs-ioctl.c | 523 +++ fs/bcachefs/fs-ioctl.h | 81 + @@ -117,10 +117,10 @@ Signed-off-by: Peter Jung fs/bcachefs/fsck.h | 8 + fs/bcachefs/inode.c | 771 ++++ fs/bcachefs/inode.h | 189 + - fs/bcachefs/io.c | 2422 ++++++++++++ + fs/bcachefs/io.c | 2423 ++++++++++++ fs/bcachefs/io.h | 189 + fs/bcachefs/io_types.h | 161 + - fs/bcachefs/journal.c | 1429 +++++++ + fs/bcachefs/journal.c | 1432 +++++++ fs/bcachefs/journal.h | 521 +++ fs/bcachefs/journal_io.c | 1735 ++++++++ fs/bcachefs/journal_io.h | 59 + @@ -164,7 +164,7 @@ Signed-off-by: Peter Jung fs/bcachefs/subvolume.c | 1108 ++++++ fs/bcachefs/subvolume.h | 137 + fs/bcachefs/subvolume_types.h | 9 + - fs/bcachefs/super-io.c | 1602 ++++++++ + fs/bcachefs/super-io.c | 1605 ++++++++ fs/bcachefs/super-io.h | 126 + fs/bcachefs/super.c | 1950 +++++++++ fs/bcachefs/super.h | 264 ++ @@ -208,14 +208,13 @@ Signed-off-by: Peter Jung include/linux/vmalloc.h | 1 + include/net/9p/9p.h | 2 +- include/net/9p/client.h | 20 +- - include/trace/events/bcachefs.h | 1048 +++++ + include/trace/events/bcachefs.h | 1045 +++++ init/init_task.c | 1 + kernel/Kconfig.locks | 3 + kernel/locking/Makefile | 1 + kernel/locking/lockdep.c | 20 + kernel/locking/six.c | 759 ++++ kernel/module/main.c | 4 +- - kernel/stacktrace.c | 2 + kernel/trace/trace.c | 45 +- kernel/trace/trace_dynevent.c | 34 +- kernel/trace/trace_events_filter.c | 2 +- @@ -227,7 +226,6 @@ Signed-off-by: Peter Jung lib/Kconfig.debug | 9 + lib/Makefile | 8 +- {drivers/md/bcache => lib}/closure.c | 35 +- - lib/errname.c | 1 + lib/generic-radix-tree.c | 76 +- lib/hexdump.c | 246 +- lib/pretty-printers.c | 60 + @@ -239,7 +237,7 @@ Signed-off-by: Peter Jung lib/vsprintf.c | 1740 ++++---- mm/Makefile | 2 +- mm/filemap.c | 1 + - mm/memcontrol.c | 68 +- + mm/memcontrol.c | 76 +- mm/nommu.c | 18 + mm/oom_kill.c | 23 - {lib => mm}/show_mem.c | 8 + @@ -253,7 +251,7 @@ Signed-off-by: Peter Jung net/9p/trans_virtio.c | 4 +- net/9p/trans_xen.c | 2 +- tools/testing/nvdimm/test/ndtest.c | 22 +- - 248 files changed, 84382 insertions(+), 2223 deletions(-) + 246 files changed, 84261 insertions(+), 2219 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 fs/bcachefs/Kconfig create mode 100644 fs/bcachefs/Makefile @@ -425,7 +423,7 @@ Signed-off-by: Peter Jung diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 -index 000000000000..8af34357dd98 +index 0000000000000..8af34357dd989 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,61 @@ @@ -491,7 +489,7 @@ index 000000000000..8af34357dd98 +* provide the output of `bcachefs list_journal -a | zstd -f -T0 -o ../journal.log.zst` +*compress & upload all the `metdata.dump.*` files from: bcachefs dump -o metadata.dump diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst -index 5e89497ba314..4f4a35b3aadc 100644 +index 5e89497ba314e..4f4a35b3aadc2 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -625,6 +625,28 @@ Examples:: @@ -524,7 +522,7 @@ index 5e89497ba314..4f4a35b3aadc 100644 ====== diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c -index 0fbda89cd1bb..05654dbeb2c4 100644 +index 0fbda89cd1bb5..05654dbeb2c44 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -37,7 +37,7 @@ @@ -576,7 +574,7 @@ index 0fbda89cd1bb..05654dbeb2c4 100644 } diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c -index d96fd14bd7c9..b34de62e65ce 100644 +index d96fd14bd7c9c..b34de62e65ceb 100644 --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -10,7 +10,7 @@ @@ -725,7 +723,7 @@ index d96fd14bd7c9..b34de62e65ce 100644 #ifdef CONFIG_PPC_BOOK3S_64 diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c -index 82cae08976bc..fe2b41858b5f 100644 +index 82cae08976bcd..fe2b41858b5fe 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c @@ -12,7 +12,7 @@ @@ -818,7 +816,7 @@ index 82cae08976bc..fe2b41858b5f 100644 DEVICE_ATTR_RO(flags); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c -index f276aff521e8..50c12711a249 100644 +index f276aff521e8b..50c12711a249b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -19,7 +19,7 @@ @@ -885,7 +883,7 @@ index f276aff521e8..50c12711a249 100644 ret = rdtgroup_setup_root(); if (ret) diff --git a/block/bio.c b/block/bio.c -index 51c99f2c5c90..2d0d7f13d59a 100644 +index 51c99f2c5c908..480ac5a73232e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -582,15 +582,15 @@ struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask) @@ -907,43 +905,7 @@ index 51c99f2c5c90..2d0d7f13d59a 100644 /** * bio_truncate - truncate the bio to small size of @new_size -@@ -1363,17 +1363,27 @@ EXPORT_SYMBOL(__bio_advance); - void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, - struct bio *src, struct bvec_iter *src_iter) - { -+ struct bio_vec src_bv, dst_bv; -+ void *src_p, *dst_p; -+ unsigned bytes; -+ - while (src_iter->bi_size && dst_iter->bi_size) { -- struct bio_vec src_bv = bio_iter_iovec(src, *src_iter); -- struct bio_vec dst_bv = bio_iter_iovec(dst, *dst_iter); -- unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len); -- void *src_buf = bvec_kmap_local(&src_bv); -- void *dst_buf = bvec_kmap_local(&dst_bv); -+ src_bv = bio_iter_iovec(src, *src_iter); -+ dst_bv = bio_iter_iovec(dst, *dst_iter); -+ -+ bytes = min(src_bv.bv_len, dst_bv.bv_len); -+ -+ src_p = kmap_atomic(src_bv.bv_page); -+ dst_p = kmap_atomic(dst_bv.bv_page); -+ -+ memcpy(dst_p + dst_bv.bv_offset, -+ src_p + src_bv.bv_offset, -+ bytes); - -- memcpy(dst_buf, src_buf, bytes); -+ kunmap_atomic(dst_p); -+ kunmap_atomic(src_p); - -- kunmap_local(dst_buf); -- kunmap_local(src_buf); -+ flush_dcache_page(dst_bv.bv_page); - - bio_advance_iter_single(src, src_iter, bytes); - bio_advance_iter_single(dst, dst_iter, bytes); -@@ -1447,6 +1457,7 @@ void bio_set_pages_dirty(struct bio *bio) +@@ -1447,6 +1447,7 @@ void bio_set_pages_dirty(struct bio *bio) set_page_dirty_lock(bvec->bv_page); } } @@ -951,7 +913,7 @@ index 51c99f2c5c90..2d0d7f13d59a 100644 /* * bio_check_pages_dirty() will check that all the BIO's pages are still dirty. -@@ -1506,6 +1517,7 @@ void bio_check_pages_dirty(struct bio *bio) +@@ -1506,6 +1507,7 @@ void bio_check_pages_dirty(struct bio *bio) spin_unlock_irqrestore(&bio_dirty_lock, flags); schedule_work(&bio_dirty_work); } @@ -960,7 +922,7 @@ index 51c99f2c5c90..2d0d7f13d59a 100644 static inline bool bio_remaining_done(struct bio *bio) { diff --git a/block/blk-core.c b/block/blk-core.c -index 27fb1357ad4b..7697abda9fad 100644 +index 27fb1357ad4b8..7697abda9fadc 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -207,6 +207,7 @@ const char *blk_status_to_str(blk_status_t status) @@ -972,7 +934,7 @@ index 27fb1357ad4b..7697abda9fad 100644 /** * blk_sync_queue - cancel any pending callbacks on a queue diff --git a/block/blk.h b/block/blk.h -index 434017701403..066fd89c916b 100644 +index 434017701403f..066fd89c916ba 100644 --- a/block/blk.h +++ b/block/blk.h @@ -240,7 +240,6 @@ static inline void blk_integrity_del(struct gendisk *disk) @@ -984,7 +946,7 @@ index 434017701403..066fd89c916b 100644 bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio, unsigned int nr_segs); diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c -index 8bc71cdc2270..370993c9c381 100644 +index 8bc71cdc2270a..370993c9c3816 100644 --- a/drivers/acpi/apei/erst-dbg.c +++ b/drivers/acpi/apei/erst-dbg.c @@ -11,6 +11,7 @@ @@ -996,7 +958,7 @@ index 8bc71cdc2270..370993c9c381 100644 #include #include diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index 084f9b8a0ba3..7a420623ac38 100644 +index 084f9b8a0ba3c..7a420623ac384 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1166,8 +1166,6 @@ static void __loop_clr_fd(struct loop_device *lo, bool release) @@ -1009,7 +971,7 @@ index 084f9b8a0ba3..7a420623ac38 100644 int err; diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c -index 3748a39dae7c..7e3b48ed9d45 100644 +index 3748a39dae7cb..7e3b48ed9d455 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -5,7 +5,7 @@ @@ -1071,7 +1033,7 @@ index 3748a39dae7c..7e3b48ed9d45 100644 static int tegra_bpmp_probe_clocks(struct tegra_bpmp *bpmp, diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c -index 3088c5b829f0..a8c5f90e8208 100644 +index 3088c5b829f07..a8c5f90e8208b 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -19,7 +19,7 @@ @@ -1118,7 +1080,7 @@ index 3088c5b829f0..a8c5f90e8208 100644 /* diff --git a/drivers/md/bcache/Kconfig b/drivers/md/bcache/Kconfig -index cf3e8096942a..f1a1f0c4a0ea 100644 +index cf3e8096942a0..f1a1f0c4a0eaf 100644 --- a/drivers/md/bcache/Kconfig +++ b/drivers/md/bcache/Kconfig @@ -4,6 +4,7 @@ config BCACHE @@ -1146,7 +1108,7 @@ index cf3e8096942a..f1a1f0c4a0ea 100644 bool "Asynchronous device registration (EXPERIMENTAL)" depends on BCACHE diff --git a/drivers/md/bcache/Makefile b/drivers/md/bcache/Makefile -index 5b87e59676b8..054e8a33a7ab 100644 +index 5b87e59676b86..054e8a33a7ab1 100644 --- a/drivers/md/bcache/Makefile +++ b/drivers/md/bcache/Makefile @@ -2,6 +2,6 @@ @@ -1159,7 +1121,7 @@ index 5b87e59676b8..054e8a33a7ab 100644 + journal.o movinggc.o request.o stats.o super.o sysfs.o trace.o\ util.o writeback.o features.o diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h -index 2acda9cea0f9..bf96b3e6b6eb 100644 +index 2acda9cea0f90..bf96b3e6b6eb8 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -179,6 +179,7 @@ @@ -1179,7 +1141,7 @@ index 2acda9cea0f9..bf96b3e6b6eb 100644 struct bucket { atomic_t pin; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 3563d15dbaf2..9249aba333bc 100644 +index 3563d15dbaf27..9249aba333bcd 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -2913,7 +2913,6 @@ static int __init bcache_init(void) @@ -1191,7 +1153,7 @@ index 3563d15dbaf2..9249aba333bc 100644 bcache_is_reboot = false; diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h -index 6f3cb7c92130..f61ab1bada6c 100644 +index 6f3cb7c921303..f61ab1bada6cf 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -4,6 +4,7 @@ @@ -1212,7 +1174,7 @@ index 6f3cb7c92130..f61ab1bada6c 100644 #ifdef CONFIG_BCACHE_DEBUG diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c -index 462b429ad243..f06328035b9c 100644 +index 462b429ad2434..f06328035b9c6 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -17,7 +17,7 @@ @@ -1287,7 +1249,7 @@ index 462b429ad243..f06328035b9c 100644 acs_redirects = true; diff --git a/fs/Kconfig b/fs/Kconfig -index 5976eb33535f..6d2c4231494a 100644 +index 5976eb33535ff..6d2c4231494a4 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -40,6 +40,7 @@ source "fs/ocfs2/Kconfig" @@ -1299,7 +1261,7 @@ index 5976eb33535f..6d2c4231494a 100644 endif # BLOCK diff --git a/fs/Makefile b/fs/Makefile -index 208a74e0b00e..5d5c8c792058 100644 +index 208a74e0b00e1..5d5c8c7920584 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -134,6 +134,7 @@ obj-$(CONFIG_OCFS2_FS) += ocfs2/ @@ -1312,7 +1274,7 @@ index 208a74e0b00e..5d5c8c792058 100644 obj-$(CONFIG_EFIVAR_FS) += efivarfs/ diff --git a/fs/bcachefs/Kconfig b/fs/bcachefs/Kconfig new file mode 100644 -index 000000000000..008886967841 +index 0000000000000..0088869678419 --- /dev/null +++ b/fs/bcachefs/Kconfig @@ -0,0 +1,59 @@ @@ -1377,7 +1339,7 @@ index 000000000000..008886967841 + Expose statistics for how long we held a lock in debugfs diff --git a/fs/bcachefs/Makefile b/fs/bcachefs/Makefile new file mode 100644 -index 000000000000..5dad8ed03a20 +index 0000000000000..5dad8ed03a20a --- /dev/null +++ b/fs/bcachefs/Makefile @@ -0,0 +1,69 @@ @@ -1452,7 +1414,7 @@ index 000000000000..5dad8ed03a20 +bcachefs-$(CONFIG_BCACHEFS_POSIX_ACL) += acl.o diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c new file mode 100644 -index 000000000000..5c6ccf685094 +index 0000000000000..5c6ccf6850940 --- /dev/null +++ b/fs/bcachefs/acl.c @@ -0,0 +1,406 @@ @@ -1864,7 +1826,7 @@ index 000000000000..5c6ccf685094 +#endif /* CONFIG_BCACHEFS_POSIX_ACL */ diff --git a/fs/bcachefs/acl.h b/fs/bcachefs/acl.h new file mode 100644 -index 000000000000..2d76a4897ba8 +index 0000000000000..2d76a4897ba89 --- /dev/null +++ b/fs/bcachefs/acl.h @@ -0,0 +1,58 @@ @@ -1928,7 +1890,7 @@ index 000000000000..2d76a4897ba8 +#endif /* _BCACHEFS_ACL_H */ diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c new file mode 100644 -index 000000000000..cd6cbd2064ee +index 0000000000000..2281b8d45982a --- /dev/null +++ b/fs/bcachefs/alloc_background.c @@ -0,0 +1,1552 @@ @@ -3006,7 +2968,7 @@ index 000000000000..cd6cbd2064ee + blkdev_issue_discard(ca->disk_sb.bdev, + k.k->p.offset * ca->mi.bucket_size, + ca->mi.bucket_size, -+ GFP_KERNEL, 0); ++ GFP_KERNEL); + + ret = bch2_trans_relock(trans); + if (ret) @@ -3486,7 +3448,7 @@ index 000000000000..cd6cbd2064ee +} diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h new file mode 100644 -index 000000000000..044bc72992d4 +index 0000000000000..044bc72992d41 --- /dev/null +++ b/fs/bcachefs/alloc_background.h @@ -0,0 +1,183 @@ @@ -3675,10 +3637,10 @@ index 000000000000..044bc72992d4 +#endif /* _BCACHEFS_ALLOC_BACKGROUND_H */ diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c new file mode 100644 -index 000000000000..6e52230e69e1 +index 0000000000000..0a9f1313414b7 --- /dev/null +++ b/fs/bcachefs/alloc_foreground.c -@@ -0,0 +1,1380 @@ +@@ -0,0 +1,1305 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2012 Google, Inc. @@ -4020,8 +3982,6 @@ index 000000000000..6e52230e69e1 + skipped_need_journal_commit, + skipped_nouse, + cl); -+ if (!ob) -+ iter.path->preserve = false; +err: + set_btree_iter_dontneed(&iter); + bch2_trans_iter_exit(trans, &iter); @@ -4062,15 +4022,15 @@ index 000000000000..6e52230e69e1 + * journal buckets - journal buckets will be < ca->new_fs_bucket_idx + */ +static noinline struct open_bucket * -+bch2_bucket_alloc_early(struct btree_trans *trans, -+ struct bch_dev *ca, -+ enum alloc_reserve reserve, -+ u64 *cur_bucket, -+ u64 *buckets_seen, -+ u64 *skipped_open, -+ u64 *skipped_need_journal_commit, -+ u64 *skipped_nouse, -+ struct closure *cl) ++bch2_bucket_alloc_trans_early(struct btree_trans *trans, ++ struct bch_dev *ca, ++ enum alloc_reserve reserve, ++ u64 *cur_bucket, ++ u64 *buckets_seen, ++ u64 *skipped_open, ++ u64 *skipped_need_journal_commit, ++ u64 *skipped_nouse, ++ struct closure *cl) +{ + struct btree_iter iter; + struct bkey_s_c k; @@ -4113,7 +4073,7 @@ index 000000000000..6e52230e69e1 + return ob ?: ERR_PTR(ret ?: -BCH_ERR_no_buckets_found); +} + -+static struct open_bucket *bch2_bucket_alloc_freelist(struct btree_trans *trans, ++static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans, + struct bch_dev *ca, + enum alloc_reserve reserve, + u64 *cur_bucket, @@ -4128,6 +4088,15 @@ index 000000000000..6e52230e69e1 + struct open_bucket *ob = NULL; + int ret; + ++ if (unlikely(!ca->mi.freespace_initialized)) ++ return bch2_bucket_alloc_trans_early(trans, ca, reserve, ++ cur_bucket, ++ buckets_seen, ++ skipped_open, ++ skipped_need_journal_commit, ++ skipped_nouse, ++ cl); ++ + BUG_ON(ca->new_fs_bucket_idx); + + /* @@ -4141,7 +4110,7 @@ index 000000000000..6e52230e69e1 + break; + + for (*cur_bucket = max(*cur_bucket, bkey_start_offset(k.k)); -+ *cur_bucket < k.k->p.offset; ++ *cur_bucket < k.k->p.offset && !ob; + (*cur_bucket)++) { + ret = btree_trans_too_many_iters(trans); + if (ret) @@ -4155,8 +4124,6 @@ index 000000000000..6e52230e69e1 + skipped_need_journal_commit, + skipped_nouse, + k, cl); -+ if (ob) -+ break; + } + + if (ob || ret) @@ -4172,13 +4139,11 @@ index 000000000000..6e52230e69e1 + * + * Returns index of bucket on success, 0 on failure + * */ -+static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans, -+ struct bch_dev *ca, ++struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca, + enum alloc_reserve reserve, + bool may_alloc_partial, + struct closure *cl) +{ -+ struct bch_fs *c = trans->c; + struct open_bucket *ob = NULL; + struct bch_dev_usage usage; + bool freespace_initialized = READ_ONCE(ca->mi.freespace_initialized); @@ -4227,21 +4192,14 @@ index 000000000000..6e52230e69e1 + return ob; + } + -+ ob = likely(ca->mi.freespace_initialized) -+ ? bch2_bucket_alloc_freelist(trans, ca, reserve, -+ &cur_bucket, -+ &buckets_seen, -+ &skipped_open, -+ &skipped_need_journal_commit, -+ &skipped_nouse, -+ cl) -+ : bch2_bucket_alloc_early(trans, ca, reserve, -+ &cur_bucket, -+ &buckets_seen, -+ &skipped_open, -+ &skipped_need_journal_commit, -+ &skipped_nouse, -+ cl); ++ ret = bch2_trans_do(c, NULL, NULL, 0, ++ PTR_ERR_OR_ZERO(ob = bch2_bucket_alloc_trans(&trans, ca, reserve, ++ &cur_bucket, ++ &buckets_seen, ++ &skipped_open, ++ &skipped_need_journal_commit, ++ &skipped_nouse, ++ cl))); + + if (skipped_need_journal_commit * 2 > avail) + bch2_journal_flush_async(&c->journal, NULL); @@ -4275,19 +4233,6 @@ index 000000000000..6e52230e69e1 + return ob; +} + -+struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca, -+ enum alloc_reserve reserve, -+ bool may_alloc_partial, -+ struct closure *cl) -+{ -+ struct open_bucket *ob; -+ -+ bch2_trans_do(c, NULL, NULL, 0, -+ PTR_ERR_OR_ZERO(ob = bch2_bucket_alloc_trans(&trans, ca, reserve, -+ may_alloc_partial, cl))); -+ return ob; -+} -+ +static int __dev_stripe_cmp(struct dev_stripe_state *stripe, + unsigned l, unsigned r) +{ @@ -4353,7 +4298,7 @@ index 000000000000..6e52230e69e1 + ob_push(c, ptrs, ob); +} + -+static int bch2_bucket_alloc_set_trans(struct btree_trans *trans, ++int bch2_bucket_alloc_set(struct bch_fs *c, + struct open_buckets *ptrs, + struct dev_stripe_state *stripe, + struct bch_devs_mask *devs_may_alloc, @@ -4364,7 +4309,6 @@ index 000000000000..6e52230e69e1 + unsigned flags, + struct closure *cl) +{ -+ struct bch_fs *c = trans->c; + struct dev_alloc_list devs_sorted = + bch2_dev_alloc_list(c, stripe, devs_may_alloc); + unsigned dev; @@ -4393,7 +4337,7 @@ index 000000000000..6e52230e69e1 + continue; + } + -+ ob = bch2_bucket_alloc_trans(trans, ca, reserve, ++ ob = bch2_bucket_alloc(c, ca, reserve, + flags & BUCKET_MAY_ALLOC_PARTIAL, cl); + if (!IS_ERR(ob)) + bch2_dev_stripe_increment(ca, stripe); @@ -4401,7 +4345,8 @@ index 000000000000..6e52230e69e1 + + if (IS_ERR(ob)) { + ret = PTR_ERR(ob); -+ if (ret == -EINTR || cl) ++ ++ if (cl) + break; + continue; + } @@ -4418,24 +4363,6 @@ index 000000000000..6e52230e69e1 + return ret; +} + -+int bch2_bucket_alloc_set(struct bch_fs *c, -+ struct open_buckets *ptrs, -+ struct dev_stripe_state *stripe, -+ struct bch_devs_mask *devs_may_alloc, -+ unsigned nr_replicas, -+ unsigned *nr_effective, -+ bool *have_cache, -+ enum alloc_reserve reserve, -+ unsigned flags, -+ struct closure *cl) -+{ -+ return bch2_trans_do(c, NULL, NULL, 0, -+ bch2_bucket_alloc_set_trans(&trans, ptrs, stripe, -+ devs_may_alloc, nr_replicas, -+ nr_effective, have_cache, reserve, -+ flags, cl)); -+} -+ +/* Allocate from stripes: */ + +/* @@ -4540,7 +4467,7 @@ index 000000000000..6e52230e69e1 + wp->ptrs = ptrs_skip; +} + -+static int open_bucket_add_buckets(struct btree_trans *trans, ++static int open_bucket_add_buckets(struct bch_fs *c, + struct open_buckets *ptrs, + struct write_point *wp, + struct bch_devs_list *devs_have, @@ -4553,7 +4480,6 @@ index 000000000000..6e52230e69e1 + unsigned flags, + struct closure *_cl) +{ -+ struct bch_fs *c = trans->c; + struct bch_devs_mask devs; + struct open_bucket *ob; + struct closure *cl = NULL; @@ -4585,8 +4511,7 @@ index 000000000000..6e52230e69e1 + target, erasure_code, + nr_replicas, nr_effective, + have_cache, flags, _cl); -+ if (bch2_err_matches(ret, BCH_ERR_transaction_restart) || -+ bch2_err_matches(ret, BCH_ERR_freelist_empty) || ++ if (bch2_err_matches(ret, BCH_ERR_freelist_empty) || + bch2_err_matches(ret, BCH_ERR_open_buckets_empty)) + return ret; + if (*nr_effective >= nr_replicas) @@ -4605,11 +4530,10 @@ index 000000000000..6e52230e69e1 + * Try nonblocking first, so that if one device is full we'll try from + * other devices: + */ -+ ret = bch2_bucket_alloc_set_trans(trans, ptrs, &wp->stripe, &devs, ++ ret = bch2_bucket_alloc_set(c, ptrs, &wp->stripe, &devs, + nr_replicas, nr_effective, have_cache, + reserve, flags, cl); + if (ret && -+ !bch2_err_matches(ret, BCH_ERR_transaction_restart) && + !bch2_err_matches(ret, BCH_ERR_insufficient_devices) && + !cl && _cl) { + cl = _cl; @@ -4729,25 +4653,15 @@ index 000000000000..6e52230e69e1 + return true; +} + -+static void bch2_trans_mutex_lock(struct btree_trans *trans, -+ struct mutex *lock) -+{ -+ if (!mutex_trylock(lock)) { -+ bch2_trans_unlock(trans); -+ mutex_lock(lock); -+ } -+} -+ -+static struct write_point *writepoint_find(struct btree_trans *trans, ++static struct write_point *writepoint_find(struct bch_fs *c, + unsigned long write_point) +{ -+ struct bch_fs *c = trans->c; + struct write_point *wp, *oldest; + struct hlist_head *head; + + if (!(write_point & 1UL)) { + wp = (struct write_point *) write_point; -+ bch2_trans_mutex_lock(trans, &wp->lock); ++ mutex_lock(&wp->lock); + return wp; + } + @@ -4756,7 +4670,7 @@ index 000000000000..6e52230e69e1 + wp = __writepoint_find(head, write_point); + if (wp) { +lock_wp: -+ bch2_trans_mutex_lock(trans, &wp->lock); ++ mutex_lock(&wp->lock); + if (wp->write_point == write_point) + goto out; + mutex_unlock(&wp->lock); @@ -4769,8 +4683,8 @@ index 000000000000..6e52230e69e1 + if (!oldest || time_before64(wp->last_used, oldest->last_used)) + oldest = wp; + -+ bch2_trans_mutex_lock(trans, &oldest->lock); -+ bch2_trans_mutex_lock(trans, &c->write_points_hash_lock); ++ mutex_lock(&oldest->lock); ++ mutex_lock(&c->write_points_hash_lock); + if (oldest >= c->write_points + c->write_points_nr || + try_increase_writepoints(c)) { + mutex_unlock(&c->write_points_hash_lock); @@ -4798,7 +4712,7 @@ index 000000000000..6e52230e69e1 +/* + * Get us an open_bucket we can allocate from, return with it locked: + */ -+struct write_point *bch2_alloc_sectors_start_trans(struct btree_trans *trans, ++struct write_point *bch2_alloc_sectors_start(struct bch_fs *c, + unsigned target, + unsigned erasure_code, + struct write_point_specifier write_point, @@ -4809,7 +4723,6 @@ index 000000000000..6e52230e69e1 + unsigned flags, + struct closure *cl) +{ -+ struct bch_fs *c = trans->c; + struct write_point *wp; + struct open_bucket *ob; + struct open_buckets ptrs; @@ -4829,7 +4742,7 @@ index 000000000000..6e52230e69e1 + write_points_nr = c->write_points_nr; + have_cache = false; + -+ wp = writepoint_find(trans, write_point.v); ++ wp = writepoint_find(c, write_point.v); + + if (wp->data_type == BCH_DATA_user) + ob_flags |= BUCKET_MAY_ALLOC_PARTIAL; @@ -4839,21 +4752,21 @@ index 000000000000..6e52230e69e1 + have_cache = true; + + if (!target || (flags & BCH_WRITE_ONLY_SPECIFIED_DEVS)) { -+ ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, ++ ret = open_bucket_add_buckets(c, &ptrs, wp, devs_have, + target, erasure_code, + nr_replicas, &nr_effective, + &have_cache, reserve, + ob_flags, cl); + } else { -+ ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, ++ ret = open_bucket_add_buckets(c, &ptrs, wp, devs_have, + target, erasure_code, + nr_replicas, &nr_effective, + &have_cache, reserve, + ob_flags, NULL); -+ if (!ret || ret == -EINTR) ++ if (!ret) + goto alloc_done; + -+ ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, ++ ret = open_bucket_add_buckets(c, &ptrs, wp, devs_have, + 0, erasure_code, + nr_replicas, &nr_effective, + &have_cache, reserve, @@ -4910,32 +4823,6 @@ index 000000000000..6e52230e69e1 + return ERR_PTR(ret); +} + -+struct write_point *bch2_alloc_sectors_start(struct bch_fs *c, -+ unsigned target, -+ unsigned erasure_code, -+ struct write_point_specifier write_point, -+ struct bch_devs_list *devs_have, -+ unsigned nr_replicas, -+ unsigned nr_replicas_required, -+ enum alloc_reserve reserve, -+ unsigned flags, -+ struct closure *cl) -+{ -+ struct write_point *wp; -+ -+ bch2_trans_do(c, NULL, NULL, 0, -+ PTR_ERR_OR_ZERO(wp = bch2_alloc_sectors_start_trans(&trans, target, -+ erasure_code, -+ write_point, -+ devs_have, -+ nr_replicas, -+ nr_replicas_required, -+ reserve, -+ flags, cl))); -+ return wp; -+ -+} -+ +struct bch_extent_ptr bch2_ob_ptr(struct bch_fs *c, struct open_bucket *ob) +{ + struct bch_dev *ca = bch_dev_bkey_exists(c, ob->dev); @@ -5061,10 +4948,10 @@ index 000000000000..6e52230e69e1 +} diff --git a/fs/bcachefs/alloc_foreground.h b/fs/bcachefs/alloc_foreground.h new file mode 100644 -index 000000000000..6de63a351fa8 +index 0000000000000..8bc78877f0fc8 --- /dev/null +++ b/fs/bcachefs/alloc_foreground.h -@@ -0,0 +1,181 @@ +@@ -0,0 +1,173 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _BCACHEFS_ALLOC_FOREGROUND_H +#define _BCACHEFS_ALLOC_FOREGROUND_H @@ -5203,14 +5090,6 @@ index 000000000000..6de63a351fa8 + unsigned, unsigned *, bool *, enum alloc_reserve, + unsigned, struct closure *); + -+struct write_point *bch2_alloc_sectors_start_trans(struct btree_trans *, -+ unsigned, unsigned, -+ struct write_point_specifier, -+ struct bch_devs_list *, -+ unsigned, unsigned, -+ enum alloc_reserve, -+ unsigned, -+ struct closure *); +struct write_point *bch2_alloc_sectors_start(struct bch_fs *, + unsigned, unsigned, + struct write_point_specifier, @@ -5248,7 +5127,7 @@ index 000000000000..6de63a351fa8 +#endif /* _BCACHEFS_ALLOC_FOREGROUND_H */ diff --git a/fs/bcachefs/alloc_types.h b/fs/bcachefs/alloc_types.h new file mode 100644 -index 000000000000..e078584d46f6 +index 0000000000000..e078584d46f65 --- /dev/null +++ b/fs/bcachefs/alloc_types.h @@ -0,0 +1,87 @@ @@ -5341,7 +5220,7 @@ index 000000000000..e078584d46f6 +#endif /* _BCACHEFS_ALLOC_TYPES_H */ diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c new file mode 100644 -index 000000000000..5a46b25b0587 +index 0000000000000..5a46b25b0587e --- /dev/null +++ b/fs/bcachefs/backpointers.c @@ -0,0 +1,875 @@ @@ -6222,7 +6101,7 @@ index 000000000000..5a46b25b0587 +} diff --git a/fs/bcachefs/backpointers.h b/fs/bcachefs/backpointers.h new file mode 100644 -index 000000000000..fe42af296e9c +index 0000000000000..fe42af296e9ca --- /dev/null +++ b/fs/bcachefs/backpointers.h @@ -0,0 +1,38 @@ @@ -6266,7 +6145,7 @@ index 000000000000..fe42af296e9c +#endif /* _BCACHEFS_BACKPOINTERS_BACKGROUND_H */ diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h new file mode 100644 -index 000000000000..8ffdb4dee47a +index 0000000000000..8ffdb4dee47ae --- /dev/null +++ b/fs/bcachefs/bcachefs.h @@ -0,0 +1,1000 @@ @@ -7272,7 +7151,7 @@ index 000000000000..8ffdb4dee47a +#endif /* _BCACHEFS_H */ diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h new file mode 100644 -index 000000000000..147fde1417b0 +index 0000000000000..147fde1417b05 --- /dev/null +++ b/fs/bcachefs/bcachefs_format.h @@ -0,0 +1,2052 @@ @@ -9330,7 +9209,7 @@ index 000000000000..147fde1417b0 +#endif /* _BCACHEFS_FORMAT_H */ diff --git a/fs/bcachefs/bcachefs_ioctl.h b/fs/bcachefs/bcachefs_ioctl.h new file mode 100644 -index 000000000000..b2edabf58260 +index 0000000000000..b2edabf58260d --- /dev/null +++ b/fs/bcachefs/bcachefs_ioctl.h @@ -0,0 +1,368 @@ @@ -9704,7 +9583,7 @@ index 000000000000..b2edabf58260 +#endif /* _BCACHEFS_IOCTL_H */ diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c new file mode 100644 -index 000000000000..cc0689635164 +index 0000000000000..cc06896351640 --- /dev/null +++ b/fs/bcachefs/bkey.c @@ -0,0 +1,1175 @@ @@ -10885,7 +10764,7 @@ index 000000000000..cc0689635164 +#endif diff --git a/fs/bcachefs/bkey.h b/fs/bcachefs/bkey.h new file mode 100644 -index 000000000000..7dee3d8e0a3d +index 0000000000000..7dee3d8e0a3d1 --- /dev/null +++ b/fs/bcachefs/bkey.h @@ -0,0 +1,566 @@ @@ -11457,7 +11336,7 @@ index 000000000000..7dee3d8e0a3d +#endif /* _BCACHEFS_BKEY_H */ diff --git a/fs/bcachefs/bkey_buf.h b/fs/bcachefs/bkey_buf.h new file mode 100644 -index 000000000000..0d7c67a959af +index 0000000000000..0d7c67a959af1 --- /dev/null +++ b/fs/bcachefs/bkey_buf.h @@ -0,0 +1,60 @@ @@ -11523,7 +11402,7 @@ index 000000000000..0d7c67a959af +#endif /* _BCACHEFS_BKEY_BUF_H */ diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c new file mode 100644 -index 000000000000..e0cbac8811af +index 0000000000000..e0cbac8811afa --- /dev/null +++ b/fs/bcachefs/bkey_methods.c @@ -0,0 +1,503 @@ @@ -12032,7 +11911,7 @@ index 000000000000..e0cbac8811af +} diff --git a/fs/bcachefs/bkey_methods.h b/fs/bcachefs/bkey_methods.h new file mode 100644 -index 000000000000..db894b40d2ca +index 0000000000000..db894b40d2ca4 --- /dev/null +++ b/fs/bcachefs/bkey_methods.h @@ -0,0 +1,175 @@ @@ -12213,7 +12092,7 @@ index 000000000000..db894b40d2ca +#endif /* _BCACHEFS_BKEY_METHODS_H */ diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c new file mode 100644 -index 000000000000..b1385a77da11 +index 0000000000000..b1385a77da114 --- /dev/null +++ b/fs/bcachefs/bkey_sort.c @@ -0,0 +1,198 @@ @@ -12417,7 +12296,7 @@ index 000000000000..b1385a77da11 +} diff --git a/fs/bcachefs/bkey_sort.h b/fs/bcachefs/bkey_sort.h new file mode 100644 -index 000000000000..79cf11d1b4e7 +index 0000000000000..79cf11d1b4e7e --- /dev/null +++ b/fs/bcachefs/bkey_sort.h @@ -0,0 +1,44 @@ @@ -12467,7 +12346,7 @@ index 000000000000..79cf11d1b4e7 +#endif /* _BCACHEFS_BKEY_SORT_H */ diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c new file mode 100644 -index 000000000000..fa60ef84e4ef +index 0000000000000..fa60ef84e4ef0 --- /dev/null +++ b/fs/bcachefs/bset.c @@ -0,0 +1,1598 @@ @@ -14071,7 +13950,7 @@ index 000000000000..fa60ef84e4ef +} diff --git a/fs/bcachefs/bset.h b/fs/bcachefs/bset.h new file mode 100644 -index 000000000000..0d46534c3dcd +index 0000000000000..0d46534c3dcd1 --- /dev/null +++ b/fs/bcachefs/bset.h @@ -0,0 +1,615 @@ @@ -14692,7 +14571,7 @@ index 000000000000..0d46534c3dcd +#endif /* _BCACHEFS_BSET_H */ diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c new file mode 100644 -index 000000000000..579a8f8c6a65 +index 0000000000000..579a8f8c6a65f --- /dev/null +++ b/fs/bcachefs/btree_cache.c @@ -0,0 +1,1170 @@ @@ -15868,7 +15747,7 @@ index 000000000000..579a8f8c6a65 +} diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h new file mode 100644 -index 000000000000..25906127c023 +index 0000000000000..25906127c0231 --- /dev/null +++ b/fs/bcachefs/btree_cache.h @@ -0,0 +1,107 @@ @@ -15981,7 +15860,7 @@ index 000000000000..25906127c023 +#endif /* _BCACHEFS_BTREE_CACHE_H */ diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c new file mode 100644 -index 000000000000..2f563365ea4c +index 0000000000000..2f563365ea4cb --- /dev/null +++ b/fs/bcachefs/btree_gc.c @@ -0,0 +1,2098 @@ @@ -18085,7 +17964,7 @@ index 000000000000..2f563365ea4c +} diff --git a/fs/bcachefs/btree_gc.h b/fs/bcachefs/btree_gc.h new file mode 100644 -index 000000000000..95d803b5743d +index 0000000000000..95d803b5743de --- /dev/null +++ b/fs/bcachefs/btree_gc.h @@ -0,0 +1,112 @@ @@ -18203,7 +18082,7 @@ index 000000000000..95d803b5743d +#endif /* _BCACHEFS_BTREE_GC_H */ diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c new file mode 100644 -index 000000000000..ae731b3a3908 +index 0000000000000..ae731b3a39084 --- /dev/null +++ b/fs/bcachefs/btree_io.c @@ -0,0 +1,2150 @@ @@ -20359,7 +20238,7 @@ index 000000000000..ae731b3a3908 +} diff --git a/fs/bcachefs/btree_io.h b/fs/bcachefs/btree_io.h new file mode 100644 -index 000000000000..8af853642123 +index 0000000000000..8af853642123d --- /dev/null +++ b/fs/bcachefs/btree_io.h @@ -0,0 +1,222 @@ @@ -20587,10 +20466,10 @@ index 000000000000..8af853642123 +#endif /* _BCACHEFS_BTREE_IO_H */ diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c new file mode 100644 -index 000000000000..a90a45939aa3 +index 0000000000000..c6c0e24003869 --- /dev/null +++ b/fs/bcachefs/btree_iter.c -@@ -0,0 +1,3515 @@ +@@ -0,0 +1,3513 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "bcachefs.h" @@ -24021,18 +23900,18 @@ index 000000000000..a90a45939aa3 + +static void __maybe_unused +bch2_btree_path_node_to_text(struct printbuf *out, -+ struct btree_bkey_cached_common *_b, ++ struct btree_bkey_cached_common *b, + bool cached) +{ + prt_printf(out, " l=%u %s:", -+ _b->level, bch2_btree_ids[_b->btree_id]); -+ bch2_bpos_to_text(out, btree_node_pos(_b, cached)); ++ b->level, bch2_btree_ids[b->btree_id]); ++ bch2_bpos_to_text(out, btree_node_pos(b, cached)); +} + +void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans) +{ + struct btree_path *path; -+ struct btree *b; ++ struct btree_bkey_cached_common *b; + static char lock_types[] = { 'r', 'i', 'w' }; + unsigned l; + @@ -24051,12 +23930,11 @@ index 000000000000..a90a45939aa3 + prt_printf(out, "\n"); + + for (l = 0; l < BTREE_MAX_DEPTH; l++) { -+ if (btree_node_locked(path, l)) { ++ if (btree_node_locked(path, l) && ++ (unsigned long) (b = (void *) READ_ONCE(path->l[l].b)) >= 128) { + prt_printf(out, " %s l=%u ", + btree_node_intent_locked(path, l) ? "i" : "r", l); -+ bch2_btree_path_node_to_text(out, -+ (void *) path->l[l].b, -+ path->cached); ++ bch2_btree_path_node_to_text(out, b, path->cached); + prt_printf(out, "\n"); + } + } @@ -24074,8 +23952,7 @@ index 000000000000..a90a45939aa3 + bch2_bpos_to_text(out, trans->locking_pos); + + prt_printf(out, " node "); -+ bch2_btree_path_node_to_text(out, -+ (void *) b, path->cached); ++ bch2_btree_path_node_to_text(out, b, path->cached); + prt_printf(out, "\n"); + } +} @@ -24108,10 +23985,10 @@ index 000000000000..a90a45939aa3 +} diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h new file mode 100644 -index 000000000000..1b02f75d4cab +index 0000000000000..6041bbfbf6d19 --- /dev/null +++ b/fs/bcachefs/btree_iter.h -@@ -0,0 +1,556 @@ +@@ -0,0 +1,550 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _BCACHEFS_BTREE_ITER_H +#define _BCACHEFS_BTREE_ITER_H @@ -24505,17 +24382,13 @@ index 000000000000..1b02f75d4cab + +#define lockrestart_do(_trans, _do) \ +({ \ -+ u32 _restart_count; \ + int _ret; \ + \ + do { \ -+ _restart_count = bch2_trans_begin(_trans); \ ++ bch2_trans_begin(_trans); \ + _ret = (_do); \ + } while (bch2_err_matches(_ret, BCH_ERR_transaction_restart)); \ + \ -+ if (!_ret) \ -+ bch2_trans_verify_not_restarted(_trans, _restart_count);\ -+ \ + _ret; \ +}) + @@ -24556,7 +24429,7 @@ index 000000000000..1b02f75d4cab + (_start), (_flags)); \ + \ + while (1) { \ -+ u32 _restart_count = bch2_trans_begin(_trans); \ ++ bch2_trans_begin(_trans); \ + (_k) = bch2_btree_iter_peek_type(&(_iter), (_flags)); \ + if (!(_k).k) { \ + _ret = 0; \ @@ -24568,7 +24441,6 @@ index 000000000000..1b02f75d4cab + continue; \ + if (_ret) \ + break; \ -+ bch2_trans_verify_not_restarted(_trans, _restart_count);\ + if (!bch2_btree_iter_advance(&(_iter))) \ + break; \ + } \ @@ -24586,7 +24458,7 @@ index 000000000000..1b02f75d4cab + (_start), (_flags)); \ + \ + while (1) { \ -+ u32 _restart_count = bch2_trans_begin(_trans); \ ++ bch2_trans_begin(_trans); \ + (_k) = bch2_btree_iter_peek_prev_type(&(_iter), (_flags));\ + if (!(_k).k) { \ + _ret = 0; \ @@ -24598,7 +24470,6 @@ index 000000000000..1b02f75d4cab + continue; \ + if (_ret) \ + break; \ -+ bch2_trans_verify_not_restarted(_trans, _restart_count);\ + if (!bch2_btree_iter_rewind(&(_iter))) \ + break; \ + } \ @@ -24670,7 +24541,7 @@ index 000000000000..1b02f75d4cab +#endif /* _BCACHEFS_BTREE_ITER_H */ diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c new file mode 100644 -index 000000000000..661006e427f2 +index 0000000000000..b36df9a718bd1 --- /dev/null +++ b/fs/bcachefs/btree_key_cache.c @@ -0,0 +1,855 @@ @@ -25093,7 +24964,7 @@ index 000000000000..661006e427f2 + if (!path->locks_want && + !__bch2_btree_path_upgrade(trans, path, 1)) { + trace_transaction_restart_ip(trans->fn, _THIS_IP_); -+ ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade); ++ ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_upgrade); + goto err; + } + @@ -25531,7 +25402,7 @@ index 000000000000..661006e427f2 +} diff --git a/fs/bcachefs/btree_key_cache.h b/fs/bcachefs/btree_key_cache.h new file mode 100644 -index 000000000000..670746e72dab +index 0000000000000..670746e72daba --- /dev/null +++ b/fs/bcachefs/btree_key_cache.h @@ -0,0 +1,47 @@ @@ -25584,7 +25455,7 @@ index 000000000000..670746e72dab +#endif /* _BCACHEFS_BTREE_KEY_CACHE_H */ diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h new file mode 100644 -index 000000000000..49eef650e436 +index 0000000000000..1982b6c873aae --- /dev/null +++ b/fs/bcachefs/btree_locking.h @@ -0,0 +1,289 @@ @@ -25766,7 +25637,7 @@ index 000000000000..49eef650e436 + trans->locking_btree_id = path->btree_id; + trans->locking_level = level; + trans->locking_lock_type = type; -+ trans->locking = b; ++ trans->locking = &b->c; + ret = six_lock_type(&b->c.lock, type, should_sleep_fn, p); + trans->locking = NULL; + @@ -25879,7 +25750,7 @@ index 000000000000..49eef650e436 +#endif /* _BCACHEFS_BTREE_LOCKING_H */ diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h new file mode 100644 -index 000000000000..a2826dfe13cb +index 0000000000000..e5cc5a6f2af3b --- /dev/null +++ b/fs/bcachefs/btree_types.h @@ -0,0 +1,697 @@ @@ -26279,7 +26150,7 @@ index 000000000000..a2826dfe13cb + const char *fn; + struct list_head list; + u64 last_begin_time; -+ struct btree *locking; ++ struct btree_bkey_cached_common *locking; + unsigned locking_path_idx; + struct bpos locking_pos; + u8 locking_btree_id; @@ -26582,7 +26453,7 @@ index 000000000000..a2826dfe13cb +#endif /* _BCACHEFS_BTREE_TYPES_H */ diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h new file mode 100644 -index 000000000000..89941fb8caa0 +index 0000000000000..89941fb8caa06 --- /dev/null +++ b/fs/bcachefs/btree_update.h @@ -0,0 +1,158 @@ @@ -26746,10 +26617,10 @@ index 000000000000..89941fb8caa0 +#endif /* _BCACHEFS_BTREE_UPDATE_H */ diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c new file mode 100644 -index 000000000000..5525635ec04a +index 0000000000000..9b0dedea7ed27 --- /dev/null +++ b/fs/bcachefs/btree_update_interior.c -@@ -0,0 +1,2266 @@ +@@ -0,0 +1,2252 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "bcachefs.h" @@ -26930,13 +26801,12 @@ index 000000000000..5525635ec04a + six_unlock_intent(&b->c.lock); +} + -+static struct btree *__bch2_btree_node_alloc(struct btree_trans *trans, ++static struct btree *__bch2_btree_node_alloc(struct bch_fs *c, + struct disk_reservation *res, + struct closure *cl, + bool interior_node, + unsigned flags) +{ -+ struct bch_fs *c = trans->c; + struct write_point *wp; + struct btree *b; + __BKEY_PADDED(k, BKEY_BTREE_PTR_VAL_U64s_MAX) tmp; @@ -26966,7 +26836,7 @@ index 000000000000..5525635ec04a + mutex_unlock(&c->btree_reserve_cache_lock); + +retry: -+ wp = bch2_alloc_sectors_start_trans(trans, ++ wp = bch2_alloc_sectors_start(c, + c->opts.metadata_target ?: + c->opts.foreground_target, + 0, @@ -27165,16 +27035,18 @@ index 000000000000..5525635ec04a + } +} + -+static int bch2_btree_reserve_get(struct btree_trans *trans, -+ struct btree_update *as, ++static int bch2_btree_reserve_get(struct btree_update *as, + unsigned nr_nodes[2], -+ unsigned flags, -+ struct closure *cl) ++ unsigned flags) +{ + struct bch_fs *c = as->c; ++ struct closure cl; + struct btree *b; + unsigned interior; -+ int ret = 0; ++ int ret; ++ ++ closure_init_stack(&cl); ++retry: + + BUG_ON(nr_nodes[0] + nr_nodes[1] > BTREE_RESERVE_MAX); + @@ -27185,17 +27057,18 @@ index 000000000000..5525635ec04a + * BTREE_INSERT_NOWAIT only applies to btree node allocation, not + * blocking on this lock: + */ -+ ret = bch2_btree_cache_cannibalize_lock(c, cl); ++ ret = bch2_btree_cache_cannibalize_lock(c, &cl); + if (ret) -+ return ret; ++ goto err; + + for (interior = 0; interior < 2; interior++) { + struct prealloc_nodes *p = as->prealloc_nodes + interior; + + while (p->nr < nr_nodes[interior]) { -+ b = __bch2_btree_node_alloc(trans, &as->disk_res, -+ flags & BTREE_INSERT_NOWAIT ? NULL : cl, -+ interior, flags); ++ b = __bch2_btree_node_alloc(c, &as->disk_res, ++ flags & BTREE_INSERT_NOWAIT ++ ? NULL : &cl, ++ interior, flags); + if (IS_ERR(b)) { + ret = PTR_ERR(b); + goto err; @@ -27204,8 +27077,18 @@ index 000000000000..5525635ec04a + p->b[p->nr++] = b; + } + } ++ ++ bch2_btree_cache_cannibalize_unlock(c); ++ closure_sync(&cl); ++ return 0; +err: + bch2_btree_cache_cannibalize_unlock(c); ++ closure_sync(&cl); ++ ++ if (ret == -EAGAIN) ++ goto retry; ++ ++ trace_btree_reserve_get_fail(c, nr_nodes[0] + nr_nodes[1], &cl); + return ret; +} + @@ -27720,7 +27603,6 @@ index 000000000000..5525635ec04a + unsigned update_level = level; + int journal_flags = flags & JOURNAL_WATERMARK_MASK; + int ret = 0; -+ u32 restart_count = trans->restart_count; + + BUG_ON(!path->should_be_locked); + @@ -27795,24 +27677,16 @@ index 000000000000..5525635ec04a + if (ret) + goto err; + ++ bch2_trans_unlock(trans); ++ + ret = bch2_journal_preres_get(&c->journal, &as->journal_preres, + BTREE_UPDATE_JOURNAL_RES, -+ journal_flags|JOURNAL_RES_GET_NONBLOCK); ++ journal_flags); + if (ret) { -+ bch2_trans_unlock(trans); -+ -+ ret = bch2_journal_preres_get(&c->journal, &as->journal_preres, -+ BTREE_UPDATE_JOURNAL_RES, -+ journal_flags); -+ if (ret) { -+ trace_trans_restart_journal_preres_get(trans->fn, _RET_IP_); -+ ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_journal_preres_get); -+ goto err; -+ } -+ -+ ret = bch2_trans_relock(trans); -+ if (ret) -+ goto err; ++ bch2_btree_update_free(as); ++ trace_trans_restart_journal_preres_get(trans->fn, _RET_IP_); ++ ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_journal_preres_get); ++ return ERR_PTR(ret); + } + + ret = bch2_disk_reservation_get(c, &as->disk_res, @@ -27822,31 +27696,14 @@ index 000000000000..5525635ec04a + if (ret) + goto err; + -+ ret = bch2_btree_reserve_get(trans, as, nr_nodes, flags, NULL); -+ if (ret && ret != -EINTR) { -+ struct closure cl; -+ -+ closure_init_stack(&cl); -+ -+ bch2_trans_unlock(trans); -+ -+ do { -+ ret = bch2_btree_reserve_get(trans, as, nr_nodes, flags, &cl); -+ closure_sync(&cl); -+ } while (ret == -EAGAIN); -+ -+ if (ret) { -+ trace_btree_reserve_get_fail(trans->fn, _RET_IP_, -+ nr_nodes[0] + nr_nodes[1]); -+ goto err; -+ } -+ } ++ ret = bch2_btree_reserve_get(as, nr_nodes, flags); ++ if (ret) ++ goto err; + + ret = bch2_trans_relock(trans); + if (ret) + goto err; + -+ bch2_trans_verify_not_restarted(trans, restart_count); + return as; +err: + bch2_btree_update_free(as); @@ -29018,7 +28875,7 @@ index 000000000000..5525635ec04a +} diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h new file mode 100644 -index 000000000000..adfc6c24a7a4 +index 0000000000000..adfc6c24a7a40 --- /dev/null +++ b/fs/bcachefs/btree_update_interior.h @@ -0,0 +1,321 @@ @@ -29345,7 +29202,7 @@ index 000000000000..adfc6c24a7a4 +#endif /* _BCACHEFS_BTREE_UPDATE_INTERIOR_H */ diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c new file mode 100644 -index 000000000000..e2ecbd3bca77 +index 0000000000000..e2ecbd3bca778 --- /dev/null +++ b/fs/bcachefs/btree_update_leaf.c @@ -0,0 +1,1800 @@ @@ -31151,7 +31008,7 @@ index 000000000000..e2ecbd3bca77 +} diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c new file mode 100644 -index 000000000000..b4be2122c2d5 +index 0000000000000..b4be2122c2d5e --- /dev/null +++ b/fs/bcachefs/buckets.c @@ -0,0 +1,2113 @@ @@ -33270,7 +33127,7 @@ index 000000000000..b4be2122c2d5 +} diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h new file mode 100644 -index 000000000000..6881502d95f1 +index 0000000000000..6881502d95f1a --- /dev/null +++ b/fs/bcachefs/buckets.h @@ -0,0 +1,300 @@ @@ -33576,7 +33433,7 @@ index 000000000000..6881502d95f1 +#endif /* _BUCKETS_H */ diff --git a/fs/bcachefs/buckets_types.h b/fs/bcachefs/buckets_types.h new file mode 100644 -index 000000000000..1dbba7d906dd +index 0000000000000..1dbba7d906dd8 --- /dev/null +++ b/fs/bcachefs/buckets_types.h @@ -0,0 +1,103 @@ @@ -33685,7 +33542,7 @@ index 000000000000..1dbba7d906dd +#endif /* _BUCKETS_TYPES_H */ diff --git a/fs/bcachefs/buckets_waiting_for_journal.c b/fs/bcachefs/buckets_waiting_for_journal.c new file mode 100644 -index 000000000000..2e5b955080de +index 0000000000000..2e5b955080de4 --- /dev/null +++ b/fs/bcachefs/buckets_waiting_for_journal.c @@ -0,0 +1,167 @@ @@ -33858,7 +33715,7 @@ index 000000000000..2e5b955080de +} diff --git a/fs/bcachefs/buckets_waiting_for_journal.h b/fs/bcachefs/buckets_waiting_for_journal.h new file mode 100644 -index 000000000000..d2ae19cbe18c +index 0000000000000..d2ae19cbe18c4 --- /dev/null +++ b/fs/bcachefs/buckets_waiting_for_journal.h @@ -0,0 +1,15 @@ @@ -33879,7 +33736,7 @@ index 000000000000..d2ae19cbe18c +#endif /* _BUCKETS_WAITING_FOR_JOURNAL_H */ diff --git a/fs/bcachefs/buckets_waiting_for_journal_types.h b/fs/bcachefs/buckets_waiting_for_journal_types.h new file mode 100644 -index 000000000000..fea7f944d0ed +index 0000000000000..fea7f944d0ed3 --- /dev/null +++ b/fs/bcachefs/buckets_waiting_for_journal_types.h @@ -0,0 +1,23 @@ @@ -33908,7 +33765,7 @@ index 000000000000..fea7f944d0ed +#endif /* _BUCKETS_WAITING_FOR_JOURNAL_TYPES_H */ diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c new file mode 100644 -index 000000000000..dbb7e5e0b35b +index 0000000000000..dbb7e5e0b35b8 --- /dev/null +++ b/fs/bcachefs/chardev.c @@ -0,0 +1,760 @@ @@ -34674,7 +34531,7 @@ index 000000000000..dbb7e5e0b35b +#endif /* NO_BCACHEFS_CHARDEV */ diff --git a/fs/bcachefs/chardev.h b/fs/bcachefs/chardev.h new file mode 100644 -index 000000000000..3a4890d39ff9 +index 0000000000000..3a4890d39ff98 --- /dev/null +++ b/fs/bcachefs/chardev.h @@ -0,0 +1,31 @@ @@ -34711,7 +34568,7 @@ index 000000000000..3a4890d39ff9 +#endif /* _BCACHEFS_CHARDEV_H */ diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c new file mode 100644 -index 000000000000..b5850a761b91 +index 0000000000000..b5850a761b910 --- /dev/null +++ b/fs/bcachefs/checksum.c @@ -0,0 +1,712 @@ @@ -35429,7 +35286,7 @@ index 000000000000..b5850a761b91 +} diff --git a/fs/bcachefs/checksum.h b/fs/bcachefs/checksum.h new file mode 100644 -index 000000000000..c86c3c05d620 +index 0000000000000..c86c3c05d6205 --- /dev/null +++ b/fs/bcachefs/checksum.h @@ -0,0 +1,204 @@ @@ -35639,7 +35496,7 @@ index 000000000000..c86c3c05d620 +#endif /* _BCACHEFS_CHECKSUM_H */ diff --git a/fs/bcachefs/clock.c b/fs/bcachefs/clock.c new file mode 100644 -index 000000000000..f3ffdbc38485 +index 0000000000000..f3ffdbc38485b --- /dev/null +++ b/fs/bcachefs/clock.c @@ -0,0 +1,191 @@ @@ -35836,7 +35693,7 @@ index 000000000000..f3ffdbc38485 +} diff --git a/fs/bcachefs/clock.h b/fs/bcachefs/clock.h new file mode 100644 -index 000000000000..70a0f7436c84 +index 0000000000000..70a0f7436c844 --- /dev/null +++ b/fs/bcachefs/clock.h @@ -0,0 +1,38 @@ @@ -35880,7 +35737,7 @@ index 000000000000..70a0f7436c84 +#endif /* _BCACHEFS_CLOCK_H */ diff --git a/fs/bcachefs/clock_types.h b/fs/bcachefs/clock_types.h new file mode 100644 -index 000000000000..5fae0012d808 +index 0000000000000..5fae0012d808f --- /dev/null +++ b/fs/bcachefs/clock_types.h @@ -0,0 +1,37 @@ @@ -35923,7 +35780,7 @@ index 000000000000..5fae0012d808 +#endif /* _BCACHEFS_CLOCK_TYPES_H */ diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c new file mode 100644 -index 000000000000..f692f35a6a98 +index 0000000000000..f692f35a6a98e --- /dev/null +++ b/fs/bcachefs/compress.c @@ -0,0 +1,639 @@ @@ -36568,7 +36425,7 @@ index 000000000000..f692f35a6a98 +} diff --git a/fs/bcachefs/compress.h b/fs/bcachefs/compress.h new file mode 100644 -index 000000000000..4bab1f61b3b5 +index 0000000000000..4bab1f61b3b50 --- /dev/null +++ b/fs/bcachefs/compress.h @@ -0,0 +1,18 @@ @@ -36592,7 +36449,7 @@ index 000000000000..4bab1f61b3b5 +#endif /* _BCACHEFS_COMPRESS_H */ diff --git a/fs/bcachefs/counters.c b/fs/bcachefs/counters.c new file mode 100644 -index 000000000000..745f856e6d3e +index 0000000000000..745f856e6d3e9 --- /dev/null +++ b/fs/bcachefs/counters.c @@ -0,0 +1,107 @@ @@ -36705,7 +36562,7 @@ index 000000000000..745f856e6d3e +}; diff --git a/fs/bcachefs/counters.h b/fs/bcachefs/counters.h new file mode 100644 -index 000000000000..4778aa19bf34 +index 0000000000000..4778aa19bf346 --- /dev/null +++ b/fs/bcachefs/counters.h @@ -0,0 +1,17 @@ @@ -36728,7 +36585,7 @@ index 000000000000..4778aa19bf34 +#endif // _BCACHEFS_COUNTERS_H diff --git a/fs/bcachefs/darray.h b/fs/bcachefs/darray.h new file mode 100644 -index 000000000000..519ab9b96e67 +index 0000000000000..519ab9b96e67f --- /dev/null +++ b/fs/bcachefs/darray.h @@ -0,0 +1,77 @@ @@ -36811,7 +36668,7 @@ index 000000000000..519ab9b96e67 +#endif /* _BCACHEFS_DARRAY_H */ diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c new file mode 100644 -index 000000000000..3b442b01ca86 +index 0000000000000..3b442b01ca869 --- /dev/null +++ b/fs/bcachefs/data_update.c @@ -0,0 +1,376 @@ @@ -37193,7 +37050,7 @@ index 000000000000..3b442b01ca86 +} diff --git a/fs/bcachefs/data_update.h b/fs/bcachefs/data_update.h new file mode 100644 -index 000000000000..e64505453a55 +index 0000000000000..e64505453a550 --- /dev/null +++ b/fs/bcachefs/data_update.h @@ -0,0 +1,38 @@ @@ -37237,7 +37094,7 @@ index 000000000000..e64505453a55 +#endif /* _BCACHEFS_DATA_UPDATE_H */ diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c new file mode 100644 -index 000000000000..cd37a1016e25 +index 0000000000000..cd37a1016e259 --- /dev/null +++ b/fs/bcachefs/debug.c @@ -0,0 +1,764 @@ @@ -38007,7 +37864,7 @@ index 000000000000..cd37a1016e25 +} diff --git a/fs/bcachefs/debug.h b/fs/bcachefs/debug.h new file mode 100644 -index 000000000000..0b86736e5e1b +index 0000000000000..0b86736e5e1be --- /dev/null +++ b/fs/bcachefs/debug.h @@ -0,0 +1,30 @@ @@ -38043,7 +37900,7 @@ index 000000000000..0b86736e5e1b +#endif /* _BCACHEFS_DEBUG_H */ diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c new file mode 100644 -index 000000000000..4d942d224a08 +index 0000000000000..4d942d224a088 --- /dev/null +++ b/fs/bcachefs/dirent.c @@ -0,0 +1,565 @@ @@ -38614,7 +38471,7 @@ index 000000000000..4d942d224a08 +} diff --git a/fs/bcachefs/dirent.h b/fs/bcachefs/dirent.h new file mode 100644 -index 000000000000..b1466932c768 +index 0000000000000..b1466932c7687 --- /dev/null +++ b/fs/bcachefs/dirent.h @@ -0,0 +1,67 @@ @@ -38687,7 +38544,7 @@ index 000000000000..b1466932c768 +#endif /* _BCACHEFS_DIRENT_H */ diff --git a/fs/bcachefs/disk_groups.c b/fs/bcachefs/disk_groups.c new file mode 100644 -index 000000000000..7bd4413671d2 +index 0000000000000..7bd4413671d22 --- /dev/null +++ b/fs/bcachefs/disk_groups.c @@ -0,0 +1,506 @@ @@ -39199,7 +39056,7 @@ index 000000000000..7bd4413671d2 +} diff --git a/fs/bcachefs/disk_groups.h b/fs/bcachefs/disk_groups.h new file mode 100644 -index 000000000000..de915480514b +index 0000000000000..de915480514b1 --- /dev/null +++ b/fs/bcachefs/disk_groups.h @@ -0,0 +1,90 @@ @@ -39295,7 +39152,7 @@ index 000000000000..de915480514b +#endif /* _BCACHEFS_DISK_GROUPS_H */ diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c new file mode 100644 -index 000000000000..f33acf1af110 +index 0000000000000..f33acf1af1109 --- /dev/null +++ b/fs/bcachefs/ec.c @@ -0,0 +1,1673 @@ @@ -40974,7 +40831,7 @@ index 000000000000..f33acf1af110 +} diff --git a/fs/bcachefs/ec.h b/fs/bcachefs/ec.h new file mode 100644 -index 000000000000..a4c13d61af10 +index 0000000000000..a4c13d61af109 --- /dev/null +++ b/fs/bcachefs/ec.h @@ -0,0 +1,230 @@ @@ -41210,7 +41067,7 @@ index 000000000000..a4c13d61af10 +#endif /* _BCACHEFS_EC_H */ diff --git a/fs/bcachefs/ec_types.h b/fs/bcachefs/ec_types.h new file mode 100644 -index 000000000000..edd93da663c1 +index 0000000000000..edd93da663c1f --- /dev/null +++ b/fs/bcachefs/ec_types.h @@ -0,0 +1,46 @@ @@ -41262,7 +41119,7 @@ index 000000000000..edd93da663c1 +#endif /* _BCACHEFS_EC_TYPES_H */ diff --git a/fs/bcachefs/errcode.c b/fs/bcachefs/errcode.c new file mode 100644 -index 000000000000..9da8a5973af0 +index 0000000000000..9da8a5973af06 --- /dev/null +++ b/fs/bcachefs/errcode.c @@ -0,0 +1,51 @@ @@ -41319,10 +41176,10 @@ index 000000000000..9da8a5973af0 +} diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h new file mode 100644 -index 000000000000..95925c8434b3 +index 0000000000000..6dd2152e782e8 --- /dev/null +++ b/fs/bcachefs/errcode.h -@@ -0,0 +1,64 @@ +@@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _BCACHEFS_ERRCODE_H +#define _BCACHEFS_ERRCODE_H @@ -41347,6 +41204,7 @@ index 000000000000..95925c8434b3 + x(transaction_restart, transaction_restart_would_deadlock) \ + x(transaction_restart, transaction_restart_would_deadlock_write)\ + x(transaction_restart, transaction_restart_upgrade) \ ++ x(transaction_restart, transaction_restart_key_cache_upgrade) \ + x(transaction_restart, transaction_restart_key_cache_fill) \ + x(transaction_restart, transaction_restart_key_cache_raced) \ + x(transaction_restart, transaction_restart_key_cache_realloced)\ @@ -41389,7 +41247,7 @@ index 000000000000..95925c8434b3 +#endif /* _BCACHFES_ERRCODE_H */ diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c new file mode 100644 -index 000000000000..f6a895b2ceb7 +index 0000000000000..f6a895b2ceb7d --- /dev/null +++ b/fs/bcachefs/error.c @@ -0,0 +1,184 @@ @@ -41579,7 +41437,7 @@ index 000000000000..f6a895b2ceb7 +} diff --git a/fs/bcachefs/error.h b/fs/bcachefs/error.h new file mode 100644 -index 000000000000..b603d738c549 +index 0000000000000..b603d738c5492 --- /dev/null +++ b/fs/bcachefs/error.h @@ -0,0 +1,223 @@ @@ -41808,7 +41666,7 @@ index 000000000000..b603d738c549 +#endif /* _BCACHEFS_ERROR_H */ diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c new file mode 100644 -index 000000000000..2fd5d9672a44 +index 0000000000000..2fd5d9672a442 --- /dev/null +++ b/fs/bcachefs/extent_update.c @@ -0,0 +1,178 @@ @@ -41992,7 +41850,7 @@ index 000000000000..2fd5d9672a44 +} diff --git a/fs/bcachefs/extent_update.h b/fs/bcachefs/extent_update.h new file mode 100644 -index 000000000000..6f5cf449361a +index 0000000000000..6f5cf449361a7 --- /dev/null +++ b/fs/bcachefs/extent_update.h @@ -0,0 +1,12 @@ @@ -42010,7 +41868,7 @@ index 000000000000..6f5cf449361a +#endif /* _BCACHEFS_EXTENT_UPDATE_H */ diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c new file mode 100644 -index 000000000000..2ca13014b9c4 +index 0000000000000..2ca13014b9c44 --- /dev/null +++ b/fs/bcachefs/extents.c @@ -0,0 +1,1324 @@ @@ -43340,7 +43198,7 @@ index 000000000000..2ca13014b9c4 +} diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h new file mode 100644 -index 000000000000..3c17b81130bb +index 0000000000000..3c17b81130bbf --- /dev/null +++ b/fs/bcachefs/extents.h @@ -0,0 +1,685 @@ @@ -44031,7 +43889,7 @@ index 000000000000..3c17b81130bb +#endif /* _BCACHEFS_EXTENTS_H */ diff --git a/fs/bcachefs/extents_types.h b/fs/bcachefs/extents_types.h new file mode 100644 -index 000000000000..43d6c341ecca +index 0000000000000..43d6c341eccab --- /dev/null +++ b/fs/bcachefs/extents_types.h @@ -0,0 +1,40 @@ @@ -44077,7 +43935,7 @@ index 000000000000..43d6c341ecca +#endif /* _BCACHEFS_EXTENTS_TYPES_H */ diff --git a/fs/bcachefs/eytzinger.h b/fs/bcachefs/eytzinger.h new file mode 100644 -index 000000000000..05429c9631cd +index 0000000000000..05429c9631cda --- /dev/null +++ b/fs/bcachefs/eytzinger.h @@ -0,0 +1,281 @@ @@ -44364,7 +44222,7 @@ index 000000000000..05429c9631cd +#endif /* _EYTZINGER_H */ diff --git a/fs/bcachefs/fifo.h b/fs/bcachefs/fifo.h new file mode 100644 -index 000000000000..cdb272708a4b +index 0000000000000..cdb272708a4bd --- /dev/null +++ b/fs/bcachefs/fifo.h @@ -0,0 +1,127 @@ @@ -44497,7 +44355,7 @@ index 000000000000..cdb272708a4b +#endif /* _BCACHEFS_FIFO_H */ diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c new file mode 100644 -index 000000000000..53ffc684223c +index 0000000000000..53ffc684223cf --- /dev/null +++ b/fs/bcachefs/fs-common.c @@ -0,0 +1,496 @@ @@ -44999,7 +44857,7 @@ index 000000000000..53ffc684223c +} diff --git a/fs/bcachefs/fs-common.h b/fs/bcachefs/fs-common.h new file mode 100644 -index 000000000000..dde237859514 +index 0000000000000..dde2378595143 --- /dev/null +++ b/fs/bcachefs/fs-common.h @@ -0,0 +1,43 @@ @@ -45048,10 +44906,10 @@ index 000000000000..dde237859514 +#endif /* _BCACHEFS_FS_COMMON_H */ diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c new file mode 100644 -index 000000000000..f37bc43e27f4 +index 0000000000000..0a7f172f11c64 --- /dev/null +++ b/fs/bcachefs/fs-io.c -@@ -0,0 +1,3496 @@ +@@ -0,0 +1,3492 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef NO_BCACHEFS_FS + @@ -45904,13 +45762,13 @@ index 000000000000..f37bc43e27f4 + bch2_clear_page_bits(&folio->page); +} + -+int bch2_releasepage(struct page *page, gfp_t gfp_mask) ++bool bch2_release_folio(struct folio *folio, gfp_t gfp_mask) +{ -+ if (PageDirty(page)) -+ return 0; ++ if (folio_test_dirty(folio) || folio_test_writeback(folio)) ++ return false; + -+ bch2_clear_page_bits(page); -+ return 1; ++ bch2_clear_page_bits(&folio->page); ++ return true; +} + +#ifdef CONFIG_MIGRATION @@ -46228,20 +46086,6 @@ index 000000000000..f37bc43e27f4 + bch2_trans_exit(&trans); +} + -+int bch2_readpage(struct file *file, struct page *page) -+{ -+ struct bch_inode_info *inode = to_bch_ei(page->mapping->host); -+ struct bch_fs *c = inode->v.i_sb->s_fs_info; -+ struct bch_io_opts opts = io_opts(c, &inode->ei_inode); -+ struct bch_read_bio *rbio; -+ -+ rbio = rbio_init(bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_NOFS, &c->bio_read), opts); -+ rbio->bio.bi_end_io = bch2_readpages_end_io; -+ -+ __bchfs_readpage(c, rbio, inode_inum(inode), page); -+ return 0; -+} -+ +static void bch2_read_single_page_end_io(struct bio *bio) +{ + complete(bio->bi_private); @@ -46274,6 +46118,16 @@ index 000000000000..f37bc43e27f4 + return 0; +} + ++int bch2_read_folio(struct file *file, struct folio *folio) ++{ ++ struct page *page = &folio->page; ++ int ret; ++ ++ ret = bch2_read_single_page(page, page->mapping); ++ folio_unlock(folio); ++ return ret; ++} ++ +/* writepages: */ + +struct bch_writepage_state { @@ -46565,7 +46419,7 @@ index 000000000000..f37bc43e27f4 +/* buffered writes: */ + +int bch2_write_begin(struct file *file, struct address_space *mapping, -+ loff_t pos, unsigned len, unsigned flags, ++ loff_t pos, unsigned len, + struct page **pagep, void **fsdata) +{ + struct bch_inode_info *inode = to_bch_ei(mapping->host); @@ -46585,7 +46439,7 @@ index 000000000000..f37bc43e27f4 + + bch2_pagecache_add_get(&inode->ei_pagecache_lock); + -+ page = grab_cache_page_write_begin(mapping, index, flags); ++ page = grab_cache_page_write_begin(mapping, index); + if (!page) + goto err_unlock; + @@ -46716,7 +46570,7 @@ index 000000000000..f37bc43e27f4 + bch2_page_reservation_init(c, inode, &res); + + for (i = 0; i < nr_pages; i++) { -+ pages[i] = grab_cache_page_write_begin(mapping, index + i, 0); ++ pages[i] = grab_cache_page_write_begin(mapping, index + i); + if (!pages[i]) { + nr_pages = i; + if (!i) { @@ -48550,7 +48404,7 @@ index 000000000000..f37bc43e27f4 +#endif /* NO_BCACHEFS_FS */ diff --git a/fs/bcachefs/fs-io.h b/fs/bcachefs/fs-io.h new file mode 100644 -index 000000000000..7f2d7f454be4 +index 0000000000000..a22a4e95731be --- /dev/null +++ b/fs/bcachefs/fs-io.h @@ -0,0 +1,56 @@ @@ -48571,13 +48425,13 @@ index 000000000000..7f2d7f454be4 + struct bch_inode_info *, + loff_t, unsigned); + -+int bch2_readpage(struct file *, struct page *); ++int bch2_read_folio(struct file *, struct folio *); + +int bch2_writepages(struct address_space *, struct writeback_control *); +void bch2_readahead(struct readahead_control *); + +int bch2_write_begin(struct file *, struct address_space *, loff_t, -+ unsigned, unsigned, struct page **, void **); ++ unsigned, struct page **, void **); +int bch2_write_end(struct file *, struct address_space *, loff_t, + unsigned, unsigned, struct page *, void *); + @@ -48598,7 +48452,7 @@ index 000000000000..7f2d7f454be4 +vm_fault_t bch2_page_fault(struct vm_fault *); +vm_fault_t bch2_page_mkwrite(struct vm_fault *); +void bch2_invalidate_folio(struct folio *, size_t, size_t); -+int bch2_releasepage(struct page *, gfp_t); ++bool bch2_release_folio(struct folio *, gfp_t); +int bch2_migrate_page(struct address_space *, struct page *, + struct page *, enum migrate_mode); + @@ -48612,7 +48466,7 @@ index 000000000000..7f2d7f454be4 +#endif /* _BCACHEFS_FS_IO_H */ diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c new file mode 100644 -index 000000000000..9f329a624c12 +index 0000000000000..9f329a624c127 --- /dev/null +++ b/fs/bcachefs/fs-ioctl.c @@ -0,0 +1,523 @@ @@ -49141,7 +48995,7 @@ index 000000000000..9f329a624c12 +#endif /* NO_BCACHEFS_FS */ diff --git a/fs/bcachefs/fs-ioctl.h b/fs/bcachefs/fs-ioctl.h new file mode 100644 -index 000000000000..f201980ef2c3 +index 0000000000000..f201980ef2c38 --- /dev/null +++ b/fs/bcachefs/fs-ioctl.h @@ -0,0 +1,81 @@ @@ -49228,7 +49082,7 @@ index 000000000000..f201980ef2c3 +#endif /* _BCACHEFS_FS_IOCTL_H */ diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c new file mode 100644 -index 000000000000..6d57bd87bfd5 +index 0000000000000..3e2b6097819b1 --- /dev/null +++ b/fs/bcachefs/fs.c @@ -0,0 +1,1939 @@ @@ -50347,14 +50201,14 @@ index 000000000000..6d57bd87bfd5 +}; + +static const struct address_space_operations bch_address_space_operations = { -+ .readpage = bch2_readpage, ++ .read_folio = bch2_read_folio, + .writepages = bch2_writepages, + .readahead = bch2_readahead, + .dirty_folio = filemap_dirty_folio, + .write_begin = bch2_write_begin, + .write_end = bch2_write_end, + .invalidate_folio = bch2_invalidate_folio, -+ .releasepage = bch2_releasepage, ++ .release_folio = bch2_release_folio, + .direct_IO = noop_direct_IO, +#ifdef CONFIG_MIGRATION + .migratepage = bch2_migrate_page, @@ -51173,7 +51027,7 @@ index 000000000000..6d57bd87bfd5 +#endif /* NO_BCACHEFS_FS */ diff --git a/fs/bcachefs/fs.h b/fs/bcachefs/fs.h new file mode 100644 -index 000000000000..9f4b57e30e2a +index 0000000000000..9f4b57e30e2a7 --- /dev/null +++ b/fs/bcachefs/fs.h @@ -0,0 +1,208 @@ @@ -51387,7 +51241,7 @@ index 000000000000..9f4b57e30e2a +#endif /* _BCACHEFS_FS_H */ diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c new file mode 100644 -index 000000000000..bb8cab7cb405 +index 0000000000000..bb8cab7cb405f --- /dev/null +++ b/fs/bcachefs/fsck.c @@ -0,0 +1,2390 @@ @@ -53783,7 +53637,7 @@ index 000000000000..bb8cab7cb405 +} diff --git a/fs/bcachefs/fsck.h b/fs/bcachefs/fsck.h new file mode 100644 -index 000000000000..264f2706b12d +index 0000000000000..264f2706b12d4 --- /dev/null +++ b/fs/bcachefs/fsck.h @@ -0,0 +1,8 @@ @@ -53797,7 +53651,7 @@ index 000000000000..264f2706b12d +#endif /* _BCACHEFS_FSCK_H */ diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c new file mode 100644 -index 000000000000..083106006747 +index 0000000000000..0831060067473 --- /dev/null +++ b/fs/bcachefs/inode.c @@ -0,0 +1,771 @@ @@ -54574,7 +54428,7 @@ index 000000000000..083106006747 +} diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h new file mode 100644 -index 000000000000..2ac2fc10513b +index 0000000000000..2ac2fc10513bb --- /dev/null +++ b/fs/bcachefs/inode.h @@ -0,0 +1,189 @@ @@ -54769,10 +54623,10 @@ index 000000000000..2ac2fc10513b +#endif /* _BCACHEFS_INODE_H */ diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c new file mode 100644 -index 000000000000..971f8ba00dbd +index 0000000000000..c4523b14293ad --- /dev/null +++ b/fs/bcachefs/io.c -@@ -0,0 +1,2422 @@ +@@ -0,0 +1,2423 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Some low level IO code, and hacks for various block layer limitations @@ -56694,6 +56548,7 @@ index 000000000000..971f8ba00dbd + } + + if (rbio->narrow_crcs || ++ rbio->promote || + crc_is_compressed(rbio->pick.crc) || + bch2_csum_type_is_encryption(rbio->pick.crc.csum_type)) + context = RBIO_CONTEXT_UNBOUND, wq = system_unbound_wq; @@ -57197,7 +57052,7 @@ index 000000000000..971f8ba00dbd +} diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h new file mode 100644 -index 000000000000..fb5114518666 +index 0000000000000..fb5114518666c --- /dev/null +++ b/fs/bcachefs/io.h @@ -0,0 +1,189 @@ @@ -57392,7 +57247,7 @@ index 000000000000..fb5114518666 +#endif /* _BCACHEFS_IO_H */ diff --git a/fs/bcachefs/io_types.h b/fs/bcachefs/io_types.h new file mode 100644 -index 000000000000..78bff13d36f2 +index 0000000000000..78bff13d36f27 --- /dev/null +++ b/fs/bcachefs/io_types.h @@ -0,0 +1,161 @@ @@ -57559,10 +57414,10 @@ index 000000000000..78bff13d36f2 +#endif /* _BCACHEFS_IO_TYPES_H */ diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c new file mode 100644 -index 000000000000..937ed1395e46 +index 0000000000000..d77092aa069ee --- /dev/null +++ b/fs/bcachefs/journal.c -@@ -0,0 +1,1429 @@ +@@ -0,0 +1,1432 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * bcachefs journalling code, for btree insertions @@ -58711,7 +58566,7 @@ index 000000000000..937ed1395e46 + bch2_sb_get_journal(sb); + struct bch_sb_field_journal_v2 *journal_buckets_v2 = + bch2_sb_get_journal_v2(sb); -+ unsigned i; ++ unsigned i, nr_bvecs; + + ja->nr = 0; + @@ -58728,11 +58583,14 @@ index 000000000000..937ed1395e46 + if (!ja->bucket_seq) + return -ENOMEM; + -+ ca->journal.bio = bio_kmalloc(GFP_KERNEL, -+ DIV_ROUND_UP(JOURNAL_ENTRY_SIZE_MAX, PAGE_SIZE)); ++ nr_bvecs = DIV_ROUND_UP(JOURNAL_ENTRY_SIZE_MAX, PAGE_SIZE); ++ ++ ca->journal.bio = bio_kmalloc(nr_bvecs, GFP_KERNEL); + if (!ca->journal.bio) + return -ENOMEM; + ++ bio_init(ca->journal.bio, NULL, ca->journal.bio->bi_inline_vecs, nr_bvecs, 0); ++ + ja->buckets = kcalloc(ja->nr, sizeof(u64), GFP_KERNEL); + if (!ja->buckets) + return -ENOMEM; @@ -58994,7 +58852,7 @@ index 000000000000..937ed1395e46 +} diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h new file mode 100644 -index 000000000000..d3caa7ea7ce9 +index 0000000000000..d3caa7ea7ce94 --- /dev/null +++ b/fs/bcachefs/journal.h @@ -0,0 +1,521 @@ @@ -59521,7 +59379,7 @@ index 000000000000..d3caa7ea7ce9 +#endif /* _BCACHEFS_JOURNAL_H */ diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c new file mode 100644 -index 000000000000..6fa2c54c1af4 +index 0000000000000..107521e10ff9f --- /dev/null +++ b/fs/bcachefs/journal_io.c @@ -0,0 +1,1735 @@ @@ -60350,20 +60208,20 @@ index 000000000000..6fa2c54c1af4 + while (offset < end) { + if (!sectors_read) { + struct bio *bio; ++ unsigned nr_bvecs; +reread: + sectors_read = min_t(unsigned, + end - offset, buf->size >> 9); ++ nr_bvecs = buf_pages(buf->data, sectors_read << 9); + -+ bio = bio_kmalloc(GFP_KERNEL, -+ buf_pages(buf->data, -+ sectors_read << 9)); -+ bio_set_dev(bio, ca->disk_sb.bdev); -+ bio->bi_iter.bi_sector = offset; -+ bio_set_op_attrs(bio, REQ_OP_READ, 0); ++ bio = bio_kmalloc(nr_bvecs, GFP_KERNEL); ++ bio_init(bio, ca->disk_sb.bdev, bio->bi_inline_vecs, nr_bvecs, REQ_OP_READ); ++ ++ bio->bi_iter.bi_sector = offset; + bch2_bio_map(bio, buf->data, sectors_read << 9); + + ret = submit_bio_wait(bio); -+ bio_put(bio); ++ kfree(bio); + + if (bch2_dev_io_err_on(ret, ca, + "journal read error: sector %llu", @@ -61262,7 +61120,7 @@ index 000000000000..6fa2c54c1af4 +} diff --git a/fs/bcachefs/journal_io.h b/fs/bcachefs/journal_io.h new file mode 100644 -index 000000000000..30e995c81fc4 +index 0000000000000..30e995c81fc4d --- /dev/null +++ b/fs/bcachefs/journal_io.h @@ -0,0 +1,59 @@ @@ -61327,7 +61185,7 @@ index 000000000000..30e995c81fc4 +#endif /* _BCACHEFS_JOURNAL_IO_H */ diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c new file mode 100644 -index 000000000000..6f0ab411c98e +index 0000000000000..9f8b63b340f71 --- /dev/null +++ b/fs/bcachefs/journal_reclaim.c @@ -0,0 +1,852 @@ @@ -61616,11 +61474,11 @@ index 000000000000..6f0ab411c98e + while (should_discard_bucket(j, ja)) { + if (!c->opts.nochanges && + ca->mi.discard && -+ blk_queue_discard(bdev_get_queue(ca->disk_sb.bdev))) ++ bdev_max_discard_sectors(ca->disk_sb.bdev)) + blkdev_issue_discard(ca->disk_sb.bdev, + bucket_to_sector(ca, + ja->buckets[ja->discard_idx]), -+ ca->mi.bucket_size, GFP_NOIO, 0); ++ ca->mi.bucket_size, GFP_NOIO); + + spin_lock(&j->lock); + ja->discard_idx = (ja->discard_idx + 1) % ja->nr; @@ -62185,7 +62043,7 @@ index 000000000000..6f0ab411c98e +} diff --git a/fs/bcachefs/journal_reclaim.h b/fs/bcachefs/journal_reclaim.h new file mode 100644 -index 000000000000..0fd1af120db5 +index 0000000000000..0fd1af120db55 --- /dev/null +++ b/fs/bcachefs/journal_reclaim.h @@ -0,0 +1,86 @@ @@ -62277,7 +62135,7 @@ index 000000000000..0fd1af120db5 +#endif /* _BCACHEFS_JOURNAL_RECLAIM_H */ diff --git a/fs/bcachefs/journal_sb.c b/fs/bcachefs/journal_sb.c new file mode 100644 -index 000000000000..001cecec1291 +index 0000000000000..001cecec1291b --- /dev/null +++ b/fs/bcachefs/journal_sb.c @@ -0,0 +1,220 @@ @@ -62503,7 +62361,7 @@ index 000000000000..001cecec1291 +} diff --git a/fs/bcachefs/journal_sb.h b/fs/bcachefs/journal_sb.h new file mode 100644 -index 000000000000..a39192e9f6f4 +index 0000000000000..a39192e9f6f4c --- /dev/null +++ b/fs/bcachefs/journal_sb.h @@ -0,0 +1,24 @@ @@ -62533,7 +62391,7 @@ index 000000000000..a39192e9f6f4 +int bch2_journal_buckets_to_sb(struct bch_fs *, struct bch_dev *); diff --git a/fs/bcachefs/journal_seq_blacklist.c b/fs/bcachefs/journal_seq_blacklist.c new file mode 100644 -index 000000000000..5c555b3703c0 +index 0000000000000..5c555b3703c09 --- /dev/null +++ b/fs/bcachefs/journal_seq_blacklist.c @@ -0,0 +1,322 @@ @@ -62861,7 +62719,7 @@ index 000000000000..5c555b3703c0 +} diff --git a/fs/bcachefs/journal_seq_blacklist.h b/fs/bcachefs/journal_seq_blacklist.h new file mode 100644 -index 000000000000..afb886ec8e25 +index 0000000000000..afb886ec8e254 --- /dev/null +++ b/fs/bcachefs/journal_seq_blacklist.h @@ -0,0 +1,22 @@ @@ -62889,7 +62747,7 @@ index 000000000000..afb886ec8e25 +#endif /* _BCACHEFS_JOURNAL_SEQ_BLACKLIST_H */ diff --git a/fs/bcachefs/journal_types.h b/fs/bcachefs/journal_types.h new file mode 100644 -index 000000000000..a6cdb885ad41 +index 0000000000000..a6cdb885ad410 --- /dev/null +++ b/fs/bcachefs/journal_types.h @@ -0,0 +1,340 @@ @@ -63235,7 +63093,7 @@ index 000000000000..a6cdb885ad41 +#endif /* _BCACHEFS_JOURNAL_TYPES_H */ diff --git a/fs/bcachefs/keylist.c b/fs/bcachefs/keylist.c new file mode 100644 -index 000000000000..cda77835b9ea +index 0000000000000..cda77835b9ea6 --- /dev/null +++ b/fs/bcachefs/keylist.c @@ -0,0 +1,67 @@ @@ -63308,7 +63166,7 @@ index 000000000000..cda77835b9ea +#endif diff --git a/fs/bcachefs/keylist.h b/fs/bcachefs/keylist.h new file mode 100644 -index 000000000000..195799bb20bc +index 0000000000000..195799bb20bcb --- /dev/null +++ b/fs/bcachefs/keylist.h @@ -0,0 +1,76 @@ @@ -63390,7 +63248,7 @@ index 000000000000..195799bb20bc +#endif /* _BCACHEFS_KEYLIST_H */ diff --git a/fs/bcachefs/keylist_types.h b/fs/bcachefs/keylist_types.h new file mode 100644 -index 000000000000..4b3ff7d8a875 +index 0000000000000..4b3ff7d8a8756 --- /dev/null +++ b/fs/bcachefs/keylist_types.h @@ -0,0 +1,16 @@ @@ -63412,7 +63270,7 @@ index 000000000000..4b3ff7d8a875 +#endif /* _BCACHEFS_KEYLIST_TYPES_H */ diff --git a/fs/bcachefs/lru.c b/fs/bcachefs/lru.c new file mode 100644 -index 000000000000..53e607d72274 +index 0000000000000..53e607d72274c --- /dev/null +++ b/fs/bcachefs/lru.c @@ -0,0 +1,206 @@ @@ -63624,7 +63482,7 @@ index 000000000000..53e607d72274 +} diff --git a/fs/bcachefs/lru.h b/fs/bcachefs/lru.h new file mode 100644 -index 000000000000..3decb7b1dde2 +index 0000000000000..3decb7b1dde23 --- /dev/null +++ b/fs/bcachefs/lru.h @@ -0,0 +1,19 @@ @@ -63649,7 +63507,7 @@ index 000000000000..3decb7b1dde2 +#endif /* _BCACHEFS_LRU_H */ diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c new file mode 100644 -index 000000000000..8b258d966d04 +index 0000000000000..8b258d966d042 --- /dev/null +++ b/fs/bcachefs/migrate.c @@ -0,0 +1,186 @@ @@ -63841,7 +63699,7 @@ index 000000000000..8b258d966d04 +} diff --git a/fs/bcachefs/migrate.h b/fs/bcachefs/migrate.h new file mode 100644 -index 000000000000..027efaa0d575 +index 0000000000000..027efaa0d575f --- /dev/null +++ b/fs/bcachefs/migrate.h @@ -0,0 +1,7 @@ @@ -63854,7 +63712,7 @@ index 000000000000..027efaa0d575 +#endif /* _BCACHEFS_MIGRATE_H */ diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c new file mode 100644 -index 000000000000..2fc247451390 +index 0000000000000..2fc247451390d --- /dev/null +++ b/fs/bcachefs/move.c @@ -0,0 +1,952 @@ @@ -64812,7 +64670,7 @@ index 000000000000..2fc247451390 +} diff --git a/fs/bcachefs/move.h b/fs/bcachefs/move.h new file mode 100644 -index 000000000000..c0fec69bbb6a +index 0000000000000..c0fec69bbb6a1 --- /dev/null +++ b/fs/bcachefs/move.h @@ -0,0 +1,67 @@ @@ -64885,7 +64743,7 @@ index 000000000000..c0fec69bbb6a +#endif /* _BCACHEFS_MOVE_H */ diff --git a/fs/bcachefs/move_types.h b/fs/bcachefs/move_types.h new file mode 100644 -index 000000000000..9df6d18137a5 +index 0000000000000..9df6d18137a5e --- /dev/null +++ b/fs/bcachefs/move_types.h @@ -0,0 +1,19 @@ @@ -64910,7 +64768,7 @@ index 000000000000..9df6d18137a5 +#endif /* _BCACHEFS_MOVE_TYPES_H */ diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c new file mode 100644 -index 000000000000..f913864eaa4f +index 0000000000000..f913864eaa4f5 --- /dev/null +++ b/fs/bcachefs/movinggc.c @@ -0,0 +1,285 @@ @@ -65201,7 +65059,7 @@ index 000000000000..f913864eaa4f +} diff --git a/fs/bcachefs/movinggc.h b/fs/bcachefs/movinggc.h new file mode 100644 -index 000000000000..e85c8136a46e +index 0000000000000..e85c8136a46e9 --- /dev/null +++ b/fs/bcachefs/movinggc.h @@ -0,0 +1,10 @@ @@ -65217,7 +65075,7 @@ index 000000000000..e85c8136a46e +#endif /* _BCACHEFS_MOVINGGC_H */ diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c new file mode 100644 -index 000000000000..407b221e8f6c +index 0000000000000..407b221e8f6c9 --- /dev/null +++ b/fs/bcachefs/opts.c @@ -0,0 +1,578 @@ @@ -65801,7 +65659,7 @@ index 000000000000..407b221e8f6c +} diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h new file mode 100644 -index 000000000000..5b8586ecb374 +index 0000000000000..5b8586ecb3743 --- /dev/null +++ b/fs/bcachefs/opts.h @@ -0,0 +1,509 @@ @@ -66316,7 +66174,7 @@ index 000000000000..5b8586ecb374 +#endif /* _BCACHEFS_OPTS_H */ diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c new file mode 100644 -index 000000000000..454c76e03be9 +index 0000000000000..454c76e03be90 --- /dev/null +++ b/fs/bcachefs/quota.c @@ -0,0 +1,823 @@ @@ -67145,7 +67003,7 @@ index 000000000000..454c76e03be9 +#endif /* CONFIG_BCACHEFS_QUOTA */ diff --git a/fs/bcachefs/quota.h b/fs/bcachefs/quota.h new file mode 100644 -index 000000000000..8c67ae1da7c7 +index 0000000000000..8c67ae1da7c75 --- /dev/null +++ b/fs/bcachefs/quota.h @@ -0,0 +1,71 @@ @@ -67222,7 +67080,7 @@ index 000000000000..8c67ae1da7c7 +#endif /* _BCACHEFS_QUOTA_H */ diff --git a/fs/bcachefs/quota_types.h b/fs/bcachefs/quota_types.h new file mode 100644 -index 000000000000..6a136083d389 +index 0000000000000..6a136083d3899 --- /dev/null +++ b/fs/bcachefs/quota_types.h @@ -0,0 +1,43 @@ @@ -67271,7 +67129,7 @@ index 000000000000..6a136083d389 +#endif /* _BCACHEFS_QUOTA_TYPES_H */ diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c new file mode 100644 -index 000000000000..ecc64dd92b05 +index 0000000000000..ecc64dd92b050 --- /dev/null +++ b/fs/bcachefs/rebalance.c @@ -0,0 +1,361 @@ @@ -67638,7 +67496,7 @@ index 000000000000..ecc64dd92b05 +} diff --git a/fs/bcachefs/rebalance.h b/fs/bcachefs/rebalance.h new file mode 100644 -index 000000000000..7ade0bb81cce +index 0000000000000..7ade0bb81cce8 --- /dev/null +++ b/fs/bcachefs/rebalance.h @@ -0,0 +1,28 @@ @@ -67672,7 +67530,7 @@ index 000000000000..7ade0bb81cce +#endif /* _BCACHEFS_REBALANCE_H */ diff --git a/fs/bcachefs/rebalance_types.h b/fs/bcachefs/rebalance_types.h new file mode 100644 -index 000000000000..7462a92e9598 +index 0000000000000..7462a92e95985 --- /dev/null +++ b/fs/bcachefs/rebalance_types.h @@ -0,0 +1,26 @@ @@ -67704,7 +67562,7 @@ index 000000000000..7462a92e9598 +#endif /* _BCACHEFS_REBALANCE_TYPES_H */ diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c new file mode 100644 -index 000000000000..b070bdf01500 +index 0000000000000..b070bdf01500a --- /dev/null +++ b/fs/bcachefs/recovery.c @@ -0,0 +1,1597 @@ @@ -69307,7 +69165,7 @@ index 000000000000..b070bdf01500 +} diff --git a/fs/bcachefs/recovery.h b/fs/bcachefs/recovery.h new file mode 100644 -index 000000000000..8c0348e8b84c +index 0000000000000..8c0348e8b84cf --- /dev/null +++ b/fs/bcachefs/recovery.h @@ -0,0 +1,58 @@ @@ -69371,7 +69229,7 @@ index 000000000000..8c0348e8b84c +#endif /* _BCACHEFS_RECOVERY_H */ diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c new file mode 100644 -index 000000000000..d5c14bb2992d +index 0000000000000..d5c14bb2992d5 --- /dev/null +++ b/fs/bcachefs/reflink.c @@ -0,0 +1,422 @@ @@ -69799,7 +69657,7 @@ index 000000000000..d5c14bb2992d +} diff --git a/fs/bcachefs/reflink.h b/fs/bcachefs/reflink.h new file mode 100644 -index 000000000000..f9848dc3eebb +index 0000000000000..f9848dc3eebba --- /dev/null +++ b/fs/bcachefs/reflink.h @@ -0,0 +1,76 @@ @@ -69881,7 +69739,7 @@ index 000000000000..f9848dc3eebb +#endif /* _BCACHEFS_REFLINK_H */ diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c new file mode 100644 -index 000000000000..9cb47ba62bc3 +index 0000000000000..9cb47ba62bc3c --- /dev/null +++ b/fs/bcachefs/replicas.c @@ -0,0 +1,1073 @@ @@ -70960,7 +70818,7 @@ index 000000000000..9cb47ba62bc3 +} diff --git a/fs/bcachefs/replicas.h b/fs/bcachefs/replicas.h new file mode 100644 -index 000000000000..87820b2e1ad3 +index 0000000000000..87820b2e1ad3e --- /dev/null +++ b/fs/bcachefs/replicas.h @@ -0,0 +1,106 @@ @@ -71072,7 +70930,7 @@ index 000000000000..87820b2e1ad3 +#endif /* _BCACHEFS_REPLICAS_H */ diff --git a/fs/bcachefs/replicas_types.h b/fs/bcachefs/replicas_types.h new file mode 100644 -index 000000000000..0535b1d3760e +index 0000000000000..0535b1d3760ed --- /dev/null +++ b/fs/bcachefs/replicas_types.h @@ -0,0 +1,10 @@ @@ -71088,7 +70946,7 @@ index 000000000000..0535b1d3760e +#endif /* _BCACHEFS_REPLICAS_TYPES_H */ diff --git a/fs/bcachefs/siphash.c b/fs/bcachefs/siphash.c new file mode 100644 -index 000000000000..c062edb3fbc2 +index 0000000000000..c062edb3fbc24 --- /dev/null +++ b/fs/bcachefs/siphash.c @@ -0,0 +1,173 @@ @@ -71267,7 +71125,7 @@ index 000000000000..c062edb3fbc2 +} diff --git a/fs/bcachefs/siphash.h b/fs/bcachefs/siphash.h new file mode 100644 -index 000000000000..3dfaf34a43b2 +index 0000000000000..3dfaf34a43b28 --- /dev/null +++ b/fs/bcachefs/siphash.h @@ -0,0 +1,87 @@ @@ -71360,7 +71218,7 @@ index 000000000000..3dfaf34a43b2 +#endif /* _SIPHASH_H_ */ diff --git a/fs/bcachefs/str_hash.h b/fs/bcachefs/str_hash.h new file mode 100644 -index 000000000000..591bbb9f8beb +index 0000000000000..591bbb9f8beb5 --- /dev/null +++ b/fs/bcachefs/str_hash.h @@ -0,0 +1,351 @@ @@ -71717,7 +71575,7 @@ index 000000000000..591bbb9f8beb +#endif /* _BCACHEFS_STR_HASH_H */ diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c new file mode 100644 -index 000000000000..b5b0f5e39f97 +index 0000000000000..b5b0f5e39f976 --- /dev/null +++ b/fs/bcachefs/subvolume.c @@ -0,0 +1,1108 @@ @@ -72831,7 +72689,7 @@ index 000000000000..b5b0f5e39f97 +} diff --git a/fs/bcachefs/subvolume.h b/fs/bcachefs/subvolume.h new file mode 100644 -index 000000000000..02a636644988 +index 0000000000000..02a636644988a --- /dev/null +++ b/fs/bcachefs/subvolume.h @@ -0,0 +1,137 @@ @@ -72974,7 +72832,7 @@ index 000000000000..02a636644988 +#endif /* _BCACHEFS_SUBVOLUME_H */ diff --git a/fs/bcachefs/subvolume_types.h b/fs/bcachefs/subvolume_types.h new file mode 100644 -index 000000000000..f7562b5d51df +index 0000000000000..f7562b5d51dff --- /dev/null +++ b/fs/bcachefs/subvolume_types.h @@ -0,0 +1,9 @@ @@ -72989,10 +72847,10 @@ index 000000000000..f7562b5d51df +#endif /* _BCACHEFS_SUBVOLUME_TYPES_H */ diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c new file mode 100644 -index 000000000000..8b8130993a59 +index 0000000000000..55f8c65ad725e --- /dev/null +++ b/fs/bcachefs/super-io.c -@@ -0,0 +1,1602 @@ +@@ -0,0 +1,1605 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "bcachefs.h" @@ -73096,7 +72954,7 @@ index 000000000000..8b8130993a59 +void bch2_free_super(struct bch_sb_handle *sb) +{ + if (sb->bio) -+ bio_put(sb->bio); ++ kfree(sb->bio); + if (!IS_ERR_OR_NULL(sb->bdev)) + blkdev_put(sb->bdev, sb->mode); + @@ -73138,13 +72996,16 @@ index 000000000000..8b8130993a59 + return -ENOMEM; + + if (sb->have_bio) { -+ bio = bio_kmalloc(GFP_KERNEL, -+ DIV_ROUND_UP(new_buffer_size, PAGE_SIZE)); ++ unsigned nr_bvecs = DIV_ROUND_UP(new_buffer_size, PAGE_SIZE); ++ ++ bio = bio_kmalloc(nr_bvecs, GFP_KERNEL); + if (!bio) + return -ENOMEM; + ++ bio_init(bio, NULL, bio->bi_inline_vecs, nr_bvecs, 0); ++ + if (sb->bio) -+ bio_put(sb->bio); ++ kfree(sb->bio); + sb->bio = bio; + } + @@ -74597,7 +74458,7 @@ index 000000000000..8b8130993a59 +} diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h new file mode 100644 -index 000000000000..14a25f6fe29a +index 0000000000000..14a25f6fe29a5 --- /dev/null +++ b/fs/bcachefs/super-io.h @@ -0,0 +1,126 @@ @@ -74729,7 +74590,7 @@ index 000000000000..14a25f6fe29a +#endif /* _BCACHEFS_SUPER_IO_H */ diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c new file mode 100644 -index 000000000000..7c6348001ae3 +index 0000000000000..7c6348001ae39 --- /dev/null +++ b/fs/bcachefs/super.c @@ -0,0 +1,1950 @@ @@ -76685,7 +76546,7 @@ index 000000000000..7c6348001ae3 +module_init(bcachefs_init); diff --git a/fs/bcachefs/super.h b/fs/bcachefs/super.h new file mode 100644 -index 000000000000..8501adaff4c2 +index 0000000000000..8501adaff4c2f --- /dev/null +++ b/fs/bcachefs/super.h @@ -0,0 +1,264 @@ @@ -76955,7 +76816,7 @@ index 000000000000..8501adaff4c2 +#endif /* _BCACHEFS_SUPER_H */ diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h new file mode 100644 -index 000000000000..89419fc7930d +index 0000000000000..89419fc7930d0 --- /dev/null +++ b/fs/bcachefs/super_types.h @@ -0,0 +1,51 @@ @@ -77012,7 +76873,7 @@ index 000000000000..89419fc7930d +#endif /* _BCACHEFS_SUPER_TYPES_H */ diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c new file mode 100644 -index 000000000000..2c650055f530 +index 0000000000000..2c650055f5306 --- /dev/null +++ b/fs/bcachefs/sysfs.c @@ -0,0 +1,943 @@ @@ -77961,7 +77822,7 @@ index 000000000000..2c650055f530 +#endif /* _BCACHEFS_SYSFS_H_ */ diff --git a/fs/bcachefs/sysfs.h b/fs/bcachefs/sysfs.h new file mode 100644 -index 000000000000..222cd5062702 +index 0000000000000..222cd5062702c --- /dev/null +++ b/fs/bcachefs/sysfs.h @@ -0,0 +1,48 @@ @@ -78015,7 +77876,7 @@ index 000000000000..222cd5062702 +#endif /* _BCACHEFS_SYSFS_H_ */ diff --git a/fs/bcachefs/tests.c b/fs/bcachefs/tests.c new file mode 100644 -index 000000000000..56058a56f2a2 +index 0000000000000..56058a56f2a28 --- /dev/null +++ b/fs/bcachefs/tests.c @@ -0,0 +1,976 @@ @@ -78997,7 +78858,7 @@ index 000000000000..56058a56f2a2 +#endif /* CONFIG_BCACHEFS_TESTS */ diff --git a/fs/bcachefs/tests.h b/fs/bcachefs/tests.h new file mode 100644 -index 000000000000..c73b18aea7e0 +index 0000000000000..c73b18aea7e01 --- /dev/null +++ b/fs/bcachefs/tests.h @@ -0,0 +1,15 @@ @@ -79018,7 +78879,7 @@ index 000000000000..c73b18aea7e0 +#endif /* _BCACHEFS_TEST_H */ diff --git a/fs/bcachefs/trace.c b/fs/bcachefs/trace.c new file mode 100644 -index 000000000000..59e8dfa3d245 +index 0000000000000..59e8dfa3d2452 --- /dev/null +++ b/fs/bcachefs/trace.c @@ -0,0 +1,12 @@ @@ -79036,7 +78897,7 @@ index 000000000000..59e8dfa3d245 +#include diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c new file mode 100644 -index 000000000000..ee2c7d9e7050 +index 0000000000000..ee2c7d9e70500 --- /dev/null +++ b/fs/bcachefs/util.c @@ -0,0 +1,964 @@ @@ -80006,7 +79867,7 @@ index 000000000000..ee2c7d9e7050 +} diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h new file mode 100644 -index 000000000000..1fe66fd91ccc +index 0000000000000..1fe66fd91ccc7 --- /dev/null +++ b/fs/bcachefs/util.h @@ -0,0 +1,783 @@ @@ -80795,7 +80656,7 @@ index 000000000000..1fe66fd91ccc +#endif /* _BCACHEFS_UTIL_H */ diff --git a/fs/bcachefs/varint.c b/fs/bcachefs/varint.c new file mode 100644 -index 000000000000..5143b603bf67 +index 0000000000000..5143b603bf67f --- /dev/null +++ b/fs/bcachefs/varint.c @@ -0,0 +1,121 @@ @@ -80922,7 +80783,7 @@ index 000000000000..5143b603bf67 +} diff --git a/fs/bcachefs/varint.h b/fs/bcachefs/varint.h new file mode 100644 -index 000000000000..92a182fb3d7a +index 0000000000000..92a182fb3d7ae --- /dev/null +++ b/fs/bcachefs/varint.h @@ -0,0 +1,11 @@ @@ -80939,7 +80800,7 @@ index 000000000000..92a182fb3d7a +#endif /* _BCACHEFS_VARINT_H */ diff --git a/fs/bcachefs/vstructs.h b/fs/bcachefs/vstructs.h new file mode 100644 -index 000000000000..53a694d71967 +index 0000000000000..53a694d719671 --- /dev/null +++ b/fs/bcachefs/vstructs.h @@ -0,0 +1,63 @@ @@ -81008,7 +80869,7 @@ index 000000000000..53a694d71967 +#endif /* _VSTRUCTS_H */ diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c new file mode 100644 -index 000000000000..186ffab542d5 +index 0000000000000..186ffab542d53 --- /dev/null +++ b/fs/bcachefs/xattr.c @@ -0,0 +1,648 @@ @@ -81662,7 +81523,7 @@ index 000000000000..186ffab542d5 +} diff --git a/fs/bcachefs/xattr.h b/fs/bcachefs/xattr.h new file mode 100644 -index 000000000000..66d7a1e30350 +index 0000000000000..66d7a1e30350e --- /dev/null +++ b/fs/bcachefs/xattr.h @@ -0,0 +1,50 @@ @@ -81717,7 +81578,7 @@ index 000000000000..66d7a1e30350 + +#endif /* _BCACHEFS_XATTR_H */ diff --git a/fs/d_path.c b/fs/d_path.c -index e4e0ebad1f15..1bd9e85f2f65 100644 +index e4e0ebad1f153..1bd9e85f2f65a 100644 --- a/fs/d_path.c +++ b/fs/d_path.c @@ -5,6 +5,7 @@ @@ -81770,7 +81631,7 @@ index e4e0ebad1f15..1bd9e85f2f65 100644 * Helper function for dentry_operations.d_dname() members */ diff --git a/fs/dcache.c b/fs/dcache.c -index 93f4f5ee07bf..d90ed65e2a75 100644 +index 93f4f5ee07bfd..d90ed65e2a75f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -3193,9 +3193,8 @@ void d_genocide(struct dentry *parent) @@ -81799,7 +81660,7 @@ index 93f4f5ee07bf..d90ed65e2a75 100644 } EXPORT_SYMBOL(d_tmpfile); diff --git a/fs/inode.c b/fs/inode.c -index bd4da9c5207e..ac0da28a1ac6 100644 +index bd4da9c5207ea..ac0da28a1ac6e 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -56,8 +56,23 @@ @@ -82286,7 +82147,7 @@ index bd4da9c5207e..ac0da28a1ac6 100644 14, HASH_ZERO, diff --git a/include/linux/bio.h b/include/linux/bio.h -index 992ee987f273..6d5acc1b407f 100644 +index 992ee987f2738..6d5acc1b407fa 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -480,7 +480,12 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, @@ -82304,7 +82165,7 @@ index 992ee987f273..6d5acc1b407f 100644 static inline void bio_release_pages(struct bio *bio, bool mark_dirty) { diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 2f7b43444c5f..4ef515977abc 100644 +index 2f7b43444c5f8..4ef515977abc2 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -884,6 +884,7 @@ extern const char *blk_op_str(unsigned int op); @@ -82319,7 +82180,7 @@ diff --git a/drivers/md/bcache/closure.h b/include/linux/closure.h similarity index 94% rename from drivers/md/bcache/closure.h rename to include/linux/closure.h -index c88cdc4ae4ec..36b4a83f9b77 100644 +index c88cdc4ae4ec5..36b4a83f9b774 100644 --- a/drivers/md/bcache/closure.h +++ b/include/linux/closure.h @@ -155,7 +155,7 @@ struct closure { @@ -82427,7 +82288,7 @@ index c88cdc4ae4ec..36b4a83f9b77 100644 + #endif /* _LINUX_CLOSURE_H */ diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h -index 445e80517cab..57e7d0b94119 100644 +index 445e80517cab6..57e7d0b94119e 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -371,4 +371,9 @@ @@ -82441,7 +82302,7 @@ index 445e80517cab..57e7d0b94119 100644 + #endif /* __LINUX_COMPILER_ATTRIBUTES_H */ diff --git a/include/linux/dcache.h b/include/linux/dcache.h -index f5bba51480b2..6c661059a55b 100644 +index f5bba51480b2f..6c661059a55b6 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -248,6 +248,7 @@ extern struct dentry * d_make_root(struct inode *); @@ -82461,7 +82322,7 @@ index f5bba51480b2..6c661059a55b 100644 /* Allocation counts.. */ diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h -index fe848901fcc3..5a3cc0e1da9b 100644 +index fe848901fcc3a..5a3cc0e1da9b9 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -98,6 +98,12 @@ enum fid_type { @@ -82478,7 +82339,7 @@ index fe848901fcc3..5a3cc0e1da9b 100644 * 128 bit child FID (struct lu_fid) * 128 bit parent FID (struct lu_fid) diff --git a/include/linux/fs.h b/include/linux/fs.h -index 9ad5e3520fae..1f7671a674e3 100644 +index 9ad5e3520fae5..1f7671a674e34 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -630,7 +630,8 @@ struct inode { @@ -82519,7 +82380,7 @@ index 9ad5e3520fae..1f7671a674e3 100644 } diff --git a/include/linux/generic-radix-tree.h b/include/linux/generic-radix-tree.h -index 107613f7d792..c74b7376990d 100644 +index 107613f7d7920..c74b7376990d5 100644 --- a/include/linux/generic-radix-tree.h +++ b/include/linux/generic-radix-tree.h @@ -38,6 +38,7 @@ @@ -82630,7 +82491,7 @@ index 107613f7d792..c74b7376990d 100644 /** diff --git a/include/linux/kernel.h b/include/linux/kernel.h -index fe6efb24d151..9ba5a53c6ad5 100644 +index fe6efb24d151a..9ba5a53c6ad55 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -202,11 +202,17 @@ static inline void might_fault(void) { } @@ -82665,7 +82526,7 @@ index fe6efb24d151..9ba5a53c6ad5 100644 /* diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h -index ae1b541446c9..8ee2bf5af131 100644 +index ae1b541446c90..8ee2bf5af1318 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h @@ -143,6 +143,28 @@ static inline void hlist_bl_del_init(struct hlist_bl_node *n) @@ -82698,7 +82559,7 @@ index ae1b541446c9..8ee2bf5af131 100644 { bit_spin_lock(0, (unsigned long *)b); diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h -index b6829b970093..5b90b2abd326 100644 +index b6829b9700936..5b90b2abd326c 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -335,6 +335,8 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); @@ -82721,7 +82582,7 @@ index b6829b970093..5b90b2abd326 100644 enum xhlock_context_t { diff --git a/include/linux/pretty-printers.h b/include/linux/pretty-printers.h new file mode 100644 -index 000000000000..f39d8edfba02 +index 0000000000000..f39d8edfba025 --- /dev/null +++ b/include/linux/pretty-printers.h @@ -0,0 +1,10 @@ @@ -82737,7 +82598,7 @@ index 000000000000..f39d8edfba02 +#endif /* _LINUX_PRETTY_PRINTERS_H */ diff --git a/include/linux/printbuf.h b/include/linux/printbuf.h new file mode 100644 -index 000000000000..861c5d75f852 +index 0000000000000..861c5d75f852a --- /dev/null +++ b/include/linux/printbuf.h @@ -0,0 +1,283 @@ @@ -83025,7 +82886,7 @@ index 000000000000..861c5d75f852 + +#endif /* _LINUX_PRINTBUF_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h -index c46f3a63b758..5038c87db740 100644 +index c46f3a63b758f..5038c87db7402 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -857,6 +857,7 @@ struct task_struct { @@ -83038,7 +82899,7 @@ index c46f3a63b758..5038c87db740 100644 struct vmacache vmacache; diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h deleted file mode 100644 -index 5b31c5147969..000000000000 +index 5b31c51479694..0000000000000 --- a/include/linux/seq_buf.h +++ /dev/null @@ -1,162 +0,0 @@ @@ -83205,7 +83066,7 @@ index 5b31c5147969..000000000000 - -#endif /* _LINUX_SEQ_BUF_H */ diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h -index 76fbf92b04d9..12967748f9f7 100644 +index 76fbf92b04d95..12967748f9f7b 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -2,6 +2,8 @@ @@ -83248,7 +83109,7 @@ index 76fbf92b04d9..12967748f9f7 100644 #endif diff --git a/include/linux/six.h b/include/linux/six.h new file mode 100644 -index 000000000000..477c33eb00d7 +index 0000000000000..477c33eb00d7d --- /dev/null +++ b/include/linux/six.h @@ -0,0 +1,203 @@ @@ -83456,7 +83317,7 @@ index 000000000000..477c33eb00d7 + +#endif /* _LINUX_SIX_H */ diff --git a/include/linux/string.h b/include/linux/string.h -index 61ec7e4f6311..22a45d553fbc 100644 +index 61ec7e4f6311a..22a45d553fbc0 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -195,7 +195,12 @@ int __sysfs_match_string(const char * const *array, size_t n, const char *s); @@ -83473,7 +83334,7 @@ index 61ec7e4f6311..22a45d553fbc 100644 int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h -index 4d72258d42fd..52e0f1d283b9 100644 +index 4d72258d42fd9..52e0f1d283b9e 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -10,6 +10,7 @@ @@ -83513,7 +83374,7 @@ index 4d72258d42fd..52e0f1d283b9 100644 unsigned int flags, const char *only) { diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h -index e6e95a9f07a5..48471e32f8e4 100644 +index e6e95a9f07a52..48471e32f8e48 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -496,7 +496,7 @@ struct dynevent_cmd; @@ -83526,7 +83387,7 @@ index e6e95a9f07a5..48471e32f8e4 100644 unsigned int n_fields; enum dynevent_type type; diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h -index 5a2c650d9e1c..d2b51007b3b9 100644 +index 5a2c650d9e1c1..d2b51007b3b99 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h @@ -2,10 +2,12 @@ @@ -83598,7 +83459,7 @@ index 5a2c650d9e1c..d2b51007b3b9 100644 extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h -index 096d48aa3437..8d11e2e4ddc8 100644 +index 096d48aa34373..8d11e2e4ddc8c 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -144,6 +144,7 @@ extern void *vzalloc(unsigned long size) __alloc_size(1); @@ -83610,7 +83471,7 @@ index 096d48aa3437..8d11e2e4ddc8 100644 extern void *vmalloc_32_user(unsigned long size) __alloc_size(1); extern void *__vmalloc(unsigned long size, gfp_t gfp_mask) __alloc_size(1); diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h -index 24a509f559ee..0b20ee6854d6 100644 +index 24a509f559ee2..0b20ee6854d6c 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h @@ -539,12 +539,12 @@ struct p9_rstatfs { @@ -83628,7 +83489,7 @@ index 24a509f559ee..0b20ee6854d6 100644 }; diff --git a/include/net/9p/client.h b/include/net/9p/client.h -index ec1d1706f43c..832dcc866a20 100644 +index ec1d1706f43c0..832dcc866a201 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -9,6 +9,7 @@ @@ -83691,10 +83552,10 @@ index ec1d1706f43c..832dcc866a20 100644 diff --git a/include/trace/events/bcachefs.h b/include/trace/events/bcachefs.h new file mode 100644 -index 000000000000..140834e7406e +index 0000000000000..1c7ca964748d5 --- /dev/null +++ b/include/trace/events/bcachefs.h -@@ -0,0 +1,1048 @@ +@@ -0,0 +1,1045 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM bcachefs @@ -84007,27 +83868,24 @@ index 000000000000..140834e7406e +); + +TRACE_EVENT(btree_reserve_get_fail, -+ TP_PROTO(const char *trans_fn, -+ unsigned long caller_ip, -+ size_t required), -+ TP_ARGS(trans_fn, caller_ip, required), ++ TP_PROTO(struct bch_fs *c, size_t required, struct closure *cl), ++ TP_ARGS(c, required, cl), + + TP_STRUCT__entry( -+ __array(char, trans_fn, 24 ) -+ __field(unsigned long, caller_ip ) ++ __field(dev_t, dev ) + __field(size_t, required ) ++ __field(struct closure *, cl ) + ), + + TP_fast_assign( -+ strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn)); -+ __entry->caller_ip = caller_ip; -+ __entry->required = required; ++ __entry->dev = c->dev; ++ __entry->required = required; ++ __entry->cl = cl; + ), + -+ TP_printk("%s %pS required %zu", -+ __entry->trans_fn, -+ (void *) __entry->caller_ip, -+ __entry->required) ++ TP_printk("%d,%d required %zu by %p", ++ MAJOR(__entry->dev), MINOR(__entry->dev), ++ __entry->required, __entry->cl) +); + +DEFINE_EVENT(btree_node, btree_split, @@ -84744,7 +84602,7 @@ index 000000000000..140834e7406e +/* This part must be outside protection */ +#include diff --git a/init/init_task.c b/init/init_task.c -index 73cc8f03511a..3e3aed110153 100644 +index 73cc8f03511a3..3e3aed1101539 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -85,6 +85,7 @@ struct task_struct init_task @@ -84756,7 +84614,7 @@ index 73cc8f03511a..3e3aed110153 100644 .fn = do_no_restart_syscall, }, diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks -index 4198f0273ecd..b2abd9a5d9ab 100644 +index 4198f0273ecdc..b2abd9a5d9abd 100644 --- a/kernel/Kconfig.locks +++ b/kernel/Kconfig.locks @@ -259,3 +259,6 @@ config ARCH_HAS_MMIOWB @@ -84767,7 +84625,7 @@ index 4198f0273ecd..b2abd9a5d9ab 100644 +config SIXLOCKS + bool diff --git a/kernel/locking/Makefile b/kernel/locking/Makefile -index d51cabf28f38..cadbf6520c4b 100644 +index d51cabf28f382..cadbf6520c4b4 100644 --- a/kernel/locking/Makefile +++ b/kernel/locking/Makefile @@ -32,3 +32,4 @@ obj-$(CONFIG_QUEUED_RWLOCKS) += qrwlock.o @@ -84776,7 +84634,7 @@ index d51cabf28f38..cadbf6520c4b 100644 obj-$(CONFIG_LOCK_EVENT_COUNTS) += lock_events.o +obj-$(CONFIG_SIXLOCKS) += six.o diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c -index f06b91ca6482..0b1a3a949b47 100644 +index f06b91ca6482d..0b1a3a949b478 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -6483,6 +6483,26 @@ void debug_check_no_locks_held(void) @@ -84808,7 +84666,7 @@ index f06b91ca6482..0b1a3a949b47 100644 { diff --git a/kernel/locking/six.c b/kernel/locking/six.c new file mode 100644 -index 000000000000..fca1208720b6 +index 0000000000000..fca1208720b67 --- /dev/null +++ b/kernel/locking/six.c @@ -0,0 +1,759 @@ @@ -85572,7 +85430,7 @@ index 000000000000..fca1208720b6 +} +EXPORT_SYMBOL_GPL(six_lock_pcpu_alloc); diff --git a/kernel/module/main.c b/kernel/module/main.c -index 0548151dd933..55ba98a99387 100644 +index 0548151dd9339..55ba98a99387d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1608,9 +1608,7 @@ static void dynamic_debug_remove(struct module *mod, struct _ddebug *debug) @@ -85586,28 +85444,8 @@ index 0548151dd933..55ba98a99387 100644 } bool __weak module_init_section(const char *name) -diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c -index 9ed5ce989415..3428568bb3f1 100644 ---- a/kernel/stacktrace.c -+++ b/kernel/stacktrace.c -@@ -151,6 +151,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store, - put_task_stack(tsk); - return c.len; - } -+EXPORT_SYMBOL(stack_trace_save_tsk); - - /** - * stack_trace_save_regs - Save a stack trace based on pt_regs into a storage array -@@ -301,6 +302,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *task, - save_stack_trace_tsk(task, &trace); - return trace.nr_entries; - } -+EXPORT_SYMBOL(stack_trace_save_tsk); - - /** - * stack_trace_save_regs - Save a stack trace based on pt_regs into a storage array diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index b8dd54627075..26cfe909f9af 100644 +index b8dd546270750..26cfe909f9af6 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1673,15 +1673,15 @@ static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt) @@ -85727,7 +85565,7 @@ index b8dd54627075..26cfe909f9af 100644 printk(KERN_TRACE "%s", s->buffer); diff --git a/kernel/trace/trace_dynevent.c b/kernel/trace/trace_dynevent.c -index 076b447a1b88..30a106c16871 100644 +index 076b447a1b889..30a106c168711 100644 --- a/kernel/trace/trace_dynevent.c +++ b/kernel/trace/trace_dynevent.c @@ -290,21 +290,19 @@ int dynevent_arg_add(struct dynevent_cmd *cmd, @@ -85817,7 +85655,7 @@ index 076b447a1b88..30a106c16871 100644 cmd->run_command = run_command; } diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c -index 4b1057ab9d96..9d5137df1a15 100644 +index 4b1057ab9d968..9d5137df1a158 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1059,7 +1059,7 @@ static void append_filter_err(struct trace_array *tr, @@ -85830,7 +85668,7 @@ index 4b1057ab9d96..9d5137df1a15 100644 kfree(filter->filter_string); filter->filter_string = buf; diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c -index 5e8c07aef071..ddb2a2737b82 100644 +index 5e8c07aef071b..ddb2a2737b82e 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -5,13 +5,14 @@ @@ -85911,7 +85749,7 @@ index 5e8c07aef071..ddb2a2737b82 100644 return ret; diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c -index 203204cadf92..9f270fdde99b 100644 +index 203204cadf92f..9f270fdde99bb 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -1022,9 +1022,9 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, @@ -85928,7 +85766,7 @@ index 203204cadf92..9f270fdde99b 100644 trace_seq_puts(s, " */\n"); diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c -index a245ea673715..c9f03c2d7c91 100644 +index a245ea673715d..c9f03c2d7c914 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -915,7 +915,7 @@ static int create_or_delete_trace_kprobe(const char *raw_command) @@ -85941,7 +85779,7 @@ index a245ea673715..c9f03c2d7c91 100644 /** diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c -index 9c90b3a7dce2..48c08f29c342 100644 +index 9c90b3a7dce2c..48c08f29c3424 100644 --- a/kernel/trace/trace_seq.c +++ b/kernel/trace/trace_seq.c @@ -25,11 +25,9 @@ @@ -86220,7 +86058,7 @@ index 9c90b3a7dce2..48c08f29c342 100644 return 0; } diff --git a/lib/Kconfig b/lib/Kconfig -index eaaad4d85bf2..8eb7050fb422 100644 +index eaaad4d85bf24..8eb7050fb422f 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -491,6 +491,9 @@ config ASSOCIATIVE_ARRAY @@ -86234,7 +86072,7 @@ index eaaad4d85bf2..8eb7050fb422 100644 bool depends on !NO_IOMEM diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 2e24db4bff19..1d4ed12a5355 100644 +index 2e24db4bff192..1d4ed12a5355b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1646,6 +1646,15 @@ config DEBUG_CREDENTIALS @@ -86254,7 +86092,7 @@ index 2e24db4bff19..1d4ed12a5355 100644 bool "Force round-robin CPU selection for unbound work items" depends on DEBUG_KERNEL diff --git a/lib/Makefile b/lib/Makefile -index f99bf61f8bbc..d24209a59df9 100644 +index f99bf61f8bbc6..d24209a59df93 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -30,11 +30,11 @@ endif @@ -86285,7 +86123,7 @@ diff --git a/drivers/md/bcache/closure.c b/lib/closure.c similarity index 88% rename from drivers/md/bcache/closure.c rename to lib/closure.c -index d8d9394a6beb..b38ded00b9b0 100644 +index d8d9394a6beb1..b38ded00b9b05 100644 --- a/drivers/md/bcache/closure.c +++ b/lib/closure.c @@ -6,13 +6,12 @@ @@ -86398,17 +86236,8 @@ index d8d9394a6beb..b38ded00b9b0 100644 -MODULE_AUTHOR("Kent Overstreet "); -MODULE_LICENSE("GPL"); +#endif -diff --git a/lib/errname.c b/lib/errname.c -index 05cbf731545f..82ea4778f478 100644 ---- a/lib/errname.c -+++ b/lib/errname.c -@@ -222,3 +222,4 @@ const char *errname(int err) - - return err > 0 ? name + 1 : name; - } -+EXPORT_SYMBOL(errname); diff --git a/lib/generic-radix-tree.c b/lib/generic-radix-tree.c -index f25eb111c051..41f1bcdc4488 100644 +index f25eb111c0516..41f1bcdc44886 100644 --- a/lib/generic-radix-tree.c +++ b/lib/generic-radix-tree.c @@ -1,4 +1,5 @@ @@ -86515,7 +86344,7 @@ index f25eb111c051..41f1bcdc4488 100644 { if (level) { diff --git a/lib/hexdump.c b/lib/hexdump.c -index 06833d404398..9556f15ad295 100644 +index 06833d404398d..9556f15ad2953 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -9,6 +9,7 @@ @@ -86822,7 +86651,7 @@ index 06833d404398..9556f15ad295 100644 unsigned char linebuf[32 * 3 + 2 + 32 + 1]; diff --git a/lib/pretty-printers.c b/lib/pretty-printers.c new file mode 100644 -index 000000000000..addbac95e065 +index 0000000000000..addbac95e065e --- /dev/null +++ b/lib/pretty-printers.c @@ -0,0 +1,60 @@ @@ -86888,7 +86717,7 @@ index 000000000000..addbac95e065 +EXPORT_SYMBOL(prt_bitflags); diff --git a/lib/printbuf.c b/lib/printbuf.c new file mode 100644 -index 000000000000..047470025748 +index 0000000000000..0474700257484 --- /dev/null +++ b/lib/printbuf.c @@ -0,0 +1,258 @@ @@ -87152,7 +86981,7 @@ index 000000000000..047470025748 +EXPORT_SYMBOL(prt_units_s64); diff --git a/lib/seq_buf.c b/lib/seq_buf.c deleted file mode 100644 -index 0a68f7aa85d6..000000000000 +index 0a68f7aa85d67..0000000000000 --- a/lib/seq_buf.c +++ /dev/null @@ -1,397 +0,0 @@ @@ -87554,7 +87383,7 @@ index 0a68f7aa85d6..000000000000 - return 0; -} diff --git a/lib/string_helpers.c b/lib/string_helpers.c -index 5ed3beb066e6..d247bf945f16 100644 +index 5ed3beb066e6d..d247bf945f162 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -15,6 +15,7 @@ @@ -87894,7 +87723,7 @@ index 5ed3beb066e6..d247bf945f16 100644 EXPORT_SYMBOL(string_escape_mem); diff --git a/lib/test_hexdump.c b/lib/test_hexdump.c -index 5144899d3c6b..f9e97879dcdf 100644 +index 5144899d3c6b8..f9e97879dcdf2 100644 --- a/lib/test_hexdump.c +++ b/lib/test_hexdump.c @@ -25,36 +25,19 @@ static const char * const test_data_1[] __initconst = { @@ -87961,7 +87790,7 @@ index 5144899d3c6b..f9e97879dcdf 100644 result = test_data_1; diff --git a/lib/test_printf.c b/lib/test_printf.c -index 07309c45f327..ac5f9f0eb4e0 100644 +index 07309c45f3279..ac5f9f0eb4e0e 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -9,6 +9,7 @@ @@ -88026,7 +87855,7 @@ index 07309c45f327..ac5f9f0eb4e0 100644 kfree(alloced_buffer); } diff --git a/lib/vsprintf.c b/lib/vsprintf.c -index 3c1853a9d1c0..d92a212db2f5 100644 +index 3c1853a9d1c09..d92a212db2f5f 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -44,6 +44,7 @@ @@ -90843,7 +90672,7 @@ index 3c1853a9d1c0..d92a212db2f5 100644 EXPORT_SYMBOL_GPL(bstr_printf); diff --git a/mm/Makefile b/mm/Makefile -index 6f9ffa968a1a..9731f495bbce 100644 +index 6f9ffa968a1a1..9731f495bbceb 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -54,7 +54,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \ @@ -90856,7 +90685,7 @@ index 6f9ffa968a1a..9731f495bbce 100644 # Give 'page_alloc' its own module-parameter namespace page-alloc-y := page_alloc.o diff --git a/mm/filemap.c b/mm/filemap.c -index ffdfbc8b0e3c..8b9e18f79f2b 100644 +index ffdfbc8b0e3ca..8b9e18f79f2b1 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2223,6 +2223,7 @@ unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start, @@ -90868,7 +90697,7 @@ index ffdfbc8b0e3c..8b9e18f79f2b 100644 /** * find_get_pages_contig - gang contiguous pagecache lookup diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index 618c366a2f07..660ddd48267d 100644 +index 618c366a2f074..1371a93f55de8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -62,7 +62,7 @@ @@ -90895,7 +90724,7 @@ index 618c366a2f07..660ddd48267d 100644 /* * Provide statistics on the state of the memory subsystem as * well as cumulative event counters that show past behavior. -@@ -1485,43 +1481,43 @@ static char *memory_stat_format(struct mem_cgroup *memcg) +@@ -1485,56 +1481,58 @@ static char *memory_stat_format(struct mem_cgroup *memcg) u64 size; size = memcg_page_state_output(memcg, memory_stats[i].idx); @@ -90959,13 +90788,9 @@ index 618c366a2f07..660ddd48267d 100644 - seq_buf_printf(&s, "%s %lu\n", vm_event_name(ZSWPOUT), - memcg_events(memcg, ZSWPOUT)); + prt_printf(&buf, "%s %lu\n", vm_event_name(ZSWPIN), -+ memcg_events(memcg, ZSWPIN)); ++ memcg_events(memcg, ZSWPIN)); + prt_printf(&buf, "%s %lu\n", vm_event_name(ZSWPOUT), -+ memcg_events(memcg, ZSWPOUT)); - #endif - - #ifdef CONFIG_TRANSPARENT_HUGEPAGE -@@ -1525,16 +1521,18 @@ static char *memory_stat_format(struct mem_cgroup *memcg) ++ memcg_events(memcg, ZSWPOUT)); #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -90992,7 +90817,7 @@ index 618c366a2f07..660ddd48267d 100644 #define K(x) ((x) << (PAGE_SHIFT-10)) diff --git a/mm/nommu.c b/mm/nommu.c -index 9d7afc2d959e..dd53020262d8 100644 +index 9d7afc2d959e4..dd53020262d8e 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -281,6 +281,24 @@ void *vzalloc_node(unsigned long size, int node) @@ -91021,7 +90846,7 @@ index 9d7afc2d959e..dd53020262d8 100644 * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) * @size: allocation size diff --git a/mm/oom_kill.c b/mm/oom_kill.c -index 3c6cf9e3cd66..e4dca11dc54a 100644 +index 3c6cf9e3cd66e..e4dca11dc54aa 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -168,27 +168,6 @@ static bool oom_unkillable_task(struct task_struct *p) @@ -91065,7 +90890,7 @@ diff --git a/lib/show_mem.c b/mm/show_mem.c similarity index 83% rename from lib/show_mem.c rename to mm/show_mem.c -index 1c26c14ffbb9..47225158ce49 100644 +index 1c26c14ffbb9b..47225158ce490 100644 --- a/lib/show_mem.c +++ b/mm/show_mem.c @@ -7,6 +7,9 @@ @@ -91089,7 +90914,7 @@ index 1c26c14ffbb9..47225158ce49 100644 + printk("%pf()", CALL_PP(shrinkers_to_text)); } diff --git a/mm/slab.h b/mm/slab.h -index db9fb5c8dae7..502616394f7f 100644 +index db9fb5c8dae73..502616394f7fe 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -806,10 +806,12 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) @@ -91108,17 +90933,17 @@ index db9fb5c8dae7..502616394f7f 100644 } #endif diff --git a/mm/slab_common.c b/mm/slab_common.c -index 77c3adf40e50..3be0d468a599 100644 +index 77c3adf40e504..2ea6585832c4e 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c -@@ -25,6 +25,7 @@ +@@ -24,6 +24,7 @@ + #include #include #include - #include +#include + #include #define CREATE_TRACE_POINTS - #include @@ -1085,10 +1086,15 @@ static int slab_show(struct seq_file *m, void *p) return 0; } @@ -91200,7 +91025,7 @@ index 77c3adf40e50..3be0d468a599 100644 } diff --git a/mm/vmalloc.c b/mm/vmalloc.c -index effd1ff6a4b4..ea6375c960a2 100644 +index effd1ff6a4b41..ea6375c960a2b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3361,6 +3361,27 @@ void *vzalloc_node(unsigned long size, int node) @@ -91232,7 +91057,7 @@ index effd1ff6a4b4..ea6375c960a2 100644 #define GFP_VMALLOC32 (GFP_DMA32 | GFP_KERNEL) #elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA) diff --git a/mm/vmscan.c b/mm/vmscan.c -index f7d9a683e3a7..0ea3ce8e258f 100644 +index f7d9a683e3a7d..0ea3ce8e258f1 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -50,6 +50,7 @@ @@ -91351,7 +91176,7 @@ index f7d9a683e3a7..0ea3ce8e258f 100644 count_vm_events(SLABS_SCANNED, shrinkctl->nr_scanned); total_scan -= shrinkctl->nr_scanned; diff --git a/net/9p/client.c b/net/9p/client.c -index 8bba0d9cf975..e14074d031c6 100644 +index 8bba0d9cf9754..e14074d031c6a 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -218,23 +218,29 @@ static int parse_opts(char *opts, struct p9_client *clnt) @@ -91561,7 +91386,7 @@ index 8bba0d9cf975..e14074d031c6 100644 kfree(clnt); } diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c -index 8f8f95e39b03..007c3f45fe05 100644 +index 8f8f95e39b03a..007c3f45fe052 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -378,7 +378,7 @@ static void p9_read_work(struct work_struct *work) @@ -91616,7 +91441,7 @@ index 8f8f95e39b03..007c3f45fe05 100644 } diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c -index 88e563826674..99d878d70d56 100644 +index 88e5638266743..99d878d70d56c 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -350,7 +350,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc) @@ -91638,7 +91463,7 @@ index 88e563826674..99d878d70d56 100644 goto dont_need_post_recv; } else { diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c -index b24a4fb0f0a2..147972bf2e79 100644 +index b24a4fb0f0a23..147972bf2e797 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -199,7 +199,7 @@ static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req) @@ -91660,7 +91485,7 @@ index b24a4fb0f0a2..147972bf2e79 100644 return err; } diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c -index 833cd3792c51..227f89cc7237 100644 +index 833cd3792c51c..227f89cc7237c 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -163,7 +163,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) @@ -91673,7 +91498,7 @@ index 833cd3792c51..227f89cc7237 100644 return 0; } diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c -index 4d1a947367f9..a2097955dace 100644 +index 4d1a947367f9b..a2097955dacee 100644 --- a/tools/testing/nvdimm/test/ndtest.c +++ b/tools/testing/nvdimm/test/ndtest.c @@ -12,7 +12,7 @@