2021-09-27 01:19:46 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _BCACHEFS_SUBVOLUME_H
|
|
|
|
#define _BCACHEFS_SUBVOLUME_H
|
|
|
|
|
2021-10-28 23:27:01 +03:00
|
|
|
#include "subvolume_types.h"
|
|
|
|
|
2023-07-07 11:24:54 +03:00
|
|
|
enum bkey_invalid_flags;
|
|
|
|
|
2023-07-09 22:16:50 +03:00
|
|
|
int bch2_check_subvols(struct bch_fs *);
|
2024-02-10 05:30:46 +03:00
|
|
|
int bch2_check_subvol_children(struct bch_fs *);
|
2022-07-16 00:24:21 +03:00
|
|
|
|
2023-10-27 23:43:11 +03:00
|
|
|
int bch2_subvolume_invalid(struct bch_fs *, struct bkey_s_c,
|
2023-09-24 01:42:30 +03:00
|
|
|
enum bkey_invalid_flags, struct printbuf *);
|
2021-09-27 01:19:46 +03:00
|
|
|
void bch2_subvolume_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
|
2024-02-10 05:30:46 +03:00
|
|
|
int bch2_subvolume_trigger(struct btree_trans *, enum btree_id, unsigned,
|
|
|
|
struct bkey_s_c, struct bkey_s, unsigned);
|
2021-09-27 01:19:46 +03:00
|
|
|
|
2022-10-24 00:39:22 +03:00
|
|
|
#define bch2_bkey_ops_subvolume ((struct bkey_ops) { \
|
2021-09-27 01:19:46 +03:00
|
|
|
.key_invalid = bch2_subvolume_invalid, \
|
|
|
|
.val_to_text = bch2_subvolume_to_text, \
|
2024-02-10 05:30:46 +03:00
|
|
|
.trigger = bch2_subvolume_trigger, \
|
2023-04-26 23:34:57 +03:00
|
|
|
.min_val_size = 16, \
|
2022-10-24 00:39:22 +03:00
|
|
|
})
|
2021-09-27 01:19:46 +03:00
|
|
|
|
2024-02-10 05:30:46 +03:00
|
|
|
int bch2_subvol_has_children(struct btree_trans *, u32);
|
2021-10-13 18:00:02 +03:00
|
|
|
int bch2_subvolume_get(struct btree_trans *, unsigned,
|
|
|
|
bool, int, struct bch_subvolume *);
|
2021-09-27 01:19:46 +03:00
|
|
|
int bch2_subvolume_get_snapshot(struct btree_trans *, u32, u32 *);
|
|
|
|
|
2023-12-31 06:54:04 +03:00
|
|
|
int bch2_subvol_is_ro_trans(struct btree_trans *, u32);
|
|
|
|
int bch2_subvol_is_ro(struct bch_fs *, u32);
|
|
|
|
|
2022-07-16 00:24:21 +03:00
|
|
|
int bch2_delete_dead_snapshots(struct bch_fs *);
|
|
|
|
void bch2_delete_dead_snapshots_async(struct bch_fs *);
|
|
|
|
|
2021-10-28 23:27:01 +03:00
|
|
|
int bch2_subvolume_unlink(struct btree_trans *, u32);
|
2024-02-10 05:30:46 +03:00
|
|
|
int bch2_subvolume_create(struct btree_trans *, u64, u32, u32, u32 *, u32 *, bool);
|
2021-09-27 01:19:46 +03:00
|
|
|
|
|
|
|
int bch2_fs_subvolumes_init(struct bch_fs *);
|
|
|
|
|
|
|
|
#endif /* _BCACHEFS_SUBVOLUME_H */
|