Commit 51e23c9d authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: async objs now support bch_write_ops

parent 8c3fc7cc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "btree_io.h"
#include "debug.h"
#include "io_read.h"
#include "io_write.h"

#include <linux/debugfs.h>

@@ -22,6 +23,11 @@ static void rbio_obj_to_text(struct printbuf *out, void *obj)
	bch2_read_bio_to_text(out, obj);
}

static void write_op_obj_to_text(struct printbuf *out, void *obj)
{
	bch2_write_op_to_text(out, obj);
}

static void btree_read_bio_obj_to_text(struct printbuf *out, void *obj)
{
	struct btree_read_bio *rbio = obj;
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#define BCH_ASYNC_OBJ_LISTS()						\
	x(promote)							\
	x(rbio)								\
	x(write_op)							\
	x(btree_read_bio)						\
	x(btree_write_bio)

+6 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

#include "bcachefs.h"
#include "alloc_foreground.h"
#include "async_objs.h"
#include "bkey_buf.h"
#include "bset.h"
#include "btree_update.h"
@@ -547,6 +548,7 @@ static void bch2_write_done(struct closure *cl)

	EBUG_ON(cl->parent);
	closure_debug_destroy(cl);
	async_object_list_del(c, write_op, op->list_idx);
	if (op->end_io)
		op->end_io(op);
}
@@ -1673,6 +1675,8 @@ CLOSURE_CALLBACK(bch2_write)
	BUG_ON(!op->write_point.v);
	BUG_ON(bkey_eq(op->pos, POS_MAX));

	async_object_list_add(c, write_op, op, &op->list_idx);

	if (op->flags & BCH_WRITE_only_specified_devs)
		op->flags |= BCH_WRITE_alloc_nowait;

@@ -1717,6 +1721,7 @@ CLOSURE_CALLBACK(bch2_write)
	bch2_disk_reservation_put(c, &op->res);

	closure_debug_destroy(&op->cl);
	async_object_list_del(c, write_op, op->list_idx);
	if (op->end_io)
		op->end_io(op);
}
@@ -1750,6 +1755,7 @@ void bch2_write_op_to_text(struct printbuf *out, struct bch_write_op *op)
	prt_printf(out, "nr_replicas_required:\t%u\n", op->nr_replicas_required);

	prt_printf(out, "ref:\t%u\n", closure_nr_remaining(&op->cl));
	prt_printf(out, "ret\t%s\n", bch2_err_str(op->error));

	printbuf_indent_sub(out, 2);
}
+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ struct bch_write_op {
	void			(*end_io)(struct bch_write_op *);
	u64			start_time;

#ifdef CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS
	unsigned		list_idx;
#endif

	unsigned		written; /* sectors */
	u16			flags;
	s16			error; /* dio write path expects it to hold -ERESTARTSYS... */
+0 −1
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ static void move_write_done(struct bch_write_op *op)
			struct printbuf buf = PRINTBUF;

			bch2_write_op_to_text(&buf, op);
			prt_printf(&buf, "ret\t%s\n", bch2_err_str(op->error));
			trace_io_move_write_fail(c, buf.buf);
			printbuf_exit(&buf);
		}