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 */ 36