repart: support "nodatacow" in btrfs subvolumes

In btrfs-progs 6.15 it is planned to add a new parameter in mkfs.btrfs
--inode-flags, that can set attributes for subvolumes, directories, and
files.

The current supported attributes are "nodatacow", to disable CoW, and
"nodatasum", to disable the checksum.

This commit extend the "Subvolunes=" option to understand the
"nodatacow" flag for subvolums only.

If RepartOffline is enabled it will build the image without loopback
devices, using the correct --inode-flags parameters.

If RepartOffline is disabled it will use loopback devices and set the
btrfs attributes accordingly.

Signed-off-by: Alberto Planas <aplanas@suse.com>
This commit is contained in:
Alberto Planas
2025-11-02 17:13:31 +09:00
committed by Yu Watanabe
parent eeedea94da
commit ab1f4e506f
7 changed files with 132 additions and 57 deletions
+9
View File
@@ -1,7 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "basic-forward.h"
typedef enum BtrfsSubvolFlags {
BTRFS_SUBVOL_RO = 1 << 0,
BTRFS_SUBVOL_NODATACOW = 1 << 1,
_BTRFS_SUBVOL_FLAGS_MASK = BTRFS_SUBVOL_NODATACOW|BTRFS_SUBVOL_RO,
_BTRFS_SUBVOL_FLAGS_INVALID = -EINVAL,
_BTRFS_SUBVOL_FLAGS_ERRNO_MAX = -ERRNO_MAX, /* Ensure the whole errno range fits into this enum */
} BtrfsSubvolFlags;
int btrfs_validate_subvolume_name(const char *name);
int btrfs_subvol_make(int dir_fd, const char *path);