All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, xfs@oss.sgi.com
Subject: [PATCH 18/71] xfs: connect refcount adjust functions to upper layers
Date: Thu, 25 Aug 2016 16:33:53 -0700	[thread overview]
Message-ID: <147216803348.867.13758665374298091849.stgit@birch.djwong.org> (raw)
In-Reply-To: <147216791538.867.12413509832420924168.stgit@birch.djwong.org>

Plumb in the upper level interface to schedule and finish deferred
refcount operations via the deferred ops mechanism.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_defer.h    |    1 
 fs/xfs/libxfs/xfs_refcount.c |  170 ++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/libxfs/xfs_refcount.h |   12 +++
 fs/xfs/xfs_error.h           |    4 +
 fs/xfs/xfs_refcount_item.c   |   80 +++++++++++++++++++-
 fs/xfs/xfs_super.c           |    1 
 fs/xfs/xfs_trace.h           |    3 +
 fs/xfs/xfs_trans.h           |    8 +-
 fs/xfs/xfs_trans_refcount.c  |  167 +++++++++++++++++++++++++++++++++++++++++
 9 files changed, 439 insertions(+), 7 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
index cc3981c..d47a482 100644
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -51,6 +51,7 @@ struct xfs_defer_pending {
  * find all the space it needs.
  */
 enum xfs_defer_ops_type {
+	XFS_DEFER_OPS_TYPE_REFCOUNT,
 	XFS_DEFER_OPS_TYPE_RMAP,
 	XFS_DEFER_OPS_TYPE_FREE,
 	XFS_DEFER_OPS_TYPE_MAX,
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index 4f82651..b52ecfe 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -958,3 +958,173 @@ out_error:
 			error, _RET_IP_);
 	return error;
 }
