]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/alloc_background.c
Update bcachefs sources to fb8a27f6d4 bcachefs: Delete a redundant tracepoint
[bcachefs-tools-debian] / libbcachefs / alloc_background.c
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;