Skip to content

Commit 8d52ba6

Browse files
author
Kent Overstreet
committed
bcachefs: reflink_format.h
Signed-off-by: Kent Overstreet <[email protected]>
1 parent b2fa1b6 commit 8d52ba6

File tree

3 files changed

+48
-47
lines changed

3 files changed

+48
-47
lines changed

fs/bcachefs/bcachefs_format.h

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,6 @@ struct bch_csum {
423423
__le64 hi;
424424
} __packed __aligned(8);
425425

426-
struct bch_reservation {
427-
struct bch_val v;
428-
429-
__le32 generation;
430-
__u8 nr_replicas;
431-
__u8 pad[3];
432-
} __packed __aligned(8);
433-
434426
struct bch_backpointer {
435427
struct bch_val v;
436428
__u8 btree_id;
@@ -441,45 +433,6 @@ struct bch_backpointer {
441433
struct bpos pos;
442434
} __packed __aligned(8);
443435

444-
#include "extents_format.h"
445-
446-
/* Reflink: */
447-
448-
struct bch_reflink_p {
449-
struct bch_val v;
450-
__le64 idx;
451-
/*
452-
* A reflink pointer might point to an indirect extent which is then
453-
* later split (by copygc or rebalance). If we only pointed to part of
454-
* the original indirect extent, and then one of the fragments is
455-
* outside the range we point to, we'd leak a refcount: so when creating
456-
* reflink pointers, we need to store pad values to remember the full
457-
* range we were taking a reference on.
458-
*/
459-
__le32 front_pad;
460-
__le32 back_pad;
461-
} __packed __aligned(8);
462-
463-
struct bch_reflink_v {
464-
struct bch_val v;
465-
__le64 refcount;
466-
union bch_extent_entry start[0];
467-
__u64 _data[];
468-
} __packed __aligned(8);
469-
470-
struct bch_indirect_inline_data {
471-
struct bch_val v;
472-
__le64 refcount;
473-
u8 data[];
474-
};
475-
476-
/* Inline data */
477-
478-
struct bch_inline_data {
479-
struct bch_val v;
480-
u8 data[];
481-
};
482-
483436
/* LRU btree: */
484437

485438
struct bch_lru {
@@ -542,6 +495,8 @@ struct bch_sb_field {
542495
x(downgrade, 14)
543496

544497
#include "alloc_background_format.h"
498+
#include "extents_format.h"
499+
#include "reflink_format.h"
545500
#include "ec_format.h"
546501
#include "inode_format.h"
547502
#include "dirent_format.h"

fs/bcachefs/extents_format.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,17 @@ struct bch_extent {
279279
#define BKEY_BTREE_PTR_U64s_MAX \
280280
(BKEY_U64s + BKEY_BTREE_PTR_VAL_U64s_MAX)
281281

282+
struct bch_reservation {
283+
struct bch_val v;
284+
285+
__le32 generation;
286+
__u8 nr_replicas;
287+
__u8 pad[3];
288+
} __packed __aligned(8);
289+
290+
struct bch_inline_data {
291+
struct bch_val v;
292+
u8 data[];
293+
};
294+
282295
#endif /* _BCACHEFS_EXTENTS_FORMAT_H */

fs/bcachefs/reflink_format.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _BCACHEFS_REFLINK_FORMAT_H
3+
#define _BCACHEFS_REFLINK_FORMAT_H
4+
5+
struct bch_reflink_p {
6+
struct bch_val v;
7+
__le64 idx;
8+
/*
9+
* A reflink pointer might point to an indirect extent which is then
10+
* later split (by copygc or rebalance). If we only pointed to part of
11+
* the original indirect extent, and then one of the fragments is
12+
* outside the range we point to, we'd leak a refcount: so when creating
13+
* reflink pointers, we need to store pad values to remember the full
14+
* range we were taking a reference on.
15+
*/
16+
__le32 front_pad;
17+
__le32 back_pad;
18+
} __packed __aligned(8);
19+
20+
struct bch_reflink_v {
21+
struct bch_val v;
22+
__le64 refcount;
23+
union bch_extent_entry start[0];
24+
__u64 _data[];
25+
} __packed __aligned(8);
26+
27+
struct bch_indirect_inline_data {
28+
struct bch_val v;
29+
__le64 refcount;
30+
u8 data[];
31+
};
32+
33+
#endif /* _BCACHEFS_REFLINK_FORMAT_H */

0 commit comments

Comments
 (0)