+
+/* Clean up after calling xfs_refcount_finish_one. */
+void
+xfs_refcount_finish_one_cleanup(
+	struct xfs_trans	*tp,
+	struct xfs_btree_cur	*rcur,
+	int			error)
+{
+	struct xfs_buf		*agbp;
+
+	if (rcur == NULL)
+		return;
+	agbp = rcur->bc_private.a.agbp;
+	xfs_btree_del_cursor(rcur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+	if (error)
+		xfs_trans_brelse(tp, agbp);
+}
+
+/*
+ * Process one of the deferred refcount operations.  We pass back the
+ * btree cursor to maintain our lock on the btree between calls.
+ * This saves time and eliminates a buffer deadlock between the
+ * superblock and the AGF because we'll always grab them in the same
+ * order.
+ */
+int
+xfs_refcount_finish_one(
+	struct xfs_trans		*tp,
+	struct xfs_defer_ops		*dfops,
+	enum xfs_refcount_intent_type	type,
+	xfs_fsblock_t			startblock,
+	xfs_extlen_t			blockcount,
+	xfs_extlen_t			*adjusted,
+	struct xfs_btree_cur		**pcur)
+{
+	struct xfs_mount		*mp = tp->t_mountp;
+	struct xfs_btree_cur		*rcur;
+	struct xfs_buf			*agbp = NULL;
+	int				error = 0;
+	xfs_agnumber_t			agno;
+	xfs_agblock_t			bno;
+	unsigned long			nr_ops = 0;
+	int				shape_changes = 0;
+
+	agno = XFS_FSB_TO_AGNO(mp, startblock);
+	ASSERT(agno != NULLAGNUMBER);
+	bno = XFS_FSB_TO_AGBNO(mp, startblock);
+
+	trace_xfs_refcount_deferred(mp, XFS_FSB_TO_AGNO(mp, startblock),
+			type, XFS_FSB_TO_AGBNO(mp, startblock),
+			blockcount);
+
+	if (XFS_TEST_ERROR(false, mp,
+			XFS_ERRTAG_REFCOUNT_FINISH_ONE,
+			XFS_RANDOM_REFCOUNT_FINISH_ONE))
+		return -EIO;
+
+	/*
+	 * If we haven't gotten a cursor or the cursor AG doesn't match
+	 * the startblock, get one now.
+	 */
+	rcur = *pcur;
+	if (rcur != NULL && rcur->bc_private.a.agno != agno) {
+		nr_ops = rcur->bc_private.a.priv.refc.nr_ops;
+		shape_changes = rcur->bc_private.a.priv.refc.shape_changes;
+		xfs_refcount_finish_one_cleanup(tp, rcur, 0);
+		rcur = NULL;
+		*pcur = NULL;
+	}
+	if (rcur == NULL) {
+		error = xfs_alloc_read_agf(tp->t_mountp, tp, agno,
+				XFS_ALLOC_FLAG_FREEING, &agbp);
+		if (error)
+			return error;
+		if (!agbp)
+			return -EFSCORRUPTED;
+
+		rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, dfops);
+		if (!rcur) {
+			error = -ENOMEM;
+			goto out_cur;
+		}
+		rcur->bc_private.a.priv.refc.nr_ops = nr_ops;
+		rcur->bc_private.a.priv.refc.shape_changes = shape_changes;
+	}
+	*pcur = rcur;
+
+	switch (type) {
+	case XFS_REFCOUNT_INCREASE:
+		error = xfs_refcount_adjust(rcur, bno, blockcount, adjusted,
+			XFS_REFCOUNT_ADJUST_INCREASE, dfops, NULL);
+		break;
+	case XFS_REFCOUNT_DECREASE:
+		error = xfs_refcount_adjust(rcur, bno, blockcount, adjusted,
+			XFS_REFCOUNT_ADJUST_DECREASE, dfops, NULL);
+		break;
+	default:
+		ASSERT(0);
+		error = -EFSCORRUPTED;
+	}
+	if (!error && *adjusted != blockcount)
+		trace_xfs_refcount_finish_one_leftover(mp, agno, type,
+				bno, blockcount, *adjusted);
+	return error;
+
+out_cur:
+	xfs_trans_brelse(tp, agbp);
+
+	return error;
+}
+
+/*
+ * Record a refcount intent for later processing.
+ */
+static int
+__xfs_refcount_add(
+	struct xfs_mount		*mp,
+	struct xfs_defer_ops		*dfops,
+	enum xfs_refcount_intent_type	type,
+	xfs_fsblock_t			startblock,
+	xfs_extlen_t			blockcount)
+{
+	struct xfs_refcount_intent	*ri;
+
+	trace_xfs_refcount_defer(mp, XFS_FSB_TO_AGNO(mp, startblock),
+			type, XFS_FSB_TO_AGBNO(mp, startblock),
+			blockcount);
+
+	ri = kmem_alloc(sizeof(struct xfs_refcount_intent),
+			KM_SLEEP | KM_NOFS);
+	INIT_LIST_HEAD(&ri->ri_list);
+	ri->ri_type = type;
+	ri->ri_startblock = startblock;
+	ri->ri_blockcount = blockcount;
+
+	xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list);
+	return 0;
+}
+
+/*
+ * Increase the reference count of the blocks backing a file's extent.
+ */
+int
+xfs_refcount_increase_extent(
+	struct xfs_mount		*mp,
+	struct xfs_defer_ops		*dfops,
+	struct xfs_bmbt_irec		*PREV)
+{
+	if (!xfs_sb_version_hasreflink(&mp->m_sb))
+		return 0;
+
+	return __xfs_refcount_add(mp, dfops, XFS_REFCOUNT_INCREASE,
+			PREV->br_startblock, PREV->br_blockcount);
+}
+
+/*
+ * Decrease the reference count of the blocks backing a file's extent.
+ */
+int
+xfs_refcount_decrease_extent(
+	struct xfs_mount		*mp,
+	struct xfs_defer_ops		*dfops,
+	struct xfs_bmbt_irec		*PREV)
+{
+	if (!xfs_sb_version_hasreflink(&mp->m_sb))
+		return 0;
+
+	return __xfs_refcount_add(mp, dfops, XFS_REFCOUNT_DECREASE,
+			PREV->br_startblock, PREV->br_blockcount);
+}
diff --git a/fs/xfs/libxfs/xfs_refcount.h b/fs/xfs/libxfs/xfs_refcount.h
index 2ef2b28..605d7d7 100644
--- a/fs/xfs/libxfs/xfs_refcount.h
+++ b/fs/xfs/libxfs/xfs_refcount.h
@@ -41,4 +41,16 @@ struct xfs_refcount_intent {
 	xfs_extlen_t				ri_blockcount;
 };
 
