Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d455179f
Commit
d455179f
authored
Jan 21, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: alloc_background_format.h
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
72e08010
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
93 deletions
+94
-93
fs/bcachefs/alloc_background_format.h
fs/bcachefs/alloc_background_format.h
+92
-0
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_format.h
+2
-93
No files found.
fs/bcachefs/alloc_background_format.h
0 → 100644
View file @
d455179f
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H
#define _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H
struct
bch_alloc
{
struct
bch_val
v
;
__u8
fields
;
__u8
gen
;
__u8
data
[];
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_FIELDS_V1() \
x(read_time, 16) \
x(write_time, 16) \
x(data_type, 8) \
x(dirty_sectors, 16) \
x(cached_sectors, 16) \
x(oldest_gen, 8) \
x(stripe, 32) \
x(stripe_redundancy, 8)
enum
{
#define x(name, _bits) BCH_ALLOC_FIELD_V1_##name,
BCH_ALLOC_FIELDS_V1
()
#undef x
};
struct
bch_alloc_v2
{
struct
bch_val
v
;
__u8
nr_fields
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
data
[];
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_FIELDS_V2() \
x(read_time, 64) \
x(write_time, 64) \
x(dirty_sectors, 32) \
x(cached_sectors, 32) \
x(stripe, 32) \
x(stripe_redundancy, 8)
struct
bch_alloc_v3
{
struct
bch_val
v
;
__le64
journal_seq
;
__le32
flags
;
__u8
nr_fields
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
data
[];
}
__packed
__aligned
(
8
);
LE32_BITMASK
(
BCH_ALLOC_V3_NEED_DISCARD
,
struct
bch_alloc_v3
,
flags
,
0
,
1
)
LE32_BITMASK
(
BCH_ALLOC_V3_NEED_INC_GEN
,
struct
bch_alloc_v3
,
flags
,
1
,
2
)
struct
bch_alloc_v4
{
struct
bch_val
v
;
__u64
journal_seq
;
__u32
flags
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
stripe_redundancy
;
__u32
dirty_sectors
;
__u32
cached_sectors
;
__u64
io_time
[
2
];
__u32
stripe
;
__u32
nr_external_backpointers
;
__u64
fragmentation_lru
;
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_V4_U64s_V0 6
#define BCH_ALLOC_V4_U64s (sizeof(struct bch_alloc_v4) / sizeof(__u64))
BITMASK
(
BCH_ALLOC_V4_NEED_DISCARD
,
struct
bch_alloc_v4
,
flags
,
0
,
1
)
BITMASK
(
BCH_ALLOC_V4_NEED_INC_GEN
,
struct
bch_alloc_v4
,
flags
,
1
,
2
)
BITMASK
(
BCH_ALLOC_V4_BACKPOINTERS_START
,
struct
bch_alloc_v4
,
flags
,
2
,
8
)
BITMASK
(
BCH_ALLOC_V4_NR_BACKPOINTERS
,
struct
bch_alloc_v4
,
flags
,
8
,
14
)
#define KEY_TYPE_BUCKET_GENS_BITS 8
#define KEY_TYPE_BUCKET_GENS_NR (1U << KEY_TYPE_BUCKET_GENS_BITS)
#define KEY_TYPE_BUCKET_GENS_MASK (KEY_TYPE_BUCKET_GENS_NR - 1)
struct
bch_bucket_gens
{
struct
bch_val
v
;
u8
gens
[
KEY_TYPE_BUCKET_GENS_NR
];
}
__packed
__aligned
(
8
);
#endif
/* _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H */
fs/bcachefs/bcachefs_format.h
View file @
d455179f
...
...
@@ -710,89 +710,6 @@ struct bch_reservation {
#define BKEY_BTREE_PTR_U64s_MAX \
(BKEY_U64s + BKEY_BTREE_PTR_VAL_U64s_MAX)
/* Bucket/allocation information: */
struct
bch_alloc
{
struct
bch_val
v
;
__u8
fields
;
__u8
gen
;
__u8
data
[];
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_FIELDS_V1() \
x(read_time, 16) \
x(write_time, 16) \
x(data_type, 8) \
x(dirty_sectors, 16) \
x(cached_sectors, 16) \
x(oldest_gen, 8) \
x(stripe, 32) \
x(stripe_redundancy, 8)
enum
{
#define x(name, _bits) BCH_ALLOC_FIELD_V1_##name,
BCH_ALLOC_FIELDS_V1
()
#undef x
};
struct
bch_alloc_v2
{
struct
bch_val
v
;
__u8
nr_fields
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
data
[];
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_FIELDS_V2() \
x(read_time, 64) \
x(write_time, 64) \
x(dirty_sectors, 32) \
x(cached_sectors, 32) \
x(stripe, 32) \
x(stripe_redundancy, 8)
struct
bch_alloc_v3
{
struct
bch_val
v
;
__le64
journal_seq
;
__le32
flags
;
__u8
nr_fields
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
data
[];
}
__packed
__aligned
(
8
);
LE32_BITMASK
(
BCH_ALLOC_V3_NEED_DISCARD
,
struct
bch_alloc_v3
,
flags
,
0
,
1
)
LE32_BITMASK
(
BCH_ALLOC_V3_NEED_INC_GEN
,
struct
bch_alloc_v3
,
flags
,
1
,
2
)
struct
bch_alloc_v4
{
struct
bch_val
v
;
__u64
journal_seq
;
__u32
flags
;
__u8
gen
;
__u8
oldest_gen
;
__u8
data_type
;
__u8
stripe_redundancy
;
__u32
dirty_sectors
;
__u32
cached_sectors
;
__u64
io_time
[
2
];
__u32
stripe
;
__u32
nr_external_backpointers
;
__u64
fragmentation_lru
;
}
__packed
__aligned
(
8
);
#define BCH_ALLOC_V4_U64s_V0 6
#define BCH_ALLOC_V4_U64s (sizeof(struct bch_alloc_v4) / sizeof(__u64))
BITMASK
(
BCH_ALLOC_V4_NEED_DISCARD
,
struct
bch_alloc_v4
,
flags
,
0
,
1
)
BITMASK
(
BCH_ALLOC_V4_NEED_INC_GEN
,
struct
bch_alloc_v4
,
flags
,
1
,
2
)
BITMASK
(
BCH_ALLOC_V4_BACKPOINTERS_START
,
struct
bch_alloc_v4
,
flags
,
2
,
8
)
BITMASK
(
BCH_ALLOC_V4_NR_BACKPOINTERS
,
struct
bch_alloc_v4
,
flags
,
8
,
14
)
#define BCH_ALLOC_V4_NR_BACKPOINTERS_MAX 40
struct
bch_backpointer
{
struct
bch_val
v
;
__u8
btree_id
;
...
...
@@ -803,15 +720,6 @@ struct bch_backpointer {
struct
bpos
pos
;
}
__packed
__aligned
(
8
);
#define KEY_TYPE_BUCKET_GENS_BITS 8
#define KEY_TYPE_BUCKET_GENS_NR (1U << KEY_TYPE_BUCKET_GENS_BITS)
#define KEY_TYPE_BUCKET_GENS_MASK (KEY_TYPE_BUCKET_GENS_NR - 1)
struct
bch_bucket_gens
{
struct
bch_val
v
;
u8
gens
[
KEY_TYPE_BUCKET_GENS_NR
];
}
__packed
__aligned
(
8
);
/* Erasure coding */
struct
bch_stripe
{
...
...
@@ -991,8 +899,9 @@ struct bch_sb_field {
x(ext, 13) \
x(downgrade, 14)
#include "
dirent
_format.h"
#include "
alloc_background
_format.h"
#include "inode_format.h"
#include "dirent_format.h"
#include "xattr_format.h"
#include "quota_format.h"
#include "sb-counters_format.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment