]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to fb8a27f6d4 bcachefs: Delete a redundant tracepoint
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 12 Apr 2022 02:40:16 +0000 (22:40 -0400)
committerKent Overstreet <kent.overstreet@gmail.com>
Tue, 12 Apr 2022 02:40:16 +0000 (22:40 -0400)
.bcachefs_revision
include/trace/events/bcachefs.h
libbcachefs/alloc_background.c
libbcachefs/alloc_foreground.c
libbcachefs/fsck.c
libbcachefs/lru.c
libbcachefs/lru.h

index 0c8a11bd971b381c8190c6d914eca21234227ab7..7e508a096ba88976f6ed8bdacb3dbc47d06561fc 100644 (file)
@@ -1 +1 @@
-e67d924a9002e05dbe593a4eee659b107b712f12
+fb8a27f6d45d869450c676e743cff4b03bb713ba
index 2155f1a03be964c8f27ae3ce4de175f782f39ded..1ae5e8885b465992e76bce575b1615c4c3719ece 100644 (file)
@@ -513,7 +513,7 @@ TRACE_EVENT(invalidate,
                  __entry->offset)
 );
 
-DECLARE_EVENT_CLASS(bucket_alloc,
+TRACE_EVENT(bucket_alloc,
        TP_PROTO(struct bch_dev *ca, const char *alloc_reserve),
        TP_ARGS(ca, alloc_reserve),
 
@@ -532,11 +532,6 @@ DECLARE_EVENT_CLASS(bucket_alloc,
                  __entry->reserve)
 );
 
-DEFINE_EVENT(bucket_alloc, bucket_alloc,
-       TP_PROTO(struct bch_dev *ca, const char *alloc_reserve),
-       TP_ARGS(ca, alloc_reserve)
-);
-
 TRACE_EVENT(bucket_alloc_fail,
        TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
                 u64 avail,
@@ -584,11 +579,6 @@ TRACE_EVENT(bucket_alloc_fail,
                  __entry->ret)
 );
 
-DEFINE_EVENT(bucket_alloc, open_bucket_alloc_fail,
-       TP_PROTO(struct bch_dev *ca, const char *alloc_reserve),
-       TP_ARGS(ca, alloc_reserve)
-);
-
 /* Moving IO */
 
 DEFINE_EVENT(bkey, move_extent,
index a44d93b1f263b47662446930fb90382c11af8ef5..7be4829790b621c47a67297a85ede2a400947110 100644 (file)
@@ -545,6 +545,7 @@ int bch2_trans_mark_alloc(struct btree_trans *trans,
 {
        struct bch_fs *c = trans->c;
        struct bch_alloc_v4 old_a, *new_a;
+       u64 old_lru, new_lru;
        int ret = 0;
 
        /*
@@ -586,13 +587,13 @@ int bch2_trans_mark_alloc(struct btree_trans *trans,
            !new_a->io_time[READ])
                new_a->io_time[READ] = max_t(u64, 1, atomic64_read(&c->io_clock[READ].now));
 
-       if ((old_a.data_type == BCH_DATA_cached) !=
-           (new_a->data_type == BCH_DATA_cached)) {
-               u64 old_lru = alloc_lru_idx(old_a);
-               u64 new_lru = alloc_lru_idx(*new_a);
 
+       old_lru = alloc_lru_idx(old_a);
+       new_lru = alloc_lru_idx(*new_a);
+
+       if (old_lru != new_lru) {
                ret = bch2_lru_change(trans, new->k.p.inode, new->k.p.offset,
-                                     old_lru, &new_lru);
+                                     old_lru, &new_lru, old);
                if (ret)
                        return ret;
 
index a789666dd078d69db5f021ece00403c89f86aa0d..c2af3600cf84d69d8cd8df063b97c100f06ed2f2 100644 (file)
@@ -226,8 +226,6 @@ static struct open_bucket *__try_alloc_bucket(struct bch_fs *c, struct bch_dev *
                        c->blocked_allocate_open_bucket = local_clock();
 
                spin_unlock(&c->freelist_lock);
-
-               trace_open_bucket_alloc_fail(ca, bch2_alloc_reserves[reserve]);
                return ERR_PTR(-OPEN_BUCKETS_EMPTY);
        }
 
index d2b155f07fc10a185dde5fbd80ca3cfa02db36a6..5e2d24c47985494f54aa1493e76c8a2fd85a53cd 100644 (file)
@@ -304,7 +304,7 @@ static int __remove_dirent(struct btree_trans *trans, struct bpos pos)
 
        ret = lookup_first_inode(trans, pos.inode, &dir_inode);
        if (ret)
-               return ret;
+               goto err;
 
        dir_hash_info = bch2_hash_info_init(c, &dir_inode);
 
@@ -313,6 +313,9 @@ static int __remove_dirent(struct btree_trans *trans, struct bpos pos)
        ret = bch2_hash_delete_at(trans, bch2_dirent_hash_desc,
                                  &dir_hash_info, &iter, 0);
        bch2_trans_iter_exit(trans, &iter);
+err:
+       if (ret && ret != -EINTR)
+               bch_err(c, "error %i from __remove_dirent()", ret);
        return ret;
 }
 
@@ -799,8 +802,10 @@ static int check_inode(struct btree_trans *trans,
                return ret;
 
        ret = check_key_has_snapshot(trans, iter, k);
+       if (ret < 0)
+               goto err;
        if (ret)
-               return ret < 0 ? ret : 0;
+               return 0;
 
        /*
         * if snapshot id isn't a leaf node, skip it - deletion in
@@ -911,7 +916,10 @@ static int check_inode(struct btree_trans *trans,
                        bch_err(c, "error in fsck: error %i "
                                "updating inode", ret);
        }
+err:
 fsck_err:
+       if (ret)
+               bch_err(c, "error %i from check_inode()", ret);
        return ret;
 }
 
@@ -941,6 +949,8 @@ static int check_inodes(struct bch_fs *c, bool full)
        bch2_trans_iter_exit(&trans, &iter);
 
        bch2_trans_exit(&trans);
+       if (ret)
+               bch_err(c, "error %i from check_inodes()", ret);
        return ret;
 }
 
@@ -1092,7 +1102,7 @@ static int inode_backpointer_exists(struct btree_trans *trans,
                        SPOS(inode->bi_dir, inode->bi_dir_offset, snapshot));
        ret = bkey_err(d.s_c);
        if (ret)
-               return ret;
+               return ret == -ENOENT ? 0 : ret;
 
        ret = dirent_points_to_inode(d, inode);
        bch2_trans_iter_exit(trans, &iter);
@@ -1134,6 +1144,8 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w)
                ret2 = -EINTR;
        }
 fsck_err:
+       if (ret)
+               bch_err(c, "error %i from check_i_sectors()", ret);
        return ret ?: ret2;
 }
 
@@ -1257,6 +1269,9 @@ out:
 err:
 fsck_err:
        printbuf_exit(&buf);
+
+       if (ret && ret != -EINTR)
+               bch_err(c, "error %i from check_extent()", ret);
        return ret;
 }
 
@@ -1305,6 +1320,8 @@ static int check_extents(struct bch_fs *c)
        bch2_trans_exit(&trans);
        snapshots_seen_exit(&s);
 
+       if (ret)
+               bch_err(c, "error %i from check_extents()", ret);
        return ret;
 }
 
@@ -1342,6 +1359,8 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
                }
        }
 fsck_err:
+       if (ret)
+               bch_err(c, "error %i from check_subdir_count()", ret);
        return ret ?: ret2;
 }
 
@@ -1458,6 +1477,9 @@ out:
 err:
 fsck_err:
        printbuf_exit(&buf);
+
+       if (ret && ret != -EINTR)
+               bch_err(c, "error %i from check_target()", ret);
        return ret;
 }
 
@@ -1631,6 +1653,9 @@ out:
 err:
 fsck_err:
        printbuf_exit(&buf);
+
+       if (ret && ret != -EINTR)
+               bch_err(c, "error %i from check_dirent()", ret);
        return ret;
 }
 
@@ -1675,6 +1700,9 @@ static int check_dirents(struct bch_fs *c)
        snapshots_seen_exit(&s);
        inode_walker_exit(&dir);
        inode_walker_exit(&target);
+
+       if (ret)
+               bch_err(c, "error %i from check_dirents()", ret);
        return ret;
 }
 
@@ -1717,6 +1745,8 @@ static int check_xattr(struct btree_trans *trans, struct btree_iter *iter,
 
        ret = hash_check_key(trans, bch2_xattr_hash_desc, hash_info, iter, k);
 fsck_err:
+       if (ret && ret != -EINTR)
+               bch_err(c, "error %i from check_xattr()", ret);
        return ret;
 }
 
@@ -1754,6 +1784,9 @@ static int check_xattrs(struct bch_fs *c)
        bch2_trans_iter_exit(&trans, &iter);
 
        bch2_trans_exit(&trans);
+
+       if (ret)
+               bch_err(c, "error %i from check_xattrs()", ret);
        return ret;
 }
 
index 08437d4a940851e6ae425289cf622481003fc496..fe9d1574294794333ddbb52fa0c83a910f9fe3c0 100644 (file)
@@ -30,12 +30,13 @@ void bch2_lru_to_text(struct printbuf *out, struct bch_fs *c,
        pr_buf(out, "idx %llu", le64_to_cpu(lru->idx));
 }
 
-int bch2_lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
+int bch2_lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time,
+                   struct bkey_s_c orig_k)
 {
-       struct bch_fs *c = trans->c;
        struct btree_iter iter;
        struct bkey_s_c k;
        u64 existing_idx;
+       struct printbuf buf = PRINTBUF;
        int ret = 0;
 
        if (!time)
@@ -51,18 +52,20 @@ int bch2_lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
                goto err;
 
        if (k.k->type != KEY_TYPE_lru) {
-               bch2_fs_inconsistent(c,
-                       "pointer to nonexistent lru %llu:%llu",
-                       id, time);
+               bch2_bkey_val_to_text(&buf, trans->c, orig_k);
+               bch2_trans_inconsistent(trans,
+                       "pointer to nonexistent lru %llu:%llu\n%s",
+                       id, time, buf.buf);
                ret = -EIO;
                goto err;
        }
 
        existing_idx = le64_to_cpu(bkey_s_c_to_lru(k).v->idx);
        if (existing_idx != idx) {
-               bch2_fs_inconsistent(c,
-                       "lru %llu:%llu with wrong backpointer: got %llu, should be %llu",
-                       id, time, existing_idx, idx);
+               bch2_bkey_val_to_text(&buf, trans->c, orig_k);
+               bch2_trans_inconsistent(trans,
+                       "lru %llu:%llu with wrong backpointer: got %llu, should be %llu\n%s",
+                       id, time, existing_idx, idx, buf.buf);
                ret = -EIO;
                goto err;
        }
@@ -70,6 +73,7 @@ int bch2_lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
        ret = bch2_btree_delete_at(trans, &iter, 0);
 err:
        bch2_trans_iter_exit(trans, &iter);
+       printbuf_exit(&buf);
        return ret;
 }
 
@@ -115,12 +119,13 @@ err:
 }
 
 int bch2_lru_change(struct btree_trans *trans, u64 id, u64 idx,
-                   u64 old_time, u64 *new_time)
+                   u64 old_time, u64 *new_time,
+                   struct bkey_s_c k)
 {
        if (old_time == *new_time)
                return 0;
 
-       return  bch2_lru_delete(trans, id, idx, old_time) ?:
+       return  bch2_lru_delete(trans, id, idx, old_time, k) ?:
                bch2_lru_set(trans, id, idx, new_time);
 }
 
index 0a01836c07c1d06e29229d8b052f2d5197a4c456..bfe38a67e5858445e8f3ca8e74db66051ddb7e14 100644 (file)
@@ -10,9 +10,9 @@ void bch2_lru_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
        .val_to_text    = bch2_lru_to_text,     \
 }
 
-int bch2_lru_delete(struct btree_trans *, u64, u64, u64);
+int bch2_lru_delete(struct btree_trans *, u64, u64, u64, struct bkey_s_c);
 int bch2_lru_set(struct btree_trans *, u64, u64, u64 *);
-int bch2_lru_change(struct btree_trans *, u64, u64, u64, u64 *);
+int bch2_lru_change(struct btree_trans *, u64, u64, u64, u64 *, struct bkey_s_c);
 
 int bch2_check_lrus(struct bch_fs *, bool);