-e67d924a9002e05dbe593a4eee659b107b712f12
+fb8a27f6d45d869450c676e743cff4b03bb713ba
__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),
__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,
__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,
{
struct bch_fs *c = trans->c;
struct bch_alloc_v4 old_a, *new_a;
+ u64 old_lru, new_lru;
int ret = 0;
/*
!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;
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);
}
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);
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;
}
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
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;
}
bch2_trans_iter_exit(&trans, &iter);
bch2_trans_exit(&trans);
+ if (ret)
+ bch_err(c, "error %i from check_inodes()", ret);
return ret;
}
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);
ret2 = -EINTR;
}
fsck_err:
+ if (ret)
+ bch_err(c, "error %i from check_i_sectors()", ret);
return ret ?: ret2;
}
err:
fsck_err:
printbuf_exit(&buf);
+
+ if (ret && ret != -EINTR)
+ bch_err(c, "error %i from check_extent()", ret);
return ret;
}
bch2_trans_exit(&trans);
snapshots_seen_exit(&s);
+ if (ret)
+ bch_err(c, "error %i from check_extents()", ret);
return ret;
}
}
}
fsck_err:
+ if (ret)
+ bch_err(c, "error %i from check_subdir_count()", ret);
return ret ?: ret2;
}
err:
fsck_err:
printbuf_exit(&buf);
+
+ if (ret && ret != -EINTR)
+ bch_err(c, "error %i from check_target()", ret);
return ret;
}
err:
fsck_err:
printbuf_exit(&buf);
+
+ if (ret && ret != -EINTR)
+ bch_err(c, "error %i from check_dirent()", ret);
return ret;
}
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;
}
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;
}
bch2_trans_iter_exit(&trans, &iter);
bch2_trans_exit(&trans);
+
+ if (ret)
+ bch_err(c, "error %i from check_xattrs()", ret);
return ret;
}
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)
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;
}
ret = bch2_btree_delete_at(trans, &iter, 0);
err:
bch2_trans_iter_exit(trans, &iter);
+ printbuf_exit(&buf);
return ret;
}
}
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);
}
.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);