+extern int xfs_refcount_increase_extent(struct xfs_mount *mp,
+		struct xfs_defer_ops *dfops, struct xfs_bmbt_irec *irec);
+extern int xfs_refcount_decrease_extent(struct xfs_mount *mp,
+		struct xfs_defer_ops *dfops, struct xfs_bmbt_irec *irec);
+
+extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp,
+		struct xfs_btree_cur *rcur, int error);
+extern int xfs_refcount_finish_one(struct xfs_trans *tp,
+		struct xfs_defer_ops *dfops, enum xfs_refcount_intent_type type,
+		xfs_fsblock_t startblock, xfs_extlen_t blockcount,
+		xfs_extlen_t *adjusted, struct xfs_btree_cur **pcur);
+
 #endif	/* __XFS_REFCOUNT_H__ */
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index d9675c64..641e090 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -93,7 +93,8 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
 #define XFS_ERRTAG_FREE_EXTENT				22
 #define XFS_ERRTAG_RMAP_FINISH_ONE			23
 #define XFS_ERRTAG_REFCOUNT_CONTINUE_UPDATE		24
-#define XFS_ERRTAG_MAX					25
+#define XFS_ERRTAG_REFCOUNT_FINISH_ONE			25
+#define XFS_ERRTAG_MAX					26
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -123,6 +124,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
 #define XFS_RANDOM_FREE_EXTENT				1
 #define XFS_RANDOM_RMAP_FINISH_ONE			1
 #define XFS_RANDOM_REFCOUNT_CONTINUE_UPDATE		1
+#define XFS_RANDOM_REFCOUNT_FINISH_ONE			1
 
 #ifdef DEBUG
 extern int xfs_error_test_active;
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index a4a6c21..7be6029 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -24,11 +24,13 @@
 #include "xfs_trans_resv.h"
 #include "xfs_bit.h"
 #include "xfs_mount.h"
+#include "xfs_defer.h"
 #include "xfs_trans.h"
 #include "xfs_trans_priv.h"
 #include "xfs_buf_item.h"
 #include "xfs_refcount_item.h"
 #include "xfs_log.h"
+#include "xfs_refcount.h"
 
 
 kmem_zone_t	*xfs_cui_zone;
@@ -437,6 +439,15 @@ xfs_cui_recover(
 	struct xfs_phys_extent		*refc;
 	xfs_fsblock_t			startblock_fsb;
 	bool				op_ok;
+	struct xfs_cud_log_item		*cudp;
+	struct xfs_trans		*tp;
+	struct xfs_btree_cur		*rcur = NULL;
+	enum xfs_refcount_intent_type	type;
+	xfs_fsblock_t			firstfsb;
+	xfs_extlen_t			adjusted;
+	struct xfs_bmbt_irec		irec;
+	struct xfs_defer_ops		dfops;
+	bool				requeue_only = false;
 
 	ASSERT(!test_bit(XFS_CUI_RECOVERED, &cuip->cui_flags));
 
@@ -475,8 +486,73 @@ xfs_cui_recover(
 		}
 	}
 
-	/* XXX: do nothing for now */
+	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
+	if (error)
+		return error;
+	cudp = xfs_trans_get_cud(tp, cuip);
+
+	xfs_defer_init(&dfops, &firstfsb);
+	for (i = 0; i < cuip->cui_format.cui_nextents; i++) {
+		refc = &cuip->cui_format.cui_extents[i];
+		switch (refc->pe_flags & XFS_REFCOUNT_EXTENT_TYPE_MASK) {
+		case XFS_REFCOUNT_EXTENT_INCREASE:
+			type = XFS_REFCOUNT_INCREASE;
+			break;
+		case XFS_REFCOUNT_EXTENT_DECREASE:
+			type = XFS_REFCOUNT_DECREASE;
+			break;
+		case XFS_REFCOUNT_EXTENT_ALLOC_COW:
+			type = XFS_REFCOUNT_ALLOC_COW;
+			break;
+		case XFS_REFCOUNT_EXTENT_FREE_COW:
+			type = XFS_REFCOUNT_FREE_COW;
+			break;
+		default:
+			error = -EFSCORRUPTED;
+			goto abort_error;
+		}
+		if (requeue_only)
+			adjusted = 0;
+		else
+			error = xfs_trans_log_finish_refcount_update(tp, cudp,
+				&dfops, type, refc->pe_startblock, refc->pe_len,
+				&adjusted, &rcur);
+		if (error)
+			goto abort_error;
+
+		/* Requeue what we didn't finish. */
+		if (adjusted < refc->pe_len) {
+			irec.br_startblock = refc->pe_startblock + adjusted;
+			irec.br_blockcount = refc->pe_len - adjusted;
+			switch (type) {
+			case XFS_REFCOUNT_INCREASE:
+				error = xfs_refcount_increase_extent(
+						tp->t_mountp, &dfops, &irec);
+				break;
+			case XFS_REFCOUNT_DECREASE:
+				error = xfs_refcount_decrease_extent(
+						tp->t_mountp, &dfops, &irec);
+				break;
+			default:
+				ASSERT(0);
+			}
+			if (error)
+				goto abort_error;
+			requeue_only = true;
+		}
+	}
+
+	xfs_refcount_finish_one_cleanup(tp, rcur, error);
+	error = xfs_defer_finish(&tp, &dfops, NULL);
+	if (error)
+		goto abort_error;
 	set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
