2017-03-17 06:18:50 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _BUCKETS_TYPES_H
|
|
|
|
#define _BUCKETS_TYPES_H
|
|
|
|
|
2018-07-24 17:33:07 +00:00
|
|
|
#include "bcachefs_format.h"
|
2017-03-17 06:18:50 +00:00
|
|
|
#include "util.h"
|
|
|
|
|
2018-07-22 02:57:20 +00:00
|
|
|
#define BUCKET_JOURNAL_SEQ_BITS 16
|
|
|
|
|
2017-03-17 06:18:50 +00:00
|
|
|
struct bucket {
|
2022-02-14 05:07:38 +00:00
|
|
|
u8 lock;
|
|
|
|
u8 gen_valid:1;
|
|
|
|
u8 data_type:7;
|
|
|
|
u8 gen;
|
|
|
|
u8 stripe_redundancy;
|
|
|
|
u32 stripe;
|
|
|
|
u32 dirty_sectors;
|
|
|
|
u32 cached_sectors;
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bucket_array {
|
|
|
|
struct rcu_head rcu;
|
|
|
|
u16 first_bucket;
|
|
|
|
size_t nbuckets;
|
|
|
|
struct bucket b[];
|
|
|
|
};
|
|
|
|
|
2021-12-26 00:55:34 +00:00
|
|
|
struct bucket_gens {
|
|
|
|
struct rcu_head rcu;
|
|
|
|
u16 first_bucket;
|
|
|
|
size_t nbuckets;
|
|
|
|
u8 b[];
|
|
|
|
};
|
|
|
|
|
2017-03-17 06:18:50 +00:00
|
|
|
struct bch_dev_usage {
|
2021-01-22 01:51:51 +00:00
|
|
|
struct {
|
|
|
|
u64 buckets;
|
|
|
|
u64 sectors; /* _compressed_ sectors: */
|
2021-04-15 00:25:33 +00:00
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* Why do we have this? Isn't it just buckets * bucket_size -
|
|
|
|
* sectors?
|
|
|
|
*/
|
2021-01-22 01:51:51 +00:00
|
|
|
u64 fragmented;
|
|
|
|
} d[BCH_DATA_NR];
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
2023-11-17 05:03:45 +00:00
|
|
|
struct bch_fs_usage_base {
|
2019-02-14 23:38:52 +00:00
|
|
|
u64 hidden;
|
2019-03-30 02:22:45 +00:00
|
|
|
u64 btree;
|
2019-02-14 23:38:52 +00:00
|
|
|
u64 data;
|
|
|
|
u64 cached;
|
|
|
|
u64 reserved;
|
|
|
|
u64 nr_inodes;
|
2023-11-17 05:03:45 +00:00
|
|
|
};
|
2019-01-21 20:32:13 +00:00
|
|
|
|
2023-11-17 05:03:45 +00:00
|
|
|
struct bch_fs_usage {
|
|
|
|
/* all fields are in units of 512 byte sectors: */
|
|
|
|
struct bch_fs_usage_base b;
|
2019-01-21 20:32:13 +00:00
|
|
|
u64 persistent_reserved[BCH_REPLICAS_MAX];
|
2019-02-14 23:38:52 +00:00
|
|
|
u64 replicas[];
|
2018-11-27 13:23:22 +00:00
|
|
|
};
|
|
|
|
|
2019-02-11 00:34:47 +00:00
|
|
|
struct bch_fs_usage_online {
|
|
|
|
u64 online_reserved;
|
|
|
|
struct bch_fs_usage u;
|
|
|
|
};
|
|
|
|
|
2018-11-27 13:23:22 +00:00
|
|
|
struct bch_fs_usage_short {
|
|
|
|
u64 capacity;
|
|
|
|
u64 used;
|
2019-02-14 23:38:52 +00:00
|
|
|
u64 free;
|
2018-11-27 13:23:22 +00:00
|
|
|
u64 nr_inodes;
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A reservation for space on disk:
|
|
|
|
*/
|
|
|
|
struct disk_reservation {
|
2018-11-27 13:23:22 +00:00
|
|
|
u64 sectors;
|
|
|
|
u32 gen;
|
|
|
|
unsigned nr_replicas;
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _BUCKETS_TYPES_H */
|