Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BUCKETS_TYPES_H
3#define _BUCKETS_TYPES_H
4
5#include "bcachefs_format.h"
6#include "util.h"
7
8#define BUCKET_JOURNAL_SEQ_BITS 16
9
10struct bucket {
11 u8 lock;
12 u8 gen_valid:1;
13 u8 data_type:7;
14 u8 gen;
15 u8 stripe_redundancy;
16 u32 stripe;
17 u32 dirty_sectors;
18 u32 cached_sectors;
19 u32 stripe_sectors;
20} __aligned(sizeof(long));
21
22struct bucket_array {
23 struct rcu_head rcu;
24 u16 first_bucket;
25 size_t nbuckets;
26 size_t nbuckets_minus_first;
27 struct bucket b[];
28};
29
30struct bucket_gens {
31 struct rcu_head rcu;
32 u16 first_bucket;
33 size_t nbuckets;
34 size_t nbuckets_minus_first;
35 u8 b[];
36};
37
38struct bch_dev_usage {
39 struct bch_dev_usage_type {
40 u64 buckets;
41 u64 sectors; /* _compressed_ sectors: */
42 /*
43 * XXX
44 * Why do we have this? Isn't it just buckets * bucket_size -
45 * sectors?
46 */
47 u64 fragmented;
48 } d[BCH_DATA_NR];
49};
50
51struct bch_fs_usage_base {
52 u64 hidden;
53 u64 btree;
54 u64 data;
55 u64 cached;
56 u64 reserved;
57 u64 nr_inodes;
58};
59
60struct bch_fs_usage_short {
61 u64 capacity;
62 u64 used;
63 u64 free;
64 u64 nr_inodes;
65};
66
67/*
68 * A reservation for space on disk:
69 */
70struct disk_reservation {
71 u64 sectors;
72 u32 gen;
73 unsigned nr_replicas;
74};
75
76#endif /* _BUCKETS_TYPES_H */