-	xfs_cui_release(cuip);
+	error = xfs_trans_commit(tp);
+	return error;
+
+abort_error:
+	xfs_refcount_finish_one_cleanup(tp, rcur, error);
+	xfs_defer_cancel(&dfops);
+	xfs_trans_cancel(tp);
 	return error;
 }
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index be9a98b..a027e27 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1905,6 +1905,7 @@ init_xfs_fs(void)
 
 	xfs_extent_free_init_defer_op();
 	xfs_rmap_update_init_defer_op();
+	xfs_refcount_update_init_defer_op();
 
 	xfs_dir_startup();
 
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index a195fc5..6175003 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -2905,6 +2905,9 @@ DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_rec_order_error);
 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
+#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
+DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
+DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
 
 TRACE_EVENT(xfs_refcount_finish_one_leftover,
 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index fe69e20..a7a87d2 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -37,6 +37,8 @@ struct xfs_rud_log_item;
 struct xfs_rui_log_item;
 struct xfs_btree_cur;
 struct xfs_cui_log_item;
+struct xfs_cud_log_item;
+struct xfs_defer_ops;
 
 typedef struct xfs_log_item {
 	struct list_head		li_ail;		/* AIL pointers */
@@ -252,11 +254,13 @@ int xfs_trans_log_finish_rmap_update(struct xfs_trans *tp,
 /* refcount updates */
 enum xfs_refcount_intent_type;
 
+void xfs_refcount_update_init_defer_op(void);
 struct xfs_cud_log_item *xfs_trans_get_cud(struct xfs_trans *tp,
 		struct xfs_cui_log_item *cuip);
 int xfs_trans_log_finish_refcount_update(struct xfs_trans *tp,
-		struct xfs_cud_log_item *cudp,
+		struct xfs_cud_log_item *cudp, struct xfs_defer_ops *dfops,
 		enum xfs_refcount_intent_type type, xfs_fsblock_t startblock,
-		xfs_extlen_t blockcount, struct xfs_btree_cur **pcur);
+		xfs_extlen_t blockcount, xfs_extlen_t *adjusted,
+		struct xfs_btree_cur **pcur);
 
 #endif	/* __XFS_TRANS_H__ */
diff --git a/fs/xfs/xfs_trans_refcount.c b/fs/xfs/xfs_trans_refcount.c
index 6398ff9..3358a13 100644
--- a/fs/xfs/xfs_trans_refcount.c
+++ b/fs/xfs/xfs_trans_refcount.c
@@ -81,15 +81,17 @@ int
 xfs_trans_log_finish_refcount_update(
 	struct xfs_trans		*tp,
 	struct xfs_cud_log_item		*cudp,
+	struct xfs_defer_ops		*dop,
 	enum xfs_refcount_intent_type	type,
 	xfs_fsblock_t			startblock,
 	xfs_extlen_t			blockcount,
+	xfs_extlen_t			*adjusted,
 	struct xfs_btree_cur		**pcur)
 {
 	int				error;
 
-	/* XXX: leave this empty for now */
-	error = -EFSCORRUPTED;
+	error = xfs_refcount_finish_one(tp, dop, type, startblock,
+			blockcount, adjusted, pcur);
 
 	/*
 	 * Mark the transaction dirty, even on error. This ensures the
@@ -103,3 +105,164 @@ xfs_trans_log_finish_refcount_update(
 
 	return error;
 }
+
+/* Sort refcount intents by AG. */
+static int
+xfs_refcount_update_diff_items(
+	void				*priv,
+	struct list_head		*a,
+	struct list_head		*b)
+{
+	struct xfs_mount		*mp = priv;
+	struct xfs_refcount_intent	*ra;
+	struct xfs_refcount_intent	*rb;
+
+	ra = container_of(a, struct xfs_refcount_intent, ri_list);
+	rb = container_of(b, struct xfs_refcount_intent, ri_list);
+	return  XFS_FSB_TO_AGNO(mp, ra->ri_startblock) -
+		XFS_FSB_TO_AGNO(mp, rb->ri_startblock);
+}
+
+/* Get an CUI. */
+STATIC void *
+xfs_refcount_update_create_intent(
+	struct xfs_trans		*tp,
+	unsigned int			count)
+{
+	struct xfs_cui_log_item		*cuip;
+
+	ASSERT(tp != NULL);
+	ASSERT(count > 0);
+
+	cuip = xfs_cui_init(tp->t_mountp, count);
+	ASSERT(cuip != NULL);
+
+	/*
+	 * Get a log_item_desc to point at the new item.
+	 */
+	xfs_trans_add_item(tp, &cuip->cui_item);
+	return cuip;
+}
+
+/* Log refcount updates in the intent item. */
+STATIC void
+xfs_refcount_update_log_item(
+	struct xfs_trans		*tp,
+	void				*intent,
+	struct list_head		*item)
+{
+	struct xfs_cui_log_item		*cuip = intent;
+	struct xfs_refcount_intent	*refc;
+	uint				next_extent;
+	struct xfs_phys_extent		*ext;
+
+	refc = container_of(item, struct xfs_refcount_intent, ri_list);
+
+	tp->t_flags |= XFS_TRANS_DIRTY;
+	cuip->cui_item.li_desc->lid_flags |= XFS_LID_DIRTY;
+
+	/*
+	 * atomic_inc_return gives us the value after the increment;
+	 * we want to use it as an array index so we need to subtract 1 from
+	 * it.
+	 */
+	next_extent = atomic_inc_return(&cuip->cui_next_extent) - 1;
+	ASSERT(next_extent < cuip->cui_format.cui_nextents);
+	ext = &cuip->cui_format.cui_extents[next_extent];
+	ext->pe_startblock = refc->ri_startblock;
+	ext->pe_len = refc->ri_blockcount;
+	xfs_trans_set_refcount_flags(ext, refc->ri_type);
+}
+
+/* Get an CUD so we can process all the deferred refcount updates. */
+STATIC void *
+xfs_refcount_update_create_done(
+	struct xfs_trans		*tp,
+	void				*intent,
+	unsigned int			count)
+{
+	return xfs_trans_get_cud(tp, intent);
+}
+
+/* Process a deferred refcount update. */
+STATIC int
+xfs_refcount_update_finish_item(
+	struct xfs_trans		*tp,
+	struct xfs_defer_ops		*dop,
+	struct list_head		*item,
+	void				*done_item,
+	void				**state)
+{
+	struct xfs_refcount_intent	*refc;
+	xfs_extlen_t			adjusted;
+	int				error;
+
+	refc = container_of(item, struct xfs_refcount_intent, ri_list);
+	error = xfs_trans_log_finish_refcount_update(tp, done_item, dop,
+			refc->ri_type,
+			refc->ri_startblock,
+			refc->ri_blockcount,
+			&adjusted,
+			(struct xfs_btree_cur **)state);
+	/* Did we run out of reservation?  Requeue what we didn't finish. */
+	if (!error && adjusted < refc->ri_blockcount) {
+		ASSERT(refc->ri_type == XFS_REFCOUNT_INCREASE ||
+		       refc->ri_type == XFS_REFCOUNT_DECREASE);
+		refc->ri_startblock += adjusted;
+		refc->ri_blockcount -= adjusted;
+		return -EAGAIN;
+	}
+	kmem_free(refc);
+	return error;
+}
+
+/* Clean up after processing deferred refcounts. */
+STATIC void
+xfs_refcount_update_finish_cleanup(
+	struct xfs_trans	*tp,
+	void			*state,
+	int			error)
+{
+	struct xfs_btree_cur	*rcur = state;
+
+	xfs_refcount_finish_one_cleanup(tp, rcur, error);
+}
+
+/* Abort all pending CUIs. */
+STATIC void
+xfs_refcount_update_abort_intent(
+	void				*intent)
+{
+	xfs_cui_release(intent);
+}
+
+/* Cancel a deferred refcount update. */
+STATIC void
+xfs_refcount_update_cancel_item(
+	struct list_head		*item)
+{
+	struct xfs_refcount_intent	*refc;
+
+	refc = container_of(item, struct xfs_refcount_intent, ri_list);
+	kmem_free(refc);
+}
+
+static const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
+	.type		= XFS_DEFER_OPS_TYPE_REFCOUNT,
+	.max_items	= XFS_CUI_MAX_FAST_EXTENTS,
+	.diff_items	= xfs_refcount_update_diff_items,
+	.create_intent	= xfs_refcount_update_create_intent,
+	.abort_intent	= xfs_refcount_update_abort_intent,
+	.log_item	= xfs_refcount_update_log_item,
+	.create_done	= xfs_refcount_update_create_done,
+	.finish_item	= xfs_refcount_update_finish_item,
+	.finish_cleanup = xfs_refcount_update_finish_cleanup,
+	.cancel_item	= xfs_refcount_update_cancel_item,
+};
+
+/* Register the deferred op type. */
+void
+xfs_refcount_update_init_defer_op(void)
+{
+	xfs_defer_init_op_type(&xfs_refcount_update_defer_type);
+}

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2016-08-25 23:34 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 23:31 [PATCH v8 00/71] xfs: add reflink and dedupe support Darrick J. Wong
2016-08-25 23:32 ` [PATCH 01/71] xfs: remove xfs_btree_bigkey Darrick J. Wong
2016-09-05 15:04   ` Christoph Hellwig
2016-08-25 23:32 ` [PATCH 02/71] xfs: create a standard btree size calculator code Darrick J. Wong
2016-09-05 15:05   ` Christoph Hellwig
2016-08-25 23:32 ` [PATCH 03/71] xfs: count the blocks in a btree Darrick J. Wong
2016-09-05 15:05   ` Christoph Hellwig
2016-08-25 23:32 ` [PATCH 04/71] xfs: defer should allow ->finish_item to request a new transaction Darrick J. Wong
2016-09-06  6:38   ` Christoph Hellwig
2016-09-06 23:57     ` Darrick J. Wong
2016-08-25 23:32 ` [PATCH 05/71] xfs: introduce tracepoints for AG reservation code Darrick J. Wong
2016-09-06  6:38   ` Christoph Hellwig
2016-08-25 23:32 ` [PATCH 06/71] xfs: set up per-AG free space reservations Darrick J. Wong
2016-09-06 14:53   ` Christoph Hellwig
2016-09-06 17:31     ` Darrick J. Wong
2016-09-08 17:47       ` Darrick J. Wong
2016-08-25 23:32 ` [PATCH 07/71] xfs: define tracepoints for refcount btree activities Darrick J. Wong
2016-09-06 14:54   ` Christoph Hellwig
2016-09-08 18:20     ` Darrick J. Wong
2016-08-25 23:32 ` [PATCH 08/71] xfs: introduce refcount btree definitions Darrick J. Wong
2016-09-06 14:59   ` Christoph Hellwig
2016-09-06 17:13     ` Darrick J. Wong
2016-08-25 23:32 ` [PATCH 09/71] xfs: add refcount btree stats infrastructure Darrick J. Wong
2016-09-06 14:59   ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 10/71] xfs: refcount btree add more reserved blocks Darrick J. Wong
2016-09-06 15:00   ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 11/71] xfs: define the on-disk refcount btree format Darrick J. Wong
2016-09-06 15:06   ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 12/71] xfs: add refcount btree support to growfs Darrick J. Wong
2016-09-06 15:06   ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 13/71] xfs: account for the refcount btree in the alloc/free log reservation Darrick J. Wong
2016-08-25 23:33 ` [PATCH 14/71] xfs: add refcount btree operations Darrick J. Wong
2016-09-06 15:09   ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 15/71] xfs: create refcount update intent log items Darrick J. Wong
2016-09-06 15:16   ` Christoph Hellwig
2016-09-06 16:43     ` Darrick J. Wong
2016-09-06 17:03       ` Christoph Hellwig
2016-08-25 23:33 ` [PATCH 16/71] xfs: log refcount intent items Darrick J. Wong
2016-09-06 15:21   ` Christoph Hellwig
2016-09-08 19:14     ` Darrick J. Wong
2016-09-08 23:13       ` Dave Chinner
2016-09-08 23:16         ` Darrick J. Wong
2016-09-11 12:52           ` Christoph Hellwig
2016-09-12 18:40             ` Darrick J. Wong
2016-09-12 23:28               ` Dave Chinner
2016-08-25 23:33 ` [PATCH 17/71] xfs: adjust refcount of an extent of blocks in refcount btree Darrick J. Wong
2016-08-25 23:33 ` Darrick J. Wong [this message]
2016-08-25 23:34 ` [PATCH 19/71] xfs: adjust refcount when unmapping file blocks Darrick J. Wong
2016-08-25 23:34 ` [PATCH 20/71] xfs: add refcount btree block detection to log recovery Darrick J. Wong
2016-08-25 23:34 ` [PATCH 21/71] xfs: refcount btree requires more reserved space Darrick J. Wong
2016-08-25 23:34 ` [PATCH 22/71] xfs: introduce reflink utility functions Darrick J. Wong
2016-08-25 23:34 ` [PATCH 23/71] xfs: create bmbt update intent log items Darrick J. Wong
2016-08-25 23:34 ` [PATCH 24/71] xfs: log bmap intent items Darrick J. Wong
2016-08-25 23:34 ` [PATCH 25/71] xfs: map an inode's offset to an exact physical block Darrick J. Wong
2016-08-25 23:34 ` [PATCH 26/71] xfs: pass bmapi flags through to bmap_del_extent Darrick J. Wong
2016-08-25 23:34 ` [PATCH 27/71] xfs: implement deferred bmbt map/unmap operations Darrick J. Wong
2016-08-25 23:35 ` [PATCH 28/71] xfs: when replaying bmap operations, don't let unlinked inodes get reaped Darrick J. Wong
2016-08-25 23:35 ` [PATCH 29/71] xfs: return work remaining at the end of a bunmapi operation Darrick J. Wong
2016-08-25 23:35 ` [PATCH 30/71] xfs: define tracepoints for reflink activities Darrick J. Wong
2016-08-25 23:35 ` [PATCH 31/71] xfs: add reflink feature flag to geometry Darrick J. Wong
2016-08-25 23:35 ` [PATCH 32/71] xfs: don't allow reflinked dir/dev/fifo/socket/pipe files Darrick J. Wong
2016-08-25 23:35 ` [PATCH 33/71] xfs: introduce the CoW fork Darrick J. Wong
2016-08-25 23:35 ` [PATCH 34/71] xfs: support bmapping delalloc extents in " Darrick J. Wong
2016-09-06 15:25   ` Christoph Hellwig
2016-09-06 16:34     ` Darrick J. Wong
2016-09-11 12:59       ` Christoph Hellwig
2016-09-06 23:40     ` Dave Chinner
2016-09-11 12:57       ` Christoph Hellwig
2016-08-25 23:35 ` [PATCH 35/71] xfs: create delalloc extents in " Darrick J. Wong
2016-08-25 23:35 ` [PATCH 36/71] xfs: support allocating delayed " Darrick J. Wong
2016-08-25 23:35 ` [PATCH 37/71] xfs: allocate " Darrick J. Wong
2016-08-25 23:36 ` [PATCH 38/71] xfs: support removing extents from " Darrick J. Wong
2016-08-25 23:36 ` [PATCH 39/71] xfs: move mappings from cow fork to data fork after copy-write Darrick J. Wong
2016-08-25 23:36 ` [PATCH 40/71] xfs: report shared extents through the iomap interface Darrick J. Wong
2016-08-25 23:36 ` [PATCH 41/71] xfs: implement CoW for directio writes Darrick J. Wong
2016-08-25 23:36 ` [PATCH 42/71] xfs: cancel CoW reservations and clear inode reflink flag when freeing blocks Darrick J. Wong
2016-08-25 23:36 ` [PATCH 43/71] xfs: cancel pending CoW reservations when destroying inodes Darrick J. Wong
2016-08-25 23:36 ` [PATCH 44/71] xfs: store in-progress CoW allocations in the refcount btree Darrick J. Wong
2016-08-25 23:36 ` [PATCH 45/71] xfs: reflink extents from one file to another Darrick J. Wong
2016-08-25 23:36 ` [PATCH 46/71] xfs: add clone file and clone range vfs functions Darrick J. Wong
2016-08-25 23:37 ` [PATCH 47/71] xfs: add dedupe range vfs function Darrick J. Wong
2016-08-25 23:37 ` [PATCH 48/71] xfs: teach get_bmapx about shared extents and the CoW fork Darrick J. Wong
2016-08-25 23:37 ` [PATCH 49/71] xfs: swap inode reflink flags when swapping inode extents Darrick J. Wong
2016-08-25 23:37 ` [PATCH 50/71] xfs: unshare a range of blocks via fallocate Darrick J. Wong
2016-08-25 23:37 ` [PATCH 51/71] xfs: CoW shared EOF block when truncating file Darrick J. Wong
2016-08-25 23:37 ` [PATCH 52/71] xfs: support FS_XFLAG_REFLINK on reflink filesystems Darrick J. Wong
2016-08-25 23:37 ` [PATCH 53/71] xfs: create a separate cow extent size hint for the allocator Darrick J. Wong
2016-08-25 23:37 ` [PATCH 54/71] xfs: preallocate blocks for worst-case btree expansion Darrick J. Wong
2016-08-25 23:37 ` [PATCH 55/71] xfs: don't allow reflink when the AG is low on space Darrick J. Wong
2016-08-25 23:38 ` [PATCH 56/71] xfs: try other AGs to allocate a BMBT block Darrick J. Wong
2016-08-25 23:38 ` [PATCH 57/71] xfs: promote buffered writes to CoW when cowextsz is set Darrick J. Wong
2016-08-25 23:38 ` [PATCH 58/71] xfs: garbage collect old cowextsz reservations Darrick J. Wong
2016-09-24 19:42   ` Christoph Hellwig
2016-09-26 21:52     ` Darrick J. Wong
2016-09-27 18:50       ` Christoph Hellwig
2016-09-27 19:29         ` Darrick J. Wong
2016-09-27 20:15       ` Christoph Hellwig
2016-09-27 20:25         ` Darrick J. Wong
2016-08-25 23:38 ` [PATCH 59/71] xfs: provide switch to force filesystem to copy-on-write all the time Darrick J. Wong
2016-08-25 23:38 ` [PATCH 60/71] xfs: increase log reservations for reflink Darrick J. Wong
2016-08-25 23:38 ` [PATCH 61/71] xfs: add shared rmap map/unmap/convert log item types Darrick J. Wong
2016-08-25 23:38 ` [PATCH 62/71] xfs: use interval query for rmap alloc operations on shared files Darrick J. Wong
2016-08-25 23:38 ` [PATCH 63/71] xfs: convert unwritten status of reverse mappings for " Darrick J. Wong
2016-08-25 23:38 ` [PATCH 64/71] xfs: set a default CoW extent size of 32 blocks Darrick J. Wong
2016-08-25 23:38 ` [PATCH 65/71] xfs: check for invalid inode reflink flags Darrick J. Wong
2016-08-25 23:39 ` [PATCH 66/71] xfs: don't mix reflink and DAX mode for now Darrick J. Wong
2016-08-25 23:39 ` [PATCH 67/71] xfs: fail ->bmap for reflink inodes Darrick J. Wong
2016-09-06 15:29   ` Christoph Hellwig
2016-09-06 16:26     ` Darrick J. Wong
2016-09-06 17:02       ` Christoph Hellwig
2016-08-25 23:39 ` [PATCH 68/71] xfs: recognize the reflink feature bit Darrick J. Wong
2016-08-25 23:39 ` [PATCH 69/71] xfs: various swapext cleanups Darrick J. Wong
2016-08-25 23:39 ` [PATCH 70/71] xfs: refactor swapext code Darrick J. Wong
2016-08-25 23:39 ` [PATCH 71/71] xfs: implement swapext for rmap filesystems Darrick J. Wong
2016-08-26 12:56 ` [PATCH v8 00/71] xfs: add reflink and dedupe support Christoph Hellwig
2016-08-26 16:28   ` Darrick J. Wong
2016-08-26 18:42   ` Darrick J. Wong
2016-08-26 14:08 ` Brian Foster
2016-08-26 18:44 ` [PATCH 72/71] xfs: track log done items directly in the deferred pending work item Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=147216803348.867.13758665374298091849.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.