3 #include <linux/types.h>
6 #include "tools-util.h"
8 /* stub out the bcache code we aren't building: */
11 struct bcache_superblock;
13 struct cache_accounting;
19 struct kmem_cache *bch_search_cache;
21 const char *bch_backing_dev_register(struct bcache_superblock *sb)
23 return "not implemented";
25 void bch_blockdevs_stop(struct cache_set *c) {}
26 int bch_blockdev_volumes_start(struct cache_set *c) { return 0; }
27 void bch_attach_backing_devs(struct cache_set *c) {}
28 bool bch_is_open_backing_dev(struct block_device *bdev) { return false; }
29 void bch_blockdev_exit(void) {}
30 int bch_blockdev_init(void) { return 0; }
32 void bch_fs_exit(void) {}
33 int bch_fs_init(void) { return 0; }
35 const struct file_operations bch_chardev_fops;
37 void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned inode,
38 u64 offset, int nr_sectors) {}
39 void bch_writeback_recalc_oldest_gens(struct cache_set *c) {}
41 void bch_notify_cache_set_read_write(struct cache_set *c) {}
42 void bch_notify_cache_set_read_only(struct cache_set *c) {}
43 void bch_notify_cache_set_stopped(struct cache_set *c) {}
44 void bch_notify_cache_read_write(struct cache *c) {}
45 void bch_notify_cache_read_only(struct cache *c) {}
46 void bch_notify_cache_added(struct cache *c) {}
47 void bch_notify_cache_removing(struct cache *c) {}
48 void bch_notify_cache_removed(struct cache *c) {}
49 void bch_notify_cache_remove_failed(struct cache *c) {}
50 void bch_notify_cache_error(struct cache *c, bool b) {}
52 int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
53 struct kobject *parent) { return 0; }
54 void bch_cache_accounting_destroy(struct cache_accounting *acc) {}
55 void bch_cache_accounting_init(struct cache_accounting *acc,
56 struct closure *parent) {}
58 #define bch_fmt(_c, fmt) fmt "\n"
60 enum fsck_err_opts fsck_err_opt;
62 /* Returns true if error should be fixed: */
64 /* XXX: flag if we ignore errors */
67 * If it's an error that we can't ignore, and we're running non
68 * interactively - return true and have the error fixed so that we don't have to
69 * bail out and stop the fsck early, so that the user can see all the errors
72 #define __fsck_err(c, _can_fix, _can_ignore, _nofix_msg, msg, ...) \
77 switch (fsck_err_opt) { \
79 printf(msg ": fix?", ##__VA_ARGS__); \
84 bch_err(c, msg ", fixing", ##__VA_ARGS__); \
88 bch_err(c, msg, ##__VA_ARGS__); \
92 } else if (_can_ignore) { \
93 bch_err(c, msg, ##__VA_ARGS__); \
96 if (_can_fix && !_can_ignore && fsck_err_opt == FSCK_ERR_NO) \
99 if (!_fix && !_can_ignore) { \
100 printf("Fatal filesystem inconsistency, halting\n"); \
101 ret = BCH_FSCK_ERRORS_NOT_FIXED; \
111 #include "bkey_methods.c"
112 //#include "blockdev.c"
114 #include "btree_cache.c"
115 #include "btree_gc.c"
116 #include "btree_io.c"
117 #include "btree_iter.c"
118 #include "btree_update.c"
120 //#include "chardev.c"
121 #include "checksum.c"
124 #include "compress.c"
139 #include "movinggc.c"
140 //#include "notify.c"
142 //#include "request.c"
147 #include "super-io.c"
152 //#include "writeback.c"
155 #define SHIM_KTYPE(type) \
156 struct kobj_type type ## _ktype = { .release = type ## _release, }
158 static void bch_cache_set_internal_release(struct kobject *k) {}
160 static void bch_cache_set_opts_dir_release(struct kobject *k) {}
162 static void bch_cache_set_time_stats_release(struct kobject *k) {}
164 SHIM_KTYPE(bch_cache);
165 SHIM_KTYPE(bch_cache_set);
166 SHIM_KTYPE(bch_cache_set_internal);
167 SHIM_KTYPE(bch_cache_set_time_stats);
168 SHIM_KTYPE(bch_cache_set_opts_dir);