bcachefs.h (63508b756443cb38e432dea01fec36248cb25cd7) | bcachefs.h (2b41226d7f4b3b836a2a3e4ce08ab18ba03f0cd0) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _BCACHEFS_H 3#define _BCACHEFS_H 4 5/* 6 * SOME HIGH LEVEL CODE DOCUMENTATION: 7 * 8 * Bcache mostly works with cache sets, cache devices, and backing devices. --- 250 unchanged lines hidden (view full) --- 259#define bch2_fmt_inum(_c, _inum, fmt) "inum %llu: " fmt "\n", (_inum) 260#define bch2_fmt_inum_offset(_c, _inum, _offset, fmt) \ 261 "inum %llu offset %llu: " fmt "\n", (_inum), (_offset) 262 263#endif 264 265#define bch2_fmt(_c, fmt) bch2_log_msg(_c, fmt "\n") 266 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _BCACHEFS_H 3#define _BCACHEFS_H 4 5/* 6 * SOME HIGH LEVEL CODE DOCUMENTATION: 7 * 8 * Bcache mostly works with cache sets, cache devices, and backing devices. --- 250 unchanged lines hidden (view full) --- 259#define bch2_fmt_inum(_c, _inum, fmt) "inum %llu: " fmt "\n", (_inum) 260#define bch2_fmt_inum_offset(_c, _inum, _offset, fmt) \ 261 "inum %llu offset %llu: " fmt "\n", (_inum), (_offset) 262 263#endif 264 265#define bch2_fmt(_c, fmt) bch2_log_msg(_c, fmt "\n") 266 |
267__printf(2, 3) 268void __bch2_print(struct bch_fs *c, const char *fmt, ...); 269 270#define maybe_dev_to_fs(_c) _Generic((_c), \ 271 struct bch_dev *: ((struct bch_dev *) (_c))->fs, \ 272 struct bch_fs *: (_c)) 273 274#define bch2_print(_c, ...) __bch2_print(maybe_dev_to_fs(_c), __VA_ARGS__) 275 276#define bch2_print_ratelimited(_c, ...) \ 277do { \ 278 static DEFINE_RATELIMIT_STATE(_rs, \ 279 DEFAULT_RATELIMIT_INTERVAL, \ 280 DEFAULT_RATELIMIT_BURST); \ 281 \ 282 if (__ratelimit(&_rs)) \ 283 bch2_print(_c, __VA_ARGS__); \ 284} while (0) 285 |
|
267#define bch_info(c, fmt, ...) \ | 286#define bch_info(c, fmt, ...) \ |
268 printk(KERN_INFO bch2_fmt(c, fmt), ##__VA_ARGS__) | 287 bch2_print(c, KERN_INFO bch2_fmt(c, fmt), ##__VA_ARGS__) |
269#define bch_notice(c, fmt, ...) \ | 288#define bch_notice(c, fmt, ...) \ |
270 printk(KERN_NOTICE bch2_fmt(c, fmt), ##__VA_ARGS__) | 289 bch2_print(c, KERN_NOTICE bch2_fmt(c, fmt), ##__VA_ARGS__) |
271#define bch_warn(c, fmt, ...) \ | 290#define bch_warn(c, fmt, ...) \ |
272 printk(KERN_WARNING bch2_fmt(c, fmt), ##__VA_ARGS__) | 291 bch2_print(c, KERN_WARNING bch2_fmt(c, fmt), ##__VA_ARGS__) |
273#define bch_warn_ratelimited(c, fmt, ...) \ | 292#define bch_warn_ratelimited(c, fmt, ...) \ |
274 printk_ratelimited(KERN_WARNING bch2_fmt(c, fmt), ##__VA_ARGS__) | 293 bch2_print_ratelimited(c, KERN_WARNING bch2_fmt(c, fmt), ##__VA_ARGS__) |
275 276#define bch_err(c, fmt, ...) \ | 294 295#define bch_err(c, fmt, ...) \ |
277 printk(KERN_ERR bch2_fmt(c, fmt), ##__VA_ARGS__) | 296 bch2_print(c, KERN_ERR bch2_fmt(c, fmt), ##__VA_ARGS__) |
278#define bch_err_dev(ca, fmt, ...) \ | 297#define bch_err_dev(ca, fmt, ...) \ |
279 printk(KERN_ERR bch2_fmt_dev(ca, fmt), ##__VA_ARGS__) | 298 bch2_print(c, KERN_ERR bch2_fmt_dev(ca, fmt), ##__VA_ARGS__) |
280#define bch_err_dev_offset(ca, _offset, fmt, ...) \ | 299#define bch_err_dev_offset(ca, _offset, fmt, ...) \ |
281 printk(KERN_ERR bch2_fmt_dev_offset(ca, _offset, fmt), ##__VA_ARGS__) | 300 bch2_print(c, KERN_ERR bch2_fmt_dev_offset(ca, _offset, fmt), ##__VA_ARGS__) |
282#define bch_err_inum(c, _inum, fmt, ...) \ | 301#define bch_err_inum(c, _inum, fmt, ...) \ |
283 printk(KERN_ERR bch2_fmt_inum(c, _inum, fmt), ##__VA_ARGS__) | 302 bch2_print(c, KERN_ERR bch2_fmt_inum(c, _inum, fmt), ##__VA_ARGS__) |
284#define bch_err_inum_offset(c, _inum, _offset, fmt, ...) \ | 303#define bch_err_inum_offset(c, _inum, _offset, fmt, ...) \ |
285 printk(KERN_ERR bch2_fmt_inum_offset(c, _inum, _offset, fmt), ##__VA_ARGS__) | 304 bch2_print(c, KERN_ERR bch2_fmt_inum_offset(c, _inum, _offset, fmt), ##__VA_ARGS__) |
286 287#define bch_err_ratelimited(c, fmt, ...) \ | 305 306#define bch_err_ratelimited(c, fmt, ...) \ |
288 printk_ratelimited(KERN_ERR bch2_fmt(c, fmt), ##__VA_ARGS__) | 307 bch2_print_ratelimited(c, KERN_ERR bch2_fmt(c, fmt), ##__VA_ARGS__) |
289#define bch_err_dev_ratelimited(ca, fmt, ...) \ | 308#define bch_err_dev_ratelimited(ca, fmt, ...) \ |
290 printk_ratelimited(KERN_ERR bch2_fmt_dev(ca, fmt), ##__VA_ARGS__) | 309 bch2_print_ratelimited(ca, KERN_ERR bch2_fmt_dev(ca, fmt), ##__VA_ARGS__) |
291#define bch_err_dev_offset_ratelimited(ca, _offset, fmt, ...) \ | 310#define bch_err_dev_offset_ratelimited(ca, _offset, fmt, ...) \ |
292 printk_ratelimited(KERN_ERR bch2_fmt_dev_offset(ca, _offset, fmt), ##__VA_ARGS__) | 311 bch2_print_ratelimited(ca, KERN_ERR bch2_fmt_dev_offset(ca, _offset, fmt), ##__VA_ARGS__) |
293#define bch_err_inum_ratelimited(c, _inum, fmt, ...) \ | 312#define bch_err_inum_ratelimited(c, _inum, fmt, ...) \ |
294 printk_ratelimited(KERN_ERR bch2_fmt_inum(c, _inum, fmt), ##__VA_ARGS__) | 313 bch2_print_ratelimited(c, KERN_ERR bch2_fmt_inum(c, _inum, fmt), ##__VA_ARGS__) |
295#define bch_err_inum_offset_ratelimited(c, _inum, _offset, fmt, ...) \ | 314#define bch_err_inum_offset_ratelimited(c, _inum, _offset, fmt, ...) \ |
296 printk_ratelimited(KERN_ERR bch2_fmt_inum_offset(c, _inum, _offset, fmt), ##__VA_ARGS__) | 315 bch2_print_ratelimited(c, KERN_ERR bch2_fmt_inum_offset(c, _inum, _offset, fmt), ##__VA_ARGS__) |
297 298#define bch_err_fn(_c, _ret) \ 299do { \ 300 if (_ret && !bch2_err_matches(_ret, BCH_ERR_transaction_restart))\ 301 bch_err(_c, "%s(): error %s", __func__, bch2_err_str(_ret));\ 302} while (0) 303 304#define bch_err_msg(_c, _ret, _msg, ...) \ --- 136 unchanged lines hidden (view full) --- 441 442/* Size of the freelist we allocate btree nodes from: */ 443#define BTREE_NODE_RESERVE (BTREE_RESERVE_MAX * 4) 444 445#define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX) 446 447struct btree; 448 | 316 317#define bch_err_fn(_c, _ret) \ 318do { \ 319 if (_ret && !bch2_err_matches(_ret, BCH_ERR_transaction_restart))\ 320 bch_err(_c, "%s(): error %s", __func__, bch2_err_str(_ret));\ 321} while (0) 322 323#define bch_err_msg(_c, _ret, _msg, ...) \ --- 136 unchanged lines hidden (view full) --- 460 461/* Size of the freelist we allocate btree nodes from: */ 462#define BTREE_NODE_RESERVE (BTREE_RESERVE_MAX * 4) 463 464#define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX) 465 466struct btree; 467 |
468struct log_output { 469 spinlock_t lock; 470 wait_queue_head_t wait; 471 struct printbuf buf; 472}; 473 |
|
449enum gc_phase { 450 GC_PHASE_NOT_RUNNING, 451 GC_PHASE_START, 452 GC_PHASE_SB, 453 454 GC_PHASE_BTREE_stripes, 455 GC_PHASE_BTREE_extents, 456 GC_PHASE_BTREE_inodes, --- 238 unchanged lines hidden (view full) --- 695 struct kobject time_stats; 696 unsigned long flags; 697 698 int minor; 699 struct device *chardev; 700 struct super_block *vfs_sb; 701 dev_t dev; 702 char name[40]; | 474enum gc_phase { 475 GC_PHASE_NOT_RUNNING, 476 GC_PHASE_START, 477 GC_PHASE_SB, 478 479 GC_PHASE_BTREE_stripes, 480 GC_PHASE_BTREE_extents, 481 GC_PHASE_BTREE_inodes, --- 238 unchanged lines hidden (view full) --- 720 struct kobject time_stats; 721 unsigned long flags; 722 723 int minor; 724 struct device *chardev; 725 struct super_block *vfs_sb; 726 dev_t dev; 727 char name[40]; |
728 struct log_output *output; 729 struct task_struct *output_filter; |
|
703 704 /* ro/rw, add/remove/resize devices: */ 705 struct rw_semaphore state_lock; 706 707 /* Counts outstanding writes, for clean transition to read-only */ 708#ifdef BCH_WRITE_REF_DEBUG 709 atomic_long_t writes[BCH_WRITE_REF_NR]; 710#else --- 486 unchanged lines hidden --- | 730 731 /* ro/rw, add/remove/resize devices: */ 732 struct rw_semaphore state_lock; 733 734 /* Counts outstanding writes, for clean transition to read-only */ 735#ifdef BCH_WRITE_REF_DEBUG 736 atomic_long_t writes[BCH_WRITE_REF_NR]; 737#else --- 486 unchanged lines hidden --- |