subvolume.c (d94189ad568f6cbd80d372cf7aa6e4898b6c5c17) subvolume.c (facafdcbc157686311dbe58649ef9d29fcf8e610)
1// SPDX-License-Identifier: GPL-2.0
2
3#include "bcachefs.h"
4#include "btree_key_cache.h"
5#include "btree_update.h"
6#include "errcode.h"
7#include "error.h"
8#include "fs.h"

--- 11 unchanged lines hidden (view full) ---

20 BCH_SNAPSHOT_DELETED(s.v),
21 le32_to_cpu(s.v->parent),
22 le32_to_cpu(s.v->children[0]),
23 le32_to_cpu(s.v->children[1]),
24 le32_to_cpu(s.v->subvol));
25}
26
27int bch2_snapshot_invalid(const struct bch_fs *c, struct bkey_s_c k,
1// SPDX-License-Identifier: GPL-2.0
2
3#include "bcachefs.h"
4#include "btree_key_cache.h"
5#include "btree_update.h"
6#include "errcode.h"
7#include "error.h"
8#include "fs.h"

--- 11 unchanged lines hidden (view full) ---

20 BCH_SNAPSHOT_DELETED(s.v),
21 le32_to_cpu(s.v->parent),
22 le32_to_cpu(s.v->children[0]),
23 le32_to_cpu(s.v->children[1]),
24 le32_to_cpu(s.v->subvol));
25}
26
27int bch2_snapshot_invalid(const struct bch_fs *c, struct bkey_s_c k,
28 int rw, struct printbuf *err)
28 unsigned flags, struct printbuf *err)
29{
30 struct bkey_s_c_snapshot s;
31 u32 i, id;
32
33 if (bkey_gt(k.k->p, POS(0, U32_MAX)) ||
34 bkey_lt(k.k->p, POS(0, 1))) {
35 prt_printf(err, "bad pos");
36 return -BCH_ERR_invalid_bkey;

--- 691 unchanged lines hidden (view full) ---

728
729 bch2_delete_dead_snapshots_async(c);
730 return 0;
731}
732
733/* Subvolumes: */
734
735int bch2_subvolume_invalid(const struct bch_fs *c, struct bkey_s_c k,
29{
30 struct bkey_s_c_snapshot s;
31 u32 i, id;
32
33 if (bkey_gt(k.k->p, POS(0, U32_MAX)) ||
34 bkey_lt(k.k->p, POS(0, 1))) {
35 prt_printf(err, "bad pos");
36 return -BCH_ERR_invalid_bkey;

--- 691 unchanged lines hidden (view full) ---

728
729 bch2_delete_dead_snapshots_async(c);
730 return 0;
731}
732
733/* Subvolumes: */
734
735int bch2_subvolume_invalid(const struct bch_fs *c, struct bkey_s_c k,
736 int rw, struct printbuf *err)
736 unsigned flags, struct printbuf *err)
737{
738 if (bkey_lt(k.k->p, SUBVOL_POS_MIN) ||
739 bkey_gt(k.k->p, SUBVOL_POS_MAX)) {
740 prt_printf(err, "invalid pos");
741 return -BCH_ERR_invalid_bkey;
742 }
743
744 if (bkey_val_bytes(k.k) != sizeof(struct bch_subvolume)) {

--- 320 unchanged lines hidden ---
737{
738 if (bkey_lt(k.k->p, SUBVOL_POS_MIN) ||
739 bkey_gt(k.k->p, SUBVOL_POS_MAX)) {
740 prt_printf(err, "invalid pos");
741 return -BCH_ERR_invalid_bkey;
742 }
743
744 if (bkey_val_bytes(k.k) != sizeof(struct bch_subvolume)) {

--- 320 unchanged lines hidden ---