Skip to content

Commit c6c4ff6

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

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

fs/bcachefs/bcachefs_format.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -773,38 +773,6 @@ struct bch_inline_data {
773773
u8 data[];
774774
};
775775

776-
/* Subvolumes: */
777-
778-
#define SUBVOL_POS_MIN POS(0, 1)
779-
#define SUBVOL_POS_MAX POS(0, S32_MAX)
780-
#define BCACHEFS_ROOT_SUBVOL 1
781-
782-
struct bch_subvolume {
783-
struct bch_val v;
784-
__le32 flags;
785-
__le32 snapshot;
786-
__le64 inode;
787-
/*
788-
* Snapshot subvolumes form a tree, separate from the snapshot nodes
789-
* tree - if this subvolume is a snapshot, this is the ID of the
790-
* subvolume it was created from:
791-
*
792-
* This is _not_ necessarily the subvolume of the directory containing
793-
* this subvolume:
794-
*/
795-
__le32 parent;
796-
__le32 pad;
797-
bch_le128 otime;
798-
};
799-
800-
LE32_BITMASK(BCH_SUBVOLUME_RO, struct bch_subvolume, flags, 0, 1)
801-
/*
802-
* We need to know whether a subvolume is a snapshot so we can know whether we
803-
* can delete it (or whether it should just be rm -rf'd)
804-
*/
805-
LE32_BITMASK(BCH_SUBVOLUME_SNAP, struct bch_subvolume, flags, 1, 2)
806-
LE32_BITMASK(BCH_SUBVOLUME_UNLINKED, struct bch_subvolume, flags, 2, 3)
807-
808776
/* LRU btree: */
809777

810778
struct bch_lru {
@@ -872,6 +840,7 @@ struct bch_sb_field {
872840
#include "xattr_format.h"
873841
#include "quota_format.h"
874842
#include "snapshot_format.h"
843+
#include "subvolume_format.h"
875844
#include "sb-counters_format.h"
876845

877846
enum bch_sb_field_type {

fs/bcachefs/subvolume_format.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _BCACHEFS_SUBVOLUME_FORMAT_H
3+
#define _BCACHEFS_SUBVOLUME_FORMAT_H
4+
5+
#define SUBVOL_POS_MIN POS(0, 1)
6+
#define SUBVOL_POS_MAX POS(0, S32_MAX)
7+
#define BCACHEFS_ROOT_SUBVOL 1
8+
9+
struct bch_subvolume {
10+
struct bch_val v;
11+
__le32 flags;
12+
__le32 snapshot;
13+
__le64 inode;
14+
/*
15+
* Snapshot subvolumes form a tree, separate from the snapshot nodes
16+
* tree - if this subvolume is a snapshot, this is the ID of the
17+
* subvolume it was created from:
18+
*
19+
* This is _not_ necessarily the subvolume of the directory containing
20+
* this subvolume:
21+
*/
22+
__le32 parent;
23+
__le32 pad;
24+
bch_le128 otime;
25+
};
26+
27+
LE32_BITMASK(BCH_SUBVOLUME_RO, struct bch_subvolume, flags, 0, 1)
28+
/*
29+
* We need to know whether a subvolume is a snapshot so we can know whether we
30+
* can delete it (or whether it should just be rm -rf'd)
31+
*/
32+
LE32_BITMASK(BCH_SUBVOLUME_SNAP, struct bch_subvolume, flags, 1, 2)
33+
LE32_BITMASK(BCH_SUBVOLUME_UNLINKED, struct bch_subvolume, flags, 2, 3)
34+
35+
#endif /* _BCACHEFS_SUBVOLUME_FORMAT_H */

0 commit comments

Comments
 (0)