2019-07-10 23:12:15 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2017-10-06 01:41:44 +03:00
|
|
|
#ifndef _BCACHEFS_SUPER_H
|
|
|
|
#define _BCACHEFS_SUPER_H
|
2017-03-20 02:56:34 +03:00
|
|
|
|
|
|
|
#include "extents.h"
|
|
|
|
|
|
|
|
#include "bcachefs_ioctl.h"
|
|
|
|
|
2017-10-06 01:41:44 +03:00
|
|
|
#include <linux/math64.h>
|
|
|
|
|
2023-11-27 06:33:04 +03:00
|
|
|
extern const char * const bch2_fs_flag_strs[];
|
|
|
|
|
2021-04-30 23:48:21 +03:00
|
|
|
struct bch_fs *bch2_dev_to_fs(dev_t);
|
2023-06-24 19:50:52 +03:00
|
|
|
struct bch_fs *bch2_uuid_to_fs(__uuid_t);
|
2017-03-20 02:56:34 +03:00
|
|
|
|
|
|
|
bool bch2_dev_state_allowed(struct bch_fs *, struct bch_dev *,
|
|
|
|
enum bch_member_state, int);
|
|
|
|
int __bch2_dev_set_state(struct bch_fs *, struct bch_dev *,
|
|
|
|
enum bch_member_state, int);
|
|
|
|
int bch2_dev_set_state(struct bch_fs *, struct bch_dev *,
|
|
|
|
enum bch_member_state, int);
|
|
|
|
|
|
|
|
int bch2_dev_fail(struct bch_dev *, int);
|
|
|
|
int bch2_dev_remove(struct bch_fs *, struct bch_dev *, int);
|
|
|
|
int bch2_dev_add(struct bch_fs *, const char *);
|
|
|
|
int bch2_dev_online(struct bch_fs *, const char *);
|
|
|
|
int bch2_dev_offline(struct bch_fs *, struct bch_dev *, int);
|
2017-12-28 04:32:40 +03:00
|
|
|
int bch2_dev_resize(struct bch_fs *, struct bch_dev *, u64);
|
2018-02-19 05:43:46 +03:00
|
|
|
struct bch_dev *bch2_dev_lookup(struct bch_fs *, const char *);
|
2017-03-20 02:56:34 +03:00
|
|
|
|
|
|
|
bool bch2_fs_emergency_read_only(struct bch_fs *);
|
|
|
|
void bch2_fs_read_only(struct bch_fs *);
|
2019-03-25 04:06:58 +03:00
|
|
|
|
|
|
|
int bch2_fs_read_write(struct bch_fs *);
|
|
|
|
int bch2_fs_read_write_early(struct bch_fs *);
|
2017-03-20 02:56:34 +03:00
|
|
|
|
2020-08-24 23:05:04 +03:00
|
|
|
/*
|
|
|
|
* Only for use in the recovery/fsck path:
|
|
|
|
*/
|
|
|
|
static inline void bch2_fs_lazy_rw(struct bch_fs *c)
|
|
|
|
{
|
2023-11-27 06:33:04 +03:00
|
|
|
if (!test_bit(BCH_FS_rw, &c->flags) &&
|
|
|
|
!test_bit(BCH_FS_was_rw, &c->flags))
|
2020-08-24 23:05:04 +03:00
|
|
|
bch2_fs_read_write_early(c);
|
|
|
|
}
|
|
|
|
|
2020-10-16 05:53:27 +03:00
|
|
|
void __bch2_fs_stop(struct bch_fs *);
|
|
|
|
void bch2_fs_free(struct bch_fs *);
|
2017-03-20 02:56:34 +03:00
|
|
|
void bch2_fs_stop(struct bch_fs *);
|
|
|
|
|
2019-04-18 00:01:40 +03:00
|
|
|
int bch2_fs_start(struct bch_fs *);
|
2018-01-11 14:41:59 +03:00
|
|
|
struct bch_fs *bch2_fs_open(char * const *, unsigned, struct bch_opts);
|
2017-03-20 02:56:34 +03:00
|
|
|
|
2017-10-06 01:41:44 +03:00
|
|
|
#endif /* _BCACHEFS_SUPER_H */
|