]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/buckets.c
Update bcachefs sources to 070ec8d07b bcachefs: Snapshot depth, skiplist fields
[bcachefs-tools-debian] / libbcachefs / buckets.c
index fbe0cd0a7de365c4b00ab95446a0f070d3324b77..797ef5eceb3f840e64d2f763f6aa2e6a44e19af9 100644 (file)
@@ -374,7 +374,7 @@ static inline int update_replicas(struct bch_fs *c, struct bkey_s_c k,
                        struct bch_replicas_entry *r, s64 sectors,
                        unsigned journal_seq, bool gc)
 {
-       struct bch_fs_usage __percpu *fs_usage;
+       struct bch_fs_usage *fs_usage;
        int idx, ret = 0;
        struct printbuf buf = PRINTBUF;
 
@@ -1143,7 +1143,7 @@ int bch2_mark_inode(struct btree_trans *trans,
                    unsigned flags)
 {
        struct bch_fs *c = trans->c;
-       struct bch_fs_usage __percpu *fs_usage;
+       struct bch_fs_usage *fs_usage;
        u64 journal_seq = trans->journal_res.seq;
 
        if (flags & BTREE_TRIGGER_INSERT) {
@@ -1176,7 +1176,7 @@ int bch2_mark_reservation(struct btree_trans *trans,
 {
        struct bch_fs *c = trans->c;
        struct bkey_s_c k = flags & BTREE_TRIGGER_OVERWRITE ? old : new;
-       struct bch_fs_usage __percpu *fs_usage;
+       struct bch_fs_usage *fs_usage;
        unsigned replicas = bkey_s_c_to_reservation(k).v->nr_replicas;
        s64 sectors = (s64) k.k->size;
 
@@ -1441,20 +1441,20 @@ static inline int bch2_trans_mark_pointer(struct btree_trans *trans,
 
        ret = __mark_pointer(trans, k, &p.ptr, sectors, bp.data_type,
                             a->v.gen, &a->v.data_type,
-                            &a->v.dirty_sectors, &a->v.cached_sectors);
+                            &a->v.dirty_sectors, &a->v.cached_sectors) ?:
+               bch2_trans_update(trans, &iter, &a->k_i, 0);
+       bch2_trans_iter_exit(trans, &iter);
+
        if (ret)
-               goto err;
+               return ret;
 
        if (!p.ptr.cached) {
                ret = bch2_bucket_backpointer_mod(trans, bucket, bp, k, insert);
                if (ret)
-                       goto err;
+                       return ret;
        }
 
-       ret = bch2_trans_update(trans, &iter, &a->k_i, 0);
-err:
-       bch2_trans_iter_exit(trans, &iter);
-       return ret;
+       return 0;
 }
 
 static int bch2_trans_mark_stripe_ptr(struct btree_trans *trans,
@@ -1988,7 +1988,10 @@ static int __bch2_trans_mark_dev_sb(struct btree_trans *trans,
 
 int bch2_trans_mark_dev_sb(struct bch_fs *c, struct bch_dev *ca)
 {
-       return bch2_trans_run(c, __bch2_trans_mark_dev_sb(&trans, ca));
+       int ret = bch2_trans_run(c, __bch2_trans_mark_dev_sb(&trans, ca));
+       if (ret)
+               bch_err_fn(c, ret);
+       return ret;
 }
 
 /* Disk reservations: */