summaryrefslogtreecommitdiff
path: root/libbcachefs/subvolume.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-30 22:54:04 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-03 20:31:37 -0500
commit1f79cf3825e94fcb146d417b6dda9b94c93c7a53 (patch)
tree152d89dcb9217e1dbe18594d038a077e0d6f822c /libbcachefs/subvolume.c
parent3054e5debba5ccf842346bd202921f08e43d1e84 (diff)
Update bcachefs sources to 2a6125decb43 bcachefs: bch_sb_field_downgrade
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/subvolume.c')
-rw-r--r--libbcachefs/subvolume.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libbcachefs/subvolume.c b/libbcachefs/subvolume.c
index 9e7164c2..7c67c28d 100644
--- a/libbcachefs/subvolume.c
+++ b/libbcachefs/subvolume.c
@@ -138,6 +138,24 @@ int bch2_subvolume_get(struct btree_trans *trans, unsigned subvol,
return bch2_subvolume_get_inlined(trans, subvol, inconsistent_if_not_found, iter_flags, s);
}
+int bch2_subvol_is_ro_trans(struct btree_trans *trans, u32 subvol)
+{
+ struct bch_subvolume s;
+ int ret = bch2_subvolume_get_inlined(trans, subvol, true, 0, &s);
+ if (ret)
+ return ret;
+
+ if (BCH_SUBVOLUME_RO(&s))
+ return -EROFS;
+ return 0;
+}
+
+int bch2_subvol_is_ro(struct bch_fs *c, u32 subvol)
+{
+ return bch2_trans_do(c, NULL, NULL, 0,
+ bch2_subvol_is_ro_trans(trans, subvol));
+}
+
int bch2_snapshot_get_subvol(struct btree_trans *trans, u32 snapshot,
struct bch_subvolume *subvol)
{