return ret;
}
+ if (acc_replicas_key.replicas.nr_devs && !level && k.k->p.snapshot) {
+ struct disk_accounting_pos acc_snapshot_key = {
+ .type = BCH_DISK_ACCOUNTING_snapshot,
+ .snapshot.id = k.k->p.snapshot,
+ };
+ ret = bch2_disk_accounting_mod(trans, &acc_snapshot_key, &replicas_sectors, 1, gc);
+ if (ret)
+ return ret;
+ }
+
if (acct_compression_key.compression.type) {
if (flags & BTREE_TRIGGER_overwrite)
bch2_u64s_neg(compression_acct, ARRAY_SIZE(compression_acct));
case BCH_DISK_ACCOUNTING_compression:
bch2_prt_compression_type(out, k->compression.type);
break;
+ case BCH_DISK_ACCOUNTING_snapshot:
+ prt_printf(out, "id=%u", k->snapshot.id);
+ break;
}
}
x(persistent_reserved, 1) \
x(replicas, 2) \
x(dev_data_type, 3) \
- x(compression, 4)
+ x(compression, 4) \
+ x(snapshot, 5)
enum disk_accounting_type {
#define x(f, nr) BCH_DISK_ACCOUNTING_##f = nr,
__u8 type;
};
+struct bch_acct_snapshot {
+ __u32 id;
+};
+
struct disk_accounting_pos {
union {
struct {
struct bch_dev_data_type dev_data_type;
struct bch_dev_stripe_buckets dev_stripe_buckets;
struct bch_acct_compression compression;
+ struct bch_acct_snapshot snapshot;
};
};
struct bpos _pad;