misc log item related cleanups v2
Hi all,
I've recently been trying to debug issue related to latencies related to locked buffers and went all over our log item lifecycles for that.
It turns out a lot of code in that area is rather obsfucated and redundant. This series is almost entirely cleanups, but there are lots of it. The only exception is a fix for systematic memory leaks which appears entirely theoretical.
Note that this series sits on top of the series titled
"use bios directly in the log code v4". To make everyones life easier a git tree is available here:
git://git.infradead.org/users/hch/xfs.git xfs-log-item-cleanup
Gitweb:
http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/xfs-log-item-cleanup
Changes since v1:
- improve a few commit messages
- add various comments
- minor code style fixes
- drop the patch to remove iop_pushed from the quotaoff item
- set XFS_LI_ABORTED earlier in xfs_trans_committed_bulk
PATCH 1/20 xfs: fix a trivial comment typo in xfs_trans_committed_bulk
--- fs/xfs/xfs_trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans.c +1 -1
@@ -815,7 +815,7 @@ xfs_log_item_batch_insert(* * If we are called with the aborted flag set, it is because a log write during * a CIL checkpoint commit has failed. In this case, all the items in the -* checkpoint have already gone through iop_commited and iop_unlock, which +* checkpoint have already gone through iop_committed and iop_unlock, which * means that checkpoint commit abort handling is treated exactly the same * as an iclog write error even though we haven't started any IO yet. Hence in * this case all we need to do is iop_committed processing, followed by an
Signature · 1 line
2.20.1
PATCH 2/20 xfs: stop using XFS_LI_ABORTED as a parameter flag
In reply to Christoph HellwigJust pass a straight bool aborted instead of abusing XFS_LI_ABORTED as a flag in function parameters.
--- fs/xfs/xfs_log.c | 25 +++++++++++-------------- fs/xfs/xfs_log.h | 2 +- fs/xfs/xfs_log_cil.c | 4 ++-- fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans_priv.h | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-)
fs/xfs/xfs_log.c +11 -14
@@ -50,12 +50,9 @@ xlog_dealloc_log( struct xlog *log);/* local state machine functions */ -STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int); -STATIC void -xlog_state_do_callback ( -struct xlog *log, -int aborted, -struct xlog_in_core *iclog); +STATIC void xlog_state_done_syncing( +struct xlog_in_core *iclog, +bool aborted); STATIC int xlog_state_get_iclog_space( struct xlog *log,
@@ -1246,7 +1243,7 @@ xlog_ioend_work(struct xlog_in_core *iclog = container_of(work, struct xlog_in_core, ic_end_io_work);struct xlog *log = iclog->ic_log; -int aborted =0 ; +bool aborted = false;int error;#ifdef DEBUG
@@ -1268,9 +1265,9 @@ xlog_ioend_work(* callback routines to let them know that the log-commit * didn't succeed. */ - aborted =XFS_LI_ABORTED ; + aborted = true; }else if (iclog->ic_state &XLOG_STATE_IOERROR ) { - aborted =XFS_LI_ABORTED ; + aborted = true; }xlog_state_done_syncing (iclog, aborted);
@@ -2639,7 +2636,7 @@ xlog_get_lowest_lsn( STATIC voidxlog_state_do_callback (struct xlog *log, -int aborted, +bool aborted,struct xlog_in_core *ciclog) {xlog_in_core_t *iclog;
@@ -2878,10 +2875,10 @@ xlog_state_do_callback(*/ STATIC voidxlog_state_done_syncing ( -xlog_in_core_t *iclog, -int aborted) +struct xlog_in_core *iclog, +bool aborted) { -struct xlog *log = iclog->ic_log; +struct xlog *log = iclog->ic_log;spin_lock (&log->l_icloglock);
@@ -3960,7 +3957,7 @@ xfs_log_force_umount(* avoid races. */ wake_up_all (&log->l_cilp->xc_commit_wait); -xlog_state_do_callback (log,XFS_LI_ABORTED ,NULL ); +xlog_state_do_callback (log, true,NULL );#ifdef XFSERRORDEBUG {
fs/xfs/xfs_log.h +1 -1
@@ -77,7 +77,7 @@ xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,*/ typedef struct xfs_log_callback {struct xfs_log_callback *cb_next; -void (*cb_func)(void *,int ); +void (*cb_func)(void *,bool );void *cb_arg; }xfs_log_callback_t ;
fs/xfs/xfs_log_cil.c +2 -2
@@ -577,7 +577,7 @@ xlog_discard_busy_extents(static void xlog_cil_committed (void *args, -int abort) +bool abort) {struct xfs_cil_ctx *ctx = args;struct xfs_mount *mp = ctx->cil->xc_log->l_mp;
@@ -864,7 +864,7 @@ xlog_cil_push( out_abort_free_ticket:xfs_log_ticket_put (tic); out_abort: -xlog_cil_committed (ctx,XFS_LI_ABORTED ); +xlog_cil_committed (ctx, true);return -EIO ; }
fs/xfs/xfs_trans.c +1 -1
@@ -833,7 +833,7 @@ xfs_trans_committed_bulk(struct xfs_ail *ailp, struct xfs_log_vec *log_vector, xfs_lsn_t commit_lsn, - int aborted) + bool aborted) { #define LOG_ITEM_BATCH_SIZE 32 struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE];
fs/xfs/xfs_trans_priv.h +1 -1
@@ -21,7 +21,7 @@ void xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn,void xfs_trans_unreserve_and_mod_sb (struct xfs_trans *tp);void xfs_trans_committed_bulk (struct xfs_ail *ailp,struct xfs_log_vec *lv, -xfs_lsn_t commit_lsn,int aborted); +xfs_lsn_t commit_lsn,bool aborted);/* * AIL traversal cursor. *
Signature · 1 line
2.20.1
PATCH 3/20 xfs: don't require log items to implement optional methods
In reply to Christoph HellwigJust check if they are present first.
--- fs/xfs/xfs_bmap_item.c | 104 ------------------------------------- fs/xfs/xfs_buf_item.c | 8 --- fs/xfs/xfs_dquot_item.c | 98 ---------------------------------- fs/xfs/xfs_extfree_item.c | 104 ------------------------------------- fs/xfs/xfs_icreate_item.c | 28 ---------- fs/xfs/xfs_log_cil.c | 3 +- fs/xfs/xfs_refcount_item.c | 104 ------------------------------------- fs/xfs/xfs_rmap_item.c | 104 ------------------------------------- fs/xfs/xfs_trans.c | 21 +++++--- fs/xfs/xfs_trans_ail.c | 8 +++ 10 files changed, 25 insertions(+), 557 deletions(-)
fs/xfs/xfs_bmap_item.c +0 -104
@@ -95,15 +95,6 @@ xfs_bui_item_format( xfs_bui_log_format_sizeof(buip->bui_format.bui_nextents)); } -/* -* Pinning has no meaning for an bui item, so just return. -*/ -STATIC void -xfs_bui_item_pin ( -struct xfs_log_item *lip) -{ -} -/* * The unpin operation is the last place an BUI is manipulated in the log. It is * either inserted in the AIL or aborted in the event of a log I/O error. In
@@ -122,21 +113,6 @@ xfs_bui_item_unpin(xfs_bui_release (buip); } -/* -* BUI items have no locking or pushing. However, since BUIs are pulled from -* the AIL when their corresponding BUDs are committed to disk, their situation -* is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller -* will eventually flush the log. This should help in getting the BUI out of -* the AIL. -*/ -STATIC uint -xfs_bui_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The BUI has been either committed or aborted if the transaction has been * cancelled. If the transaction was cancelled, an BUD isn't going to be
@@ -150,44 +126,14 @@ xfs_bui_item_unlock(xfs_bui_release (BUI_ITEM (lip)); } -/* -* The BUI is logged only once and cannot be moved in the log, so simply return -* the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_bui_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - -/* -* The BUI dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_bui_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all bui log items. */ static const struct xfs_item_ops xfs_bui_item_ops = { .iop_size = xfs_bui_item_size, .iop_format = xfs_bui_item_format, - .iop_pin = xfs_bui_item_pin, .iop_unpin = xfs_bui_item_unpin, .iop_unlock = xfs_bui_item_unlock, - .iop_committed = xfs_bui_item_committed, - .iop_push = xfs_bui_item_push, - .iop_committing = xfs_bui_item_committing, };/*
@@ -248,38 +194,6 @@ xfs_bud_item_format( sizeof(struct xfs_bud_log_format)); } -/* -* Pinning has no meaning for an bud item, so just return. -*/ -STATIC void -xfs_bud_item_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an bud item, unpinning does -* not either. -*/ -STATIC void -xfs_bud_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - -/* -* There isn't much you can do to push on an bud item. It is simply stuck -* waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_bud_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The BUD is either committed or aborted if the transaction is cancelled. If * the transaction is cancelled, drop our reference to the BUI and free the
@@ -322,32 +236,14 @@ xfs_bud_item_committed(return (xfs_lsn_t)-1 ; } -/* -* The BUD dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_bud_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all bud log items. */ static const struct xfs_item_ops xfs_bud_item_ops = { .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, - .iop_pin = xfs_bud_item_pin, - .iop_unpin = xfs_bud_item_unpin, .iop_unlock = xfs_bud_item_unlock, .iop_committed = xfs_bud_item_committed, - .iop_push = xfs_bud_item_push, - .iop_committing = xfs_bud_item_committing, };/*
fs/xfs/xfs_buf_item.c +0 -8
@@ -671,13 +671,6 @@ xfs_buf_item_committed(return lsn; } -STATIC void -xfs_buf_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t commit_lsn) -{ -} -/* * This is the ops vector shared by all buf log items. */
@@ -689,7 +682,6 @@ static const struct xfs_item_ops xfs_buf_item_ops = { .iop_unlock = xfs_buf_item_unlock, .iop_committed = xfs_buf_item_committed, .iop_push = xfs_buf_item_push, - .iop_committing = xfs_buf_item_committing };STATIC int
fs/xfs/xfs_dquot_item.c +0 -98
147 lines not on this page · raw message
fs/xfs/xfs_extfree_item.c +0 -104
150 lines not on this page · raw message
fs/xfs/xfs_icreate_item.c +0 -28
@@ -56,23 +56,6 @@ xfs_icreate_item_format( sizeof(struct xfs_icreate_log)); } - -/* Pinning has no meaning for the create item, so just return. */ -STATIC void -xfs_icreate_item_pin ( -struct xfs_log_item *lip) -{ -} - - -/* pinning has no meaning for the create item, so just return. */ -STATIC void -xfs_icreate_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - STATIC voidxfs_icreate_item_unlock (struct xfs_log_item *lip)
@@ -110,26 +93,15 @@ xfs_icreate_item_push(return XFS_ITEM_SUCCESS ; } -/* Ordered buffers do the dependency tracking here, so this does nothing. */ -STATIC void -xfs_icreate_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all buf log items. */ static const struct xfs_item_ops xfs_icreate_item_ops = { .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, - .iop_pin = xfs_icreate_item_pin, - .iop_unpin = xfs_icreate_item_unpin, .iop_push = xfs_icreate_item_push, .iop_unlock = xfs_icreate_item_unlock, .iop_committed = xfs_icreate_item_committed, - .iop_committing = xfs_icreate_item_committing, };
fs/xfs/xfs_log_cil.c +2 -1
@@ -246,7 +246,8 @@ xfs_cil_prepare_item(* shadow buffer, so update the the pointer to it appropriately. */ if (!old_lv) { - lv->lv_item->li_ops->iop_pin (lv->lv_item); +if (lv->lv_item->li_ops->iop_pin) + lv->lv_item->li_ops->iop_pin (lv->lv_item); lv->lv_item->li_lv_shadow =NULL ; }else if (old_lv != lv) {ASSERT (lv->lv_buf_len !=XFS_LOG_VEC_ORDERED );
fs/xfs/xfs_refcount_item.c +0 -104
150 lines not on this page · raw message
fs/xfs/xfs_rmap_item.c +0 -104
150 lines not on this page · raw message
fs/xfs/xfs_trans.c +15 -6
@@ -779,11 +779,14 @@ xfs_trans_free_items(list_for_each_entry_safe (lip, next, &tp->t_items, li_trans) {xfs_trans_del_item (lip); -if (commit_lsn !=NULLCOMMITLSN ) +if (commit_lsn !=NULLCOMMITLSN && + lip->li_ops->iop_committing) lip->li_ops->iop_committing (lip, commit_lsn);if (abort)set_bit (XFS_LI_ABORTED , &lip->li_flags); - lip->li_ops->iop_unlock (lip); + +if (lip->li_ops->iop_unlock) + lip->li_ops->iop_unlock (lip); } }
@@ -804,7 +807,8 @@ xfs_log_item_batch_insert(for (i =0 ; i < nr_items; i++) {struct xfs_log_item *lip = log_items[i]; - lip->li_ops->iop_unpin (lip,0 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,0 ); } }
@@ -852,7 +856,10 @@ xfs_trans_committed_bulk(if (aborted)set_bit (XFS_LI_ABORTED , &lip->li_flags); - item_lsn = lip->li_ops->iop_committed (lip, commit_lsn); +if (lip->li_ops->iop_committed) + item_lsn = lip->li_ops->iop_committed (lip, commit_lsn); +else + item_lsn = commit_lsn;/* item_lsn of -1 means the item needs no further processing */ if (XFS_LSN_CMP (item_lsn, (xfs_lsn_t)-1 ) ==0 )
@@ -864,7 +871,8 @@ xfs_trans_committed_bulk(*/ if (aborted) {ASSERT (XFS_FORCED_SHUTDOWN (ailp->ail_mount)); - lip->li_ops->iop_unpin (lip,1 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,1 );continue ; }
@@ -882,7 +890,8 @@ xfs_trans_committed_bulk(xfs_trans_ail_update (ailp, lip, item_lsn); else spin_unlock(&ailp->ail_lock); - lip->li_ops->iop_unpin (lip,0 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,0 );continue ; }
fs/xfs/xfs_trans_ail.c +8 -0
@@ -347,6 +347,14 @@ xfsaild_push_item(if (XFS_TEST_ERROR (false, ailp->ail_mount,XFS_ERRTAG_LOG_ITEM_PIN ))return XFS_ITEM_PINNED ; +/* +* Consider the item pinned if a push callback is not defined so the +* caller will force the log. This should only happen for intent items +* as they are unpinned once the associated done item is committed to +* the on-disk log. +*/ +if (!lip->li_ops->iop_push) +return XFS_ITEM_PINNED ;return lip->li_ops->iop_push (lip, &ailp->ail_buf_list); }
Signature · 1 line
2.20.1
Re: [PATCH 03/20] xfs: don't require log items to implement optional methods
Quoted 4 lines · Christoph Hellwig
Just check if they are present first.
Signed-off-by Christoph Hellwig <[email protected]>---
Looks good, thanks for the comment update:
Quoted 986 lines
fs/xfs/xfs_bmap_item.c | 104 ------------------------------------- fs/xfs/xfs_buf_item.c | 8 --- fs/xfs/xfs_dquot_item.c | 98 ---------------------------------- fs/xfs/xfs_extfree_item.c | 104 ------------------------------------- fs/xfs/xfs_icreate_item.c | 28 ---------- fs/xfs/xfs_log_cil.c | 3 +- fs/xfs/xfs_refcount_item.c | 104 ------------------------------------- fs/xfs/xfs_rmap_item.c | 104 ------------------------------------- fs/xfs/xfs_trans.c | 21 +++++--- fs/xfs/xfs_trans_ail.c | 8 +++ 10 files changed, 25 insertions(+), 557 deletions(-)fs/xfs/xfs_bmap_item.c +0
-104@@ -95,15 +95,6 @@ xfs_bui_item_format( xfs_bui_log_format_sizeof(buip->bui_format.bui_nextents)); } -/* -* Pinning has no meaning for an bui item, so just return. -*/ -STATIC void -xfs_bui_item_pin ( -struct xfs_log_item *lip) -{ -} -/* * The unpin operation is the last place an BUI is manipulated in the log. It is * either inserted in the AIL or aborted in the event of a log I/O error. In @@ -122,21 +113,6 @@ xfs_bui_item_unpin(xfs_bui_release (buip); } -/* -* BUI items have no locking or pushing. However, since BUIs are pulled from -* the AIL when their corresponding BUDs are committed to disk, their situation -* is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller -* will eventually flush the log. This should help in getting the BUI out of -* the AIL. -*/ -STATIC uint -xfs_bui_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The BUI has been either committed or aborted if the transaction has been * cancelled. If the transaction was cancelled, an BUD isn't going to be @@ -150,44 +126,14 @@ xfs_bui_item_unlock(xfs_bui_release (BUI_ITEM (lip)); } -/* -* The BUI is logged only once and cannot be moved in the log, so simply return -* the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_bui_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - -/* -* The BUI dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_bui_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all bui log items. */ static const struct xfs_item_ops xfs_bui_item_ops = { .iop_size = xfs_bui_item_size, .iop_format = xfs_bui_item_format, - .iop_pin = xfs_bui_item_pin, .iop_unpin = xfs_bui_item_unpin, .iop_unlock = xfs_bui_item_unlock, - .iop_committed = xfs_bui_item_committed, - .iop_push = xfs_bui_item_push, - .iop_committing = xfs_bui_item_committing, };/* @@ -248,38 +194,6 @@ xfs_bud_item_format( sizeof(struct xfs_bud_log_format)); } -/* -* Pinning has no meaning for an bud item, so just return. -*/ -STATIC void -xfs_bud_item_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an bud item, unpinning does -* not either. -*/ -STATIC void -xfs_bud_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - -/* -* There isn't much you can do to push on an bud item. It is simply stuck -* waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_bud_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The BUD is either committed or aborted if the transaction is cancelled. If * the transaction is cancelled, drop our reference to the BUI and free the @@ -322,32 +236,14 @@ xfs_bud_item_committed(return (xfs_lsn_t)-1 ; } -/* -* The BUD dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_bud_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all bud log items. */ static const struct xfs_item_ops xfs_bud_item_ops = { .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, - .iop_pin = xfs_bud_item_pin, - .iop_unpin = xfs_bud_item_unpin, .iop_unlock = xfs_bud_item_unlock, .iop_committed = xfs_bud_item_committed, - .iop_push = xfs_bud_item_push, - .iop_committing = xfs_bud_item_committing, };/* fs/xfs/xfs_buf_item.c +0
-8@@ -671,13 +671,6 @@ xfs_buf_item_committed(return lsn; } -STATIC void -xfs_buf_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t commit_lsn) -{ -} -/* * This is the ops vector shared by all buf log items. */ @@ -689,7 +682,6 @@ static const struct xfs_item_ops xfs_buf_item_ops = { .iop_unlock = xfs_buf_item_unlock, .iop_committed = xfs_buf_item_committed, .iop_push = xfs_buf_item_push, - .iop_committing = xfs_buf_item_committing };STATIC intfs/xfs/xfs_dquot_item.c +0
-98@@ -94,18 +94,6 @@ xfs_qm_dquot_logitem_unpin(wake_up (&dqp->q_pinwait); } -STATIC xfs_lsn_t -xfs_qm_dquot_logitem_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -/* -* We always re-log the entire dquot when it becomes dirty, -* so, the latest copy _is_ the only one that matters. -*/ -return lsn; -} -/* * This is called to wait for the given dquot to be unpinned. * Most of these pin/unpin routines are plagiarized from inode code. @@ -232,18 +220,6 @@ xfs_qm_dquot_logitem_unlock(xfs_dqunlock (dqp); } -/* -* this needs to stamp an lsn into the dquot, I think. -* rpc's that look at user dquot's would then have to -* push on the dependency recorded in the dquot -*/ -STATIC void -xfs_qm_dquot_logitem_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector for dquots */ @@ -253,9 +229,7 @@ static const struct xfs_item_ops xfs_dquot_item_ops = { .iop_pin = xfs_qm_dquot_logitem_pin, .iop_unpin = xfs_qm_dquot_logitem_unpin, .iop_unlock = xfs_qm_dquot_logitem_unlock, - .iop_committed = xfs_qm_dquot_logitem_committed, .iop_push = xfs_qm_dquot_logitem_push, - .iop_committing = xfs_qm_dquot_logitem_committing, .iop_error = xfs_dquot_item_error };@@ -314,26 +288,6 @@ xfs_qm_qoff_logitem_format(xlog_finish_iovec (lv, vecp,sizeof (struct xfs_qoff_logitem )); } -/* -* Pinning has no meaning for an quotaoff item, so just return. -*/ -STATIC void -xfs_qm_qoff_logitem_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an quotaoff item, unpinning does -* not either. -*/ -STATIC void -xfs_qm_qoff_logitem_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} -/* * There isn't much you can do to push a quotaoff item. It is simply * stuck waiting for the log to be flushed to disk. @@ -346,28 +300,6 @@ xfs_qm_qoff_logitem_push(return XFS_ITEM_LOCKED ; } -/* -* Quotaoff items have no locking or pushing, so return failure -* so that the caller doesn't bother with us. -*/ -STATIC void -xfs_qm_qoff_logitem_unlock ( -struct xfs_log_item *lip) -{ -} - -/* -* The quotaoff-start-item is logged only once and cannot be moved in the log, -* so simply return the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_qm_qoff_logitem_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - STATIC xfs_lsn_t xfs_qm_qoffend_logitem_committed( struct xfs_log_item *lip,@@ -391,36 +323,11 @@ xfs_qm_qoffend_logitem_committed(return (xfs_lsn_t)-1 ; } -/* -* XXX rcc - don't know quite what to do with this. I think we can -* just ignore it. The only time that isn't the case is if we allow -* the client to somehow see that quotas have been turned off in which -* we can't allow that to get back until the quotaoff hits the disk. -* So how would that happen? Also, do we need different routines for -* quotaoff start and quotaoff end? I suspect the answer is yes but -* to be sure, I need to look at the recovery code and see how quota off -* recovery is handled (do we roll forward or back or do something else). -* If we roll forwards or backwards, then we need two separate routines, -* one that does nothing and one that stamps in the lsn that matters -* (truly makes the quotaoff irrevocable). If we do something else, -* then maybe we don't need two. -*/ -STATIC void -xfs_qm_qoff_logitem_committing ( -struct xfs_log_item *lip, -xfs_lsn_t commit_lsn) -{ -} -static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, - .iop_pin = xfs_qm_qoff_logitem_pin, - .iop_unpin = xfs_qm_qoff_logitem_unpin, - .iop_unlock = xfs_qm_qoff_logitem_unlock, .iop_committed = xfs_qm_qoffend_logitem_committed, .iop_push = xfs_qm_qoff_logitem_push, - .iop_committing = xfs_qm_qoff_logitem_committing };/* @@ -429,12 +336,7 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, - .iop_pin = xfs_qm_qoff_logitem_pin, - .iop_unpin = xfs_qm_qoff_logitem_unpin, - .iop_unlock = xfs_qm_qoff_logitem_unlock, - .iop_committed = xfs_qm_qoff_logitem_committed, .iop_push = xfs_qm_qoff_logitem_push, - .iop_committing = xfs_qm_qoff_logitem_committing };/* fs/xfs/xfs_extfree_item.c +0
-104@@ -106,15 +106,6 @@ xfs_efi_item_format( } -/* -* Pinning has no meaning for an efi item, so just return. -*/ -STATIC void -xfs_efi_item_pin ( -struct xfs_log_item *lip) -{ -} -/* * The unpin operation is the last place an EFI is manipulated in the log. It is * either inserted in the AIL or aborted in the event of a log I/O error. In @@ -132,21 +123,6 @@ xfs_efi_item_unpin(xfs_efi_release (efip); } -/* -* Efi items have no locking or pushing. However, since EFIs are pulled from -* the AIL when their corresponding EFDs are committed to disk, their situation -* is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller -* will eventually flush the log. This should help in getting the EFI out of -* the AIL. -*/ -STATIC uint -xfs_efi_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The EFI has been either committed or aborted if the transaction has been * cancelled. If the transaction was cancelled, an EFD isn't going to be @@ -160,44 +136,14 @@ xfs_efi_item_unlock(xfs_efi_release (EFI_ITEM (lip)); } -/* -* The EFI is logged only once and cannot be moved in the log, so simply return -* the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_efi_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - -/* -* The EFI dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_efi_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all efi log items. */ static const struct xfs_item_ops xfs_efi_item_ops = { .iop_size = xfs_efi_item_size, .iop_format = xfs_efi_item_format, - .iop_pin = xfs_efi_item_pin, .iop_unpin = xfs_efi_item_unpin, .iop_unlock = xfs_efi_item_unlock, - .iop_committed = xfs_efi_item_committed, - .iop_push = xfs_efi_item_push, - .iop_committing = xfs_efi_item_committing };@@ -348,38 +294,6 @@ xfs_efd_item_format( xfs_efd_item_sizeof(efdp)); } -/* -* Pinning has no meaning for an efd item, so just return. -*/ -STATIC void -xfs_efd_item_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an efd item, unpinning does -* not either. -*/ -STATIC void -xfs_efd_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - -/* -* There isn't much you can do to push on an efd item. It is simply stuck -* waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_efd_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The EFD is either committed or aborted if the transaction is cancelled. If * the transaction is cancelled, drop our reference to the EFI and free the EFD. @@ -421,32 +335,14 @@ xfs_efd_item_committed(return (xfs_lsn_t)-1 ; } -/* -* The EFD dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_efd_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all efd log items. */ static const struct xfs_item_ops xfs_efd_item_ops = { .iop_size = xfs_efd_item_size, .iop_format = xfs_efd_item_format, - .iop_pin = xfs_efd_item_pin, - .iop_unpin = xfs_efd_item_unpin, .iop_unlock = xfs_efd_item_unlock, .iop_committed = xfs_efd_item_committed, - .iop_push = xfs_efd_item_push, - .iop_committing = xfs_efd_item_committing };/* fs/xfs/xfs_icreate_item.c +0
-28@@ -56,23 +56,6 @@ xfs_icreate_item_format( sizeof(struct xfs_icreate_log)); } - -/* Pinning has no meaning for the create item, so just return. */ -STATIC void -xfs_icreate_item_pin ( -struct xfs_log_item *lip) -{ -} - - -/* pinning has no meaning for the create item, so just return. */ -STATIC void -xfs_icreate_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - STATIC voidxfs_icreate_item_unlock (struct xfs_log_item *lip)@@ -110,26 +93,15 @@ xfs_icreate_item_push(return XFS_ITEM_SUCCESS ; } -/* Ordered buffers do the dependency tracking here, so this does nothing. */ -STATIC void -xfs_icreate_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all buf log items. */ static const struct xfs_item_ops xfs_icreate_item_ops = { .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, - .iop_pin = xfs_icreate_item_pin, - .iop_unpin = xfs_icreate_item_unpin, .iop_push = xfs_icreate_item_push, .iop_unlock = xfs_icreate_item_unlock, .iop_committed = xfs_icreate_item_committed, - .iop_committing = xfs_icreate_item_committing, };fs/xfs/xfs_log_cil.c +2
-1@@ -246,7 +246,8 @@ xfs_cil_prepare_item(* shadow buffer, so update the the pointer to it appropriately. */ if (!old_lv) { - lv->lv_item->li_ops->iop_pin (lv->lv_item); +if (lv->lv_item->li_ops->iop_pin) + lv->lv_item->li_ops->iop_pin (lv->lv_item); lv->lv_item->li_lv_shadow =NULL ; }else if (old_lv != lv) {ASSERT (lv->lv_buf_len !=XFS_LOG_VEC_ORDERED );fs/xfs/xfs_refcount_item.c +0
-104@@ -94,15 +94,6 @@ xfs_cui_item_format( xfs_cui_log_format_sizeof(cuip->cui_format.cui_nextents)); } -/* -* Pinning has no meaning for an cui item, so just return. -*/ -STATIC void -xfs_cui_item_pin ( -struct xfs_log_item *lip) -{ -} -/* * The unpin operation is the last place an CUI is manipulated in the log. It is * either inserted in the AIL or aborted in the event of a log I/O error. In @@ -121,21 +112,6 @@ xfs_cui_item_unpin(xfs_cui_release (cuip); } -/* -* CUI items have no locking or pushing. However, since CUIs are pulled from -* the AIL when their corresponding CUDs are committed to disk, their situation -* is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller -* will eventually flush the log. This should help in getting the CUI out of -* the AIL. -*/ -STATIC uint -xfs_cui_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The CUI has been either committed or aborted if the transaction has been * cancelled. If the transaction was cancelled, an CUD isn't going to be @@ -149,44 +125,14 @@ xfs_cui_item_unlock(xfs_cui_release (CUI_ITEM (lip)); } -/* -* The CUI is logged only once and cannot be moved in the log, so simply return -* the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_cui_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - -/* -* The CUI dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_cui_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all cui log items. */ static const struct xfs_item_ops xfs_cui_item_ops = { .iop_size = xfs_cui_item_size, .iop_format = xfs_cui_item_format, - .iop_pin = xfs_cui_item_pin, .iop_unpin = xfs_cui_item_unpin, .iop_unlock = xfs_cui_item_unlock, - .iop_committed = xfs_cui_item_committed, - .iop_push = xfs_cui_item_push, - .iop_committing = xfs_cui_item_committing, };/* @@ -253,38 +199,6 @@ xfs_cud_item_format( sizeof(struct xfs_cud_log_format)); } -/* -* Pinning has no meaning for an cud item, so just return. -*/ -STATIC void -xfs_cud_item_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an cud item, unpinning does -* not either. -*/ -STATIC void -xfs_cud_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - -/* -* There isn't much you can do to push on an cud item. It is simply stuck -* waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_cud_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The CUD is either committed or aborted if the transaction is cancelled. If * the transaction is cancelled, drop our reference to the CUI and free the @@ -327,32 +241,14 @@ xfs_cud_item_committed(return (xfs_lsn_t)-1 ; } -/* -* The CUD dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_cud_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all cud log items. */ static const struct xfs_item_ops xfs_cud_item_ops = { .iop_size = xfs_cud_item_size, .iop_format = xfs_cud_item_format, - .iop_pin = xfs_cud_item_pin, - .iop_unpin = xfs_cud_item_unpin, .iop_unlock = xfs_cud_item_unlock, .iop_committed = xfs_cud_item_committed, - .iop_push = xfs_cud_item_push, - .iop_committing = xfs_cud_item_committing, };/* fs/xfs/xfs_rmap_item.c +0
-104@@ -93,15 +93,6 @@ xfs_rui_item_format( xfs_rui_log_format_sizeof(ruip->rui_format.rui_nextents)); } -/* -* Pinning has no meaning for an rui item, so just return. -*/ -STATIC void -xfs_rui_item_pin ( -struct xfs_log_item *lip) -{ -} -/* * The unpin operation is the last place an RUI is manipulated in the log. It is * either inserted in the AIL or aborted in the event of a log I/O error. In @@ -120,21 +111,6 @@ xfs_rui_item_unpin(xfs_rui_release (ruip); } -/* -* RUI items have no locking or pushing. However, since RUIs are pulled from -* the AIL when their corresponding RUDs are committed to disk, their situation -* is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller -* will eventually flush the log. This should help in getting the RUI out of -* the AIL. -*/ -STATIC uint -xfs_rui_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The RUI has been either committed or aborted if the transaction has been * cancelled. If the transaction was cancelled, an RUD isn't going to be @@ -148,44 +124,14 @@ xfs_rui_item_unlock(xfs_rui_release (RUI_ITEM (lip)); } -/* -* The RUI is logged only once and cannot be moved in the log, so simply return -* the lsn at which it's been logged. -*/ -STATIC xfs_lsn_t -xfs_rui_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -return lsn; -} - -/* -* The RUI dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_rui_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all rui log items. */ static const struct xfs_item_ops xfs_rui_item_ops = { .iop_size = xfs_rui_item_size, .iop_format = xfs_rui_item_format, - .iop_pin = xfs_rui_item_pin, .iop_unpin = xfs_rui_item_unpin, .iop_unlock = xfs_rui_item_unlock, - .iop_committed = xfs_rui_item_committed, - .iop_push = xfs_rui_item_push, - .iop_committing = xfs_rui_item_committing, };/* @@ -274,38 +220,6 @@ xfs_rud_item_format( sizeof(struct xfs_rud_log_format)); } -/* -* Pinning has no meaning for an rud item, so just return. -*/ -STATIC void -xfs_rud_item_pin ( -struct xfs_log_item *lip) -{ -} - -/* -* Since pinning has no meaning for an rud item, unpinning does -* not either. -*/ -STATIC void -xfs_rud_item_unpin ( -struct xfs_log_item *lip, -int remove) -{ -} - -/* -* There isn't much you can do to push on an rud item. It is simply stuck -* waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_rud_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_PINNED ; -} -/* * The RUD is either committed or aborted if the transaction is cancelled. If * the transaction is cancelled, drop our reference to the RUI and free the @@ -348,32 +262,14 @@ xfs_rud_item_committed(return (xfs_lsn_t)-1 ; } -/* -* The RUD dependency tracking op doesn't do squat. It can't because -* it doesn't know where the free extent is coming from. The dependency -* tracking has to be handled by the "enclosing" metadata object. For -* example, for inodes, the inode is locked throughout the extent freeing -* so the dependency should be recorded there. -*/ -STATIC void -xfs_rud_item_committing ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -} -/* * This is the ops vector shared by all rud log items. */ static const struct xfs_item_ops xfs_rud_item_ops = { .iop_size = xfs_rud_item_size, .iop_format = xfs_rud_item_format, - .iop_pin = xfs_rud_item_pin, - .iop_unpin = xfs_rud_item_unpin, .iop_unlock = xfs_rud_item_unlock, .iop_committed = xfs_rud_item_committed, - .iop_push = xfs_rud_item_push, - .iop_committing = xfs_rud_item_committing, };/* fs/xfs/xfs_trans.c +15
-6@@ -779,11 +779,14 @@ xfs_trans_free_items(list_for_each_entry_safe (lip, next, &tp->t_items, li_trans) {xfs_trans_del_item (lip); -if (commit_lsn !=NULLCOMMITLSN ) +if (commit_lsn !=NULLCOMMITLSN && + lip->li_ops->iop_committing) lip->li_ops->iop_committing (lip, commit_lsn);if (abort)set_bit (XFS_LI_ABORTED , &lip->li_flags); - lip->li_ops->iop_unlock (lip); + +if (lip->li_ops->iop_unlock) + lip->li_ops->iop_unlock (lip); } }@@ -804,7 +807,8 @@ xfs_log_item_batch_insert(for (i =0 ; i < nr_items; i++) {struct xfs_log_item *lip = log_items[i]; - lip->li_ops->iop_unpin (lip,0 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,0 ); } }@@ -852,7 +856,10 @@ xfs_trans_committed_bulk(if (aborted)set_bit (XFS_LI_ABORTED , &lip->li_flags); - item_lsn = lip->li_ops->iop_committed (lip, commit_lsn); +if (lip->li_ops->iop_committed) + item_lsn = lip->li_ops->iop_committed (lip, commit_lsn); +else + item_lsn = commit_lsn;/* item_lsn of -1 means the item needs no further processing */ if (XFS_LSN_CMP (item_lsn, (xfs_lsn_t)-1 ) ==0 )@@ -864,7 +871,8 @@ xfs_trans_committed_bulk(*/ if (aborted) {ASSERT (XFS_FORCED_SHUTDOWN (ailp->ail_mount)); - lip->li_ops->iop_unpin (lip,1 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,1 );continue ; }@@ -882,7 +890,8 @@ xfs_trans_committed_bulk(xfs_trans_ail_update (ailp, lip, item_lsn); else spin_unlock(&ailp->ail_lock); - lip->li_ops->iop_unpin (lip,0 ); +if (lip->li_ops->iop_unpin) + lip->li_ops->iop_unpin (lip,0 );continue ; }fs/xfs/xfs_trans_ail.c +8
-0@@ -347,6 +347,14 @@ xfsaild_push_item(if (XFS_TEST_ERROR (false, ailp->ail_mount,XFS_ERRTAG_LOG_ITEM_PIN ))return XFS_ITEM_PINNED ; +/* +* Consider the item pinned if a push callback is not defined so the +* caller will force the log. This should only happen for intent items +* as they are unpinned once the associated done item is committed to +* the on-disk log. +*/ +if (!lip->li_ops->iop_push) +return XFS_ITEM_PINNED ;return lip->li_ops->iop_push (lip, &ailp->ail_buf_list); }Signature · 1 line
2.20.1
PATCH 4/20 xfs: remove the dummy iop_push implementation for inode creation items
In reply to Christoph HellwigThis method should never be called, so don't waste code on it.
--- fs/xfs/xfs_icreate_item.c | 11 ----------- 1 file changed, 11 deletions(-)
fs/xfs/xfs_icreate_item.c +0 -11
@@ -83,23 +83,12 @@ xfs_icreate_item_committed(return (xfs_lsn_t)-1 ; } -/* item can never get into the AIL */ -STATIC uint -xfs_icreate_item_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -ASSERT (0 ); -return XFS_ITEM_SUCCESS ; -} -/* * This is the ops vector shared by all buf log items. */ static const struct xfs_item_ops xfs_icreate_item_ops = { .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, - .iop_push = xfs_icreate_item_push, .iop_unlock = xfs_icreate_item_unlock, .iop_committed = xfs_icreate_item_committed, };
Signature · 1 line
2.20.1
PATCH 5/20 xfs: remove the iop_push implementation for quota off items
In reply to Christoph HellwigIf we want to push the log to make progress on the items we'd need to return XFS_ITEM_PINNED instead of XFS_ITEM_LOCKED. Removing the method will do exactly that.
--- fs/xfs/xfs_dquot_item.c | 14 -------------- 1 file changed, 14 deletions(-)
fs/xfs/xfs_dquot_item.c +0 -14
@@ -288,18 +288,6 @@ xfs_qm_qoff_logitem_format(xlog_finish_iovec (lv, vecp,sizeof (struct xfs_qoff_logitem )); } -/* -* There isn't much you can do to push a quotaoff item. It is simply -* stuck waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_qm_qoff_logitem_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_LOCKED ; -} - STATIC xfs_lsn_t xfs_qm_qoffend_logitem_committed( struct xfs_log_item *lip,
@@ -327,7 +315,6 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, .iop_committed = xfs_qm_qoffend_logitem_committed, - .iop_push = xfs_qm_qoff_logitem_push, };/*
@@ -336,7 +323,6 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, - .iop_push = xfs_qm_qoff_logitem_push, };/*
Signature · 1 line
2.20.1
Re: [PATCH 05/20] xfs: remove the iop_push implementation for quota off items
Quoted 6 lines · Christoph Hellwig
If we want to push the log to make progress on the items we'd need to return
XFS_ITEM_PINNEDinstead ofXFS_ITEM_LOCKED. Removing the method will do exactly that.Signed-off-by Christoph Hellwig <[email protected]>---
Wasn't this one supposed to be dropped?
Brian
Quoted 45 lines
fs/xfs/xfs_dquot_item.c | 14 -------------- 1 file changed, 14 deletions(-)fs/xfs/xfs_dquot_item.c +0
-14@@ -288,18 +288,6 @@ xfs_qm_qoff_logitem_format(xlog_finish_iovec (lv, vecp,sizeof (struct xfs_qoff_logitem )); } -/* -* There isn't much you can do to push a quotaoff item. It is simply -* stuck waiting for the log to be flushed to disk. -*/ -STATIC uint -xfs_qm_qoff_logitem_push ( -struct xfs_log_item *lip, -struct list_head *buffer_list) -{ -return XFS_ITEM_LOCKED ; -} - STATIC xfs_lsn_t xfs_qm_qoffend_logitem_committed( struct xfs_log_item *lip,@@ -327,7 +315,6 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, .iop_committed = xfs_qm_qoffend_logitem_committed, - .iop_push = xfs_qm_qoff_logitem_push, };/* @@ -336,7 +323,6 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, - .iop_push = xfs_qm_qoff_logitem_push, };/* Signature · 1 line
2.20.1
Re: [PATCH 05/20] xfs: remove the iop_push implementation for quota off items
Quoted 9 lines · Brian Foster
Quoted 6 lines · Christoph Hellwig
If we want to push the log to make progress on the items we'd need to return
XFS_ITEM_PINNEDinstead ofXFS_ITEM_LOCKED. Removing the method will do exactly that.Signed-off-by Christoph Hellwig <[email protected]>---
Wasn't this one supposed to be dropped?
Yes, and I thought I did..
PATCH 6/20 xfs: don't use xfs_trans_free_items in the commit path
In reply to Christoph HellwigWhile commiting items looks very similar to freeing them on error it is a different operation, and they will diverge a bit soon.
Split out the commit case from xfs_trans_free_items, inline it into xfs_log_commit_cil and give it a separate trace point.
--- fs/xfs/xfs_log_cil.c | 13 ++++++++++--- fs/xfs/xfs_trace.h | 1 + fs/xfs/xfs_trans.c | 10 +++------- fs/xfs/xfs_trans_priv.h | 2 -- 4 files changed, 14 insertions(+), 12 deletions(-)
fs/xfs/xfs_log_cil.c +10 -3
@@ -985,6 +985,7 @@ xfs_log_commit_cil( {struct xlog *log = mp->m_log;struct xfs_cil *cil = log->l_cilp; +struct xfs_log_item *lip, *next;xfs_lsn_t xc_commit_lsn;/*
@@ -1009,7 +1010,7 @@ xfs_log_commit_cil(/* * Once all the items of the transaction have been copied to the CIL, -* the items can be unlocked and freed. +* the items can be unlocked and possibly freed. * * This needs to be done before we drop the CIL context lock because we * have to update state in the log items and unlock them before they go
@@ -1018,8 +1019,14 @@ xfs_log_commit_cil(* the log items. This affects (at least) processing of stale buffers, * inodes and EFIs. */ -xfs_trans_free_items (tp, xc_commit_lsn, false); - +trace_xfs_trans_commit_items (tp, _RET_IP_); +list_for_each_entry_safe (lip, next, &tp->t_items, li_trans) { +xfs_trans_del_item (lip); +if (lip->li_ops->iop_committing) + lip->li_ops->iop_committing (lip, xc_commit_lsn); +if (lip->li_ops->iop_unlock) + lip->li_ops->iop_unlock (lip); + }xlog_cil_push_background (log);up_read (&cil->xc_ctx_lock);
fs/xfs/xfs_trace.h +1 -0
@@ -3360,6 +3360,7 @@ DEFINE_TRANS_EVENT(xfs_trans_dup);DEFINE_TRANS_EVENT (xfs_trans_free);DEFINE_TRANS_EVENT (xfs_trans_roll);DEFINE_TRANS_EVENT (xfs_trans_add_item); +DEFINE_TRANS_EVENT (xfs_trans_commit_items);DEFINE_TRANS_EVENT (xfs_trans_free_items); TRACE_EVENT(xfs_iunlink_update_bucket,
fs/xfs/xfs_trans.c +3 -7
@@ -767,10 +767,9 @@ xfs_trans_del_item( }/* Detach and unlock all of the items in a transaction */ -void +static void xfs_trans_free_items (struct xfs_trans *tp, -xfs_lsn_t commit_lsn,bool abort) {struct xfs_log_item *lip, *next;
@@ -779,9 +778,6 @@ xfs_trans_free_items(list_for_each_entry_safe (lip, next, &tp->t_items, li_trans) {xfs_trans_del_item (lip); -if (commit_lsn !=NULLCOMMITLSN && - lip->li_ops->iop_committing) - lip->li_ops->iop_committing (lip, commit_lsn);if (abort)set_bit (XFS_LI_ABORTED , &lip->li_flags);
@@ -1007,7 +1003,7 @@ __xfs_trans_commit( tp->t_ticket =NULL ; }current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); -xfs_trans_free_items (tp,NULLCOMMITLSN , !!error); +xfs_trans_free_items (tp, !!error);xfs_trans_free (tp);XFS_STATS_INC (mp, xs_trans_empty);
@@ -1069,7 +1065,7 @@ xfs_trans_cancel(/* mark this thread as no longer being in a transaction */ current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); -xfs_trans_free_items (tp,NULLCOMMITLSN , dirty); +xfs_trans_free_items (tp, dirty);xfs_trans_free (tp); }
fs/xfs/xfs_trans_priv.h +0 -2
@@ -16,8 +16,6 @@ struct xfs_log_vec;void xfs_trans_init (struct xfs_mount *);void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *);void xfs_trans_del_item (struct xfs_log_item *); -void xfs_trans_free_items (struct xfs_trans *tp,xfs_lsn_t commit_lsn, -bool abort);void xfs_trans_unreserve_and_mod_sb (struct xfs_trans *tp); void xfs_trans_committed_bulk(struct xfs_ail *ailp, struct xfs_log_vec *lv,
Signature · 1 line
2.20.1
PATCH 7/20 xfs: split iop_unlock
In reply to Christoph HellwigThe iop_unlock method is called when comitting or cancelling a transaction. In the latter case, the transaction may or may not be aborted. While there is no known problem with the current code in practice, this implementation is limited in that any log item implementation that might want to differentiate between a commit and a cancellation must rely on the aborted state. The aborted bit is only set when the cancelled transaction is dirty, however. This means that there is no way to distinguish between a commit and a clean transaction cancellation.
For example, intent log items currently rely on this distinction. The log item is either transferred to the CIL on commit or released on transaction cancel. There is currently no possibility for a clean intent log item in a transaction, but if that state is ever introduced a cancel of such a transaction will immediately result in memory leaks of the associated log item(s). This is an interface deficiency and landmine.
To clean this up, replace the iop_unlock method with an iop_release method that is specific to transaction cancel. The existing iop_committing method occurs at the same time as iop_unlock in the commit path and there is no need for two separate callbacks here. Overload the iop_committing method with the current commit time iop_unlock implementations to eliminate the need for the latter and further simplify the interface.
--- fs/xfs/xfs_bmap_item.c | 17 +++++++---------- fs/xfs/xfs_buf_item.c | 15 ++++++++++++--- fs/xfs/xfs_dquot_item.c | 19 +++++++++++-------- fs/xfs/xfs_extfree_item.c | 17 +++++++---------- fs/xfs/xfs_icreate_item.c | 10 +++------- fs/xfs/xfs_inode_item.c | 11 ++++++----- fs/xfs/xfs_log_cil.c | 2 -- fs/xfs/xfs_refcount_item.c | 17 +++++++---------- fs/xfs/xfs_rmap_item.c | 17 +++++++---------- fs/xfs/xfs_trace.h | 2 +- fs/xfs/xfs_trans.c | 7 +++---- fs/xfs/xfs_trans.h | 4 ++-- fs/xfs/xfs_trans_buf.c | 2 +- 13 files changed, 67 insertions(+), 73 deletions(-)
fs/xfs/xfs_bmap_item.c +7 -10
@@ -119,11 +119,10 @@ xfs_bui_item_unpin(* constructed and thus we free the BUI here directly. */ STATIC void -xfs_bui_item_unlock ( +xfs_bui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_bui_release (BUI_ITEM (lip)); +xfs_bui_release (BUI_ITEM (lip)); }/*
@@ -133,7 +132,7 @@ static const struct xfs_item_ops xfs_bui_item_ops = { .iop_size = xfs_bui_item_size, .iop_format = xfs_bui_item_format, .iop_unpin = xfs_bui_item_unpin, - .iop_unlock = xfs_bui_item_unlock, + .iop_release = xfs_bui_item_release, };/*
@@ -200,15 +199,13 @@ xfs_bud_item_format(* BUD. */ STATIC void -xfs_bud_item_unlock ( +xfs_bud_item_release (struct xfs_log_item *lip) {struct xfs_bud_log_item *budp =BUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_bui_release (budp->bud_buip); -kmem_zone_free (xfs_bud_zone, budp); - } +xfs_bui_release (budp->bud_buip); +kmem_zone_free (xfs_bud_zone, budp); }/*
@@ -242,7 +239,7 @@ xfs_bud_item_committed(static const struct xfs_item_ops xfs_bud_item_ops = { .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, - .iop_unlock = xfs_bud_item_unlock, + .iop_release = xfs_bud_item_release, .iop_committed = xfs_bud_item_committed, };
fs/xfs/xfs_buf_item.c +12 -3
@@ -594,7 +594,7 @@ xfs_buf_item_put(* free the item. */ STATIC void -xfs_buf_item_unlock ( +xfs_buf_item_release (struct xfs_log_item *lip) {struct xfs_buf_log_item *bip =BUF_ITEM (lip);
@@ -609,7 +609,7 @@ xfs_buf_item_unlock( &lip->li_flags);#endif -trace_xfs_buf_item_unlock (bip); +trace_xfs_buf_item_release (bip);/* * The bli dirty state should match whether the blf has logged segments
@@ -639,6 +639,14 @@ xfs_buf_item_unlock(xfs_buf_relse (bp); } +STATIC void +xfs_buf_item_committing ( +struct xfs_log_item *lip, +xfs_lsn_t commit_lsn) +{ +return xfs_buf_item_release (lip); +} +/* * This is called to find out where the oldest active copy of the * buf log item in the on disk log resides now that the last log
@@ -679,7 +687,8 @@ static const struct xfs_item_ops xfs_buf_item_ops = { .iop_format = xfs_buf_item_format, .iop_pin = xfs_buf_item_pin, .iop_unpin = xfs_buf_item_unpin, - .iop_unlock = xfs_buf_item_unlock, + .iop_release = xfs_buf_item_release, + .iop_committing = xfs_buf_item_committing, .iop_committed = xfs_buf_item_committed, .iop_push = xfs_buf_item_push, };
fs/xfs/xfs_dquot_item.c +11 -8
@@ -197,14 +197,8 @@ xfs_qm_dquot_logitem_push(return rval; } -/* -* Unlock the dquot associated with the log item. -* Clear the fields of the dquot and dquot log item that -* are specific to the current transaction. If the -* hold flags is set, do not unlock the dquot. -*/ STATIC void -xfs_qm_dquot_logitem_unlock ( +xfs_qm_dquot_logitem_release (struct xfs_log_item *lip) {struct xfs_dquot *dqp =DQUOT_ITEM (lip)->qli_dquot;
@@ -220,6 +214,14 @@ xfs_qm_dquot_logitem_unlock(xfs_dqunlock (dqp); } +STATIC void +xfs_qm_dquot_logitem_committing ( +struct xfs_log_item *lip, +xfs_lsn_t commit_lsn) +{ +return xfs_qm_dquot_logitem_release (lip); +} +/* * This is the ops vector for dquots */
@@ -228,7 +230,8 @@ static const struct xfs_item_ops xfs_dquot_item_ops = { .iop_format = xfs_qm_dquot_logitem_format, .iop_pin = xfs_qm_dquot_logitem_pin, .iop_unpin = xfs_qm_dquot_logitem_unpin, - .iop_unlock = xfs_qm_dquot_logitem_unlock, + .iop_release = xfs_qm_dquot_logitem_release, + .iop_committing = xfs_qm_dquot_logitem_committing, .iop_push = xfs_qm_dquot_logitem_push, .iop_error = xfs_dquot_item_error };
fs/xfs/xfs_extfree_item.c +7 -10
@@ -129,11 +129,10 @@ xfs_efi_item_unpin(* constructed and thus we free the EFI here directly. */ STATIC void -xfs_efi_item_unlock ( +xfs_efi_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_efi_release (EFI_ITEM (lip)); +xfs_efi_release (EFI_ITEM (lip)); }/*
@@ -143,7 +142,7 @@ static const struct xfs_item_ops xfs_efi_item_ops = { .iop_size = xfs_efi_item_size, .iop_format = xfs_efi_item_format, .iop_unpin = xfs_efi_item_unpin, - .iop_unlock = xfs_efi_item_unlock, + .iop_release = xfs_efi_item_release, };
@@ -299,15 +298,13 @@ xfs_efd_item_format(* the transaction is cancelled, drop our reference to the EFI and free the EFD. */ STATIC void -xfs_efd_item_unlock ( +xfs_efd_item_release (struct xfs_log_item *lip) {struct xfs_efd_log_item *efdp =EFD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_efi_release (efdp->efd_efip); -xfs_efd_item_free (efdp); - } +xfs_efi_release (efdp->efd_efip); +xfs_efd_item_free (efdp); }/*
@@ -341,7 +338,7 @@ xfs_efd_item_committed(static const struct xfs_item_ops xfs_efd_item_ops = { .iop_size = xfs_efd_item_size, .iop_format = xfs_efd_item_format, - .iop_unlock = xfs_efd_item_unlock, + .iop_release = xfs_efd_item_release, .iop_committed = xfs_efd_item_committed, };
fs/xfs/xfs_icreate_item.c +3 -7
@@ -57,14 +57,10 @@ xfs_icreate_item_format( } STATIC void -xfs_icreate_item_unlock ( +xfs_icreate_item_release (struct xfs_log_item *lip) { -struct xfs_icreate_item *icp =ICR_ITEM (lip); - -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -kmem_zone_free (xfs_icreate_zone, icp); -return ; +kmem_zone_free (xfs_icreate_zone,ICR_ITEM (lip)); }/*
@@ -89,7 +85,7 @@ xfs_icreate_item_committed(static const struct xfs_item_ops xfs_icreate_item_ops = { .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, - .iop_unlock = xfs_icreate_item_unlock, + .iop_release = xfs_icreate_item_release, .iop_committed = xfs_icreate_item_committed, };
fs/xfs/xfs_inode_item.c +6 -5
@@ -565,7 +565,7 @@ xfs_inode_item_push(* Unlock the inode associated with the inode log item. */ STATIC void -xfs_inode_item_unlock ( +xfs_inode_item_release (struct xfs_log_item *lip) {struct xfs_inode_log_item *iip =INODE_ITEM (lip);
@@ -621,9 +621,10 @@ xfs_inode_item_committed( STATIC voidxfs_inode_item_committing (struct xfs_log_item *lip, -xfs_lsn_t lsn) +xfs_lsn_t commit_lsn) { -INODE_ITEM (lip)->ili_last_lsn = lsn; +INODE_ITEM (lip)->ili_last_lsn = commit_lsn; +return xfs_inode_item_release (lip); }/*
@@ -634,10 +635,10 @@ static const struct xfs_item_ops xfs_inode_item_ops = { .iop_format = xfs_inode_item_format, .iop_pin = xfs_inode_item_pin, .iop_unpin = xfs_inode_item_unpin, - .iop_unlock = xfs_inode_item_unlock, + .iop_release = xfs_inode_item_release, .iop_committed = xfs_inode_item_committed, .iop_push = xfs_inode_item_push, - .iop_committing = xfs_inode_item_committing, + .iop_committing = xfs_inode_item_committing, .iop_error = xfs_inode_item_error };
fs/xfs/xfs_log_cil.c +0 -2
@@ -1024,8 +1024,6 @@ xfs_log_commit_cil(xfs_trans_del_item (lip);if (lip->li_ops->iop_committing) lip->li_ops->iop_committing (lip, xc_commit_lsn); -if (lip->li_ops->iop_unlock) - lip->li_ops->iop_unlock (lip); }xlog_cil_push_background (log);
fs/xfs/xfs_refcount_item.c +7 -10
@@ -118,11 +118,10 @@ xfs_cui_item_unpin(* constructed and thus we free the CUI here directly. */ STATIC void -xfs_cui_item_unlock ( +xfs_cui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_cui_release (CUI_ITEM (lip)); +xfs_cui_release (CUI_ITEM (lip)); }/*
@@ -132,7 +131,7 @@ static const struct xfs_item_ops xfs_cui_item_ops = { .iop_size = xfs_cui_item_size, .iop_format = xfs_cui_item_format, .iop_unpin = xfs_cui_item_unpin, - .iop_unlock = xfs_cui_item_unlock, + .iop_release = xfs_cui_item_release, };/*
@@ -205,15 +204,13 @@ xfs_cud_item_format(* CUD. */ STATIC void -xfs_cud_item_unlock ( +xfs_cud_item_release (struct xfs_log_item *lip) {struct xfs_cud_log_item *cudp =CUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_cui_release (cudp->cud_cuip); -kmem_zone_free (xfs_cud_zone, cudp); - } +xfs_cui_release (cudp->cud_cuip); +kmem_zone_free (xfs_cud_zone, cudp); }/*
@@ -247,7 +244,7 @@ xfs_cud_item_committed(static const struct xfs_item_ops xfs_cud_item_ops = { .iop_size = xfs_cud_item_size, .iop_format = xfs_cud_item_format, - .iop_unlock = xfs_cud_item_unlock, + .iop_release = xfs_cud_item_release, .iop_committed = xfs_cud_item_committed, };
fs/xfs/xfs_rmap_item.c +7 -10
@@ -117,11 +117,10 @@ xfs_rui_item_unpin(* constructed and thus we free the RUI here directly. */ STATIC void -xfs_rui_item_unlock ( +xfs_rui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_rui_release (RUI_ITEM (lip)); +xfs_rui_release (RUI_ITEM (lip)); }/*
@@ -131,7 +130,7 @@ static const struct xfs_item_ops xfs_rui_item_ops = { .iop_size = xfs_rui_item_size, .iop_format = xfs_rui_item_format, .iop_unpin = xfs_rui_item_unpin, - .iop_unlock = xfs_rui_item_unlock, + .iop_release = xfs_rui_item_release, };/*
@@ -226,15 +225,13 @@ xfs_rud_item_format(* RUD. */ STATIC void -xfs_rud_item_unlock ( +xfs_rud_item_release (struct xfs_log_item *lip) {struct xfs_rud_log_item *rudp =RUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_rui_release (rudp->rud_ruip); -kmem_zone_free (xfs_rud_zone, rudp); - } +xfs_rui_release (rudp->rud_ruip); +kmem_zone_free (xfs_rud_zone, rudp); }/*
@@ -268,7 +265,7 @@ xfs_rud_item_committed(static const struct xfs_item_ops xfs_rud_item_ops = { .iop_size = xfs_rud_item_size, .iop_format = xfs_rud_item_format, - .iop_unlock = xfs_rud_item_unlock, + .iop_release = xfs_rud_item_release, .iop_committed = xfs_rud_item_committed, };
fs/xfs/xfs_trace.h +1 -1
@@ -475,7 +475,7 @@ DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_pin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin_stale); -DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unlock); +DEFINE_BUF_ITEM_EVENT (xfs_buf_item_release);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_committed);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_push);DEFINE_BUF_ITEM_EVENT (xfs_trans_get_buf);
fs/xfs/xfs_trans.c +3 -4
@@ -780,9 +780,8 @@ xfs_trans_free_items(xfs_trans_del_item (lip);if (abort)set_bit (XFS_LI_ABORTED , &lip->li_flags); - -if (lip->li_ops->iop_unlock) - lip->li_ops->iop_unlock (lip); +if (lip->li_ops->iop_release) + lip->li_ops->iop_release (lip); } }
@@ -815,7 +814,7 @@ xfs_log_item_batch_insert(* * If we are called with the aborted flag set, it is because a log write during * a CIL checkpoint commit has failed. In this case, all the items in the -* checkpoint have already gone through iop_committed and iop_unlock, which +* checkpoint have already gone through iop_committed and iop_committing, which * means that checkpoint commit abort handling is treated exactly the same * as an iclog write error even though we haven't started any IO yet. Hence in * this case all we need to do is iop_committed processing, followed by an
fs/xfs/xfs_trans.h +2 -2
@@ -72,9 +72,9 @@ struct xfs_item_ops {void (*iop_pin)(xfs_log_item_t *);void (*iop_unpin)(xfs_log_item_t *,int remove);uint (*iop_push)(struct xfs_log_item *,struct list_head *); -void (*iop_unlock)(xfs_log_item_t *); +void (*iop_committing)(struct xfs_log_item *,xfs_lsn_t commit_lsn); +void (*iop_release)(struct xfs_log_item *);xfs_lsn_t (*iop_committed)(xfs_log_item_t *,xfs_lsn_t ); -void (*iop_committing)(xfs_log_item_t *,xfs_lsn_t );void (*iop_error)(xfs_log_item_t *,xfs_buf_t *); };
fs/xfs/xfs_trans_buf.c +1 -1
@@ -428,7 +428,7 @@ xfs_trans_brelse(/* * Mark the buffer as not needing to be unlocked when the buf item's -* iop_unlock() routine is called. The buffer must already be locked +* iop_committing() routine is called. The buffer must already be locked * and associated with the given transaction. */ /* ARGSUSED */
Signature · 1 line
2.20.1
Re: [PATCH 07/20] xfs: split iop_unlock
Quoted 25 lines · Christoph Hellwig
The
iop_unlockmethod is called when comitting or cancelling a transaction. In the latter case, the transaction may or may not be aborted. While there is no known problem with the current code in practice, this implementation is limited in that any log item implementation that might want to differentiate between a commit and a cancellation must rely on the aborted state. The aborted bit is only set when the cancelled transaction is dirty, however. This means that there is no way to distinguish between a commit and a clean transaction cancellation.For example, intent log items currently rely on this distinction. The log item is either transferred to the CIL on commit or released on transaction cancel. There is currently no possibility for a clean intent log item in a transaction, but if that state is ever introduced a cancel of such a transaction will immediately result in memory leaks of the associated log item(s). This is an interface deficiency and landmine.
To clean this up, replace the
iop_unlockmethod with aniop_releasemethod that is specific to transaction cancel. The existingiop_committingmethod occurs at the same time asiop_unlockin the commit path and there is no need for two separate callbacks here. Overload theiop_committingmethod with the current commit timeiop_unlockimplementations to eliminate the need for the latter and further simplify the interface.
Quoted 2 lines
Signed-off-by Christoph Hellwig <[email protected]>---
Quoted 479 lines
fs/xfs/xfs_bmap_item.c | 17 +++++++---------- fs/xfs/xfs_buf_item.c | 15 ++++++++++++--- fs/xfs/xfs_dquot_item.c | 19 +++++++++++-------- fs/xfs/xfs_extfree_item.c | 17 +++++++---------- fs/xfs/xfs_icreate_item.c | 10 +++------- fs/xfs/xfs_inode_item.c | 11 ++++++----- fs/xfs/xfs_log_cil.c | 2 -- fs/xfs/xfs_refcount_item.c | 17 +++++++---------- fs/xfs/xfs_rmap_item.c | 17 +++++++---------- fs/xfs/xfs_trace.h | 2 +- fs/xfs/xfs_trans.c | 7 +++---- fs/xfs/xfs_trans.h | 4 ++-- fs/xfs/xfs_trans_buf.c | 2 +- 13 files changed, 67 insertions(+), 73 deletions(-)fs/xfs/xfs_bmap_item.c +7
-10@@ -119,11 +119,10 @@ xfs_bui_item_unpin(* constructed and thus we free the BUI here directly. */ STATIC void -xfs_bui_item_unlock ( +xfs_bui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_bui_release (BUI_ITEM (lip)); +xfs_bui_release (BUI_ITEM (lip)); }/* @@ -133,7 +132,7 @@ static const struct xfs_item_ops xfs_bui_item_ops = { .iop_size = xfs_bui_item_size, .iop_format = xfs_bui_item_format, .iop_unpin = xfs_bui_item_unpin, - .iop_unlock = xfs_bui_item_unlock, + .iop_release = xfs_bui_item_release, };/* @@ -200,15 +199,13 @@ xfs_bud_item_format(* BUD. */ STATIC void -xfs_bud_item_unlock ( +xfs_bud_item_release (struct xfs_log_item *lip) {struct xfs_bud_log_item *budp =BUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_bui_release (budp->bud_buip); -kmem_zone_free (xfs_bud_zone, budp); - } +xfs_bui_release (budp->bud_buip); +kmem_zone_free (xfs_bud_zone, budp); }/* @@ -242,7 +239,7 @@ xfs_bud_item_committed(static const struct xfs_item_ops xfs_bud_item_ops = { .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, - .iop_unlock = xfs_bud_item_unlock, + .iop_release = xfs_bud_item_release, .iop_committed = xfs_bud_item_committed, };fs/xfs/xfs_buf_item.c +12
-3@@ -594,7 +594,7 @@ xfs_buf_item_put(* free the item. */ STATIC void -xfs_buf_item_unlock ( +xfs_buf_item_release (struct xfs_log_item *lip) {struct xfs_buf_log_item *bip =BUF_ITEM (lip);@@ -609,7 +609,7 @@ xfs_buf_item_unlock( &lip->li_flags);#endif -trace_xfs_buf_item_unlock (bip); +trace_xfs_buf_item_release (bip);/* * The bli dirty state should match whether the blf has logged segments @@ -639,6 +639,14 @@ xfs_buf_item_unlock(xfs_buf_relse (bp); } +STATIC void +xfs_buf_item_committing ( +struct xfs_log_item *lip, +xfs_lsn_t commit_lsn) +{ +return xfs_buf_item_release (lip); +} +/* * This is called to find out where the oldest active copy of the * buf log item in the on disk log resides now that the last log @@ -679,7 +687,8 @@ static const struct xfs_item_ops xfs_buf_item_ops = { .iop_format = xfs_buf_item_format, .iop_pin = xfs_buf_item_pin, .iop_unpin = xfs_buf_item_unpin, - .iop_unlock = xfs_buf_item_unlock, + .iop_release = xfs_buf_item_release, + .iop_committing = xfs_buf_item_committing, .iop_committed = xfs_buf_item_committed, .iop_push = xfs_buf_item_push, };fs/xfs/xfs_dquot_item.c +11
-8@@ -197,14 +197,8 @@ xfs_qm_dquot_logitem_push(return rval; } -/* -* Unlock the dquot associated with the log item. -* Clear the fields of the dquot and dquot log item that -* are specific to the current transaction. If the -* hold flags is set, do not unlock the dquot. -*/ STATIC void -xfs_qm_dquot_logitem_unlock ( +xfs_qm_dquot_logitem_release (struct xfs_log_item *lip) {struct xfs_dquot *dqp =DQUOT_ITEM (lip)->qli_dquot;@@ -220,6 +214,14 @@ xfs_qm_dquot_logitem_unlock(xfs_dqunlock (dqp); } +STATIC void +xfs_qm_dquot_logitem_committing ( +struct xfs_log_item *lip, +xfs_lsn_t commit_lsn) +{ +return xfs_qm_dquot_logitem_release (lip); +} +/* * This is the ops vector for dquots */ @@ -228,7 +230,8 @@ static const struct xfs_item_ops xfs_dquot_item_ops = { .iop_format = xfs_qm_dquot_logitem_format, .iop_pin = xfs_qm_dquot_logitem_pin, .iop_unpin = xfs_qm_dquot_logitem_unpin, - .iop_unlock = xfs_qm_dquot_logitem_unlock, + .iop_release = xfs_qm_dquot_logitem_release, + .iop_committing = xfs_qm_dquot_logitem_committing, .iop_push = xfs_qm_dquot_logitem_push, .iop_error = xfs_dquot_item_error };fs/xfs/xfs_extfree_item.c +7
-10@@ -129,11 +129,10 @@ xfs_efi_item_unpin(* constructed and thus we free the EFI here directly. */ STATIC void -xfs_efi_item_unlock ( +xfs_efi_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_efi_release (EFI_ITEM (lip)); +xfs_efi_release (EFI_ITEM (lip)); }/* @@ -143,7 +142,7 @@ static const struct xfs_item_ops xfs_efi_item_ops = { .iop_size = xfs_efi_item_size, .iop_format = xfs_efi_item_format, .iop_unpin = xfs_efi_item_unpin, - .iop_unlock = xfs_efi_item_unlock, + .iop_release = xfs_efi_item_release, };@@ -299,15 +298,13 @@ xfs_efd_item_format(* the transaction is cancelled, drop our reference to the EFI and free the EFD. */ STATIC void -xfs_efd_item_unlock ( +xfs_efd_item_release (struct xfs_log_item *lip) {struct xfs_efd_log_item *efdp =EFD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_efi_release (efdp->efd_efip); -xfs_efd_item_free (efdp); - } +xfs_efi_release (efdp->efd_efip); +xfs_efd_item_free (efdp); }/* @@ -341,7 +338,7 @@ xfs_efd_item_committed(static const struct xfs_item_ops xfs_efd_item_ops = { .iop_size = xfs_efd_item_size, .iop_format = xfs_efd_item_format, - .iop_unlock = xfs_efd_item_unlock, + .iop_release = xfs_efd_item_release, .iop_committed = xfs_efd_item_committed, };fs/xfs/xfs_icreate_item.c +3
-7@@ -57,14 +57,10 @@ xfs_icreate_item_format( } STATIC void -xfs_icreate_item_unlock ( +xfs_icreate_item_release (struct xfs_log_item *lip) { -struct xfs_icreate_item *icp =ICR_ITEM (lip); - -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -kmem_zone_free (xfs_icreate_zone, icp); -return ; +kmem_zone_free (xfs_icreate_zone,ICR_ITEM (lip)); }/* @@ -89,7 +85,7 @@ xfs_icreate_item_committed(static const struct xfs_item_ops xfs_icreate_item_ops = { .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, - .iop_unlock = xfs_icreate_item_unlock, + .iop_release = xfs_icreate_item_release, .iop_committed = xfs_icreate_item_committed, };fs/xfs/xfs_inode_item.c +6
-5@@ -565,7 +565,7 @@ xfs_inode_item_push(* Unlock the inode associated with the inode log item. */ STATIC void -xfs_inode_item_unlock ( +xfs_inode_item_release (struct xfs_log_item *lip) {struct xfs_inode_log_item *iip =INODE_ITEM (lip);@@ -621,9 +621,10 @@ xfs_inode_item_committed( STATIC voidxfs_inode_item_committing (struct xfs_log_item *lip, -xfs_lsn_t lsn) +xfs_lsn_t commit_lsn) { -INODE_ITEM (lip)->ili_last_lsn = lsn; +INODE_ITEM (lip)->ili_last_lsn = commit_lsn; +return xfs_inode_item_release (lip); }/* @@ -634,10 +635,10 @@ static const struct xfs_item_ops xfs_inode_item_ops = { .iop_format = xfs_inode_item_format, .iop_pin = xfs_inode_item_pin, .iop_unpin = xfs_inode_item_unpin, - .iop_unlock = xfs_inode_item_unlock, + .iop_release = xfs_inode_item_release, .iop_committed = xfs_inode_item_committed, .iop_push = xfs_inode_item_push, - .iop_committing = xfs_inode_item_committing, + .iop_committing = xfs_inode_item_committing, .iop_error = xfs_inode_item_error };fs/xfs/xfs_log_cil.c +0
-2@@ -1024,8 +1024,6 @@ xfs_log_commit_cil(xfs_trans_del_item (lip);if (lip->li_ops->iop_committing) lip->li_ops->iop_committing (lip, xc_commit_lsn); -if (lip->li_ops->iop_unlock) - lip->li_ops->iop_unlock (lip); }xlog_cil_push_background (log);fs/xfs/xfs_refcount_item.c +7
-10@@ -118,11 +118,10 @@ xfs_cui_item_unpin(* constructed and thus we free the CUI here directly. */ STATIC void -xfs_cui_item_unlock ( +xfs_cui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_cui_release (CUI_ITEM (lip)); +xfs_cui_release (CUI_ITEM (lip)); }/* @@ -132,7 +131,7 @@ static const struct xfs_item_ops xfs_cui_item_ops = { .iop_size = xfs_cui_item_size, .iop_format = xfs_cui_item_format, .iop_unpin = xfs_cui_item_unpin, - .iop_unlock = xfs_cui_item_unlock, + .iop_release = xfs_cui_item_release, };/* @@ -205,15 +204,13 @@ xfs_cud_item_format(* CUD. */ STATIC void -xfs_cud_item_unlock ( +xfs_cud_item_release (struct xfs_log_item *lip) {struct xfs_cud_log_item *cudp =CUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_cui_release (cudp->cud_cuip); -kmem_zone_free (xfs_cud_zone, cudp); - } +xfs_cui_release (cudp->cud_cuip); +kmem_zone_free (xfs_cud_zone, cudp); }/* @@ -247,7 +244,7 @@ xfs_cud_item_committed(static const struct xfs_item_ops xfs_cud_item_ops = { .iop_size = xfs_cud_item_size, .iop_format = xfs_cud_item_format, - .iop_unlock = xfs_cud_item_unlock, + .iop_release = xfs_cud_item_release, .iop_committed = xfs_cud_item_committed, };fs/xfs/xfs_rmap_item.c +7
-10@@ -117,11 +117,10 @@ xfs_rui_item_unpin(* constructed and thus we free the RUI here directly. */ STATIC void -xfs_rui_item_unlock ( +xfs_rui_item_release (struct xfs_log_item *lip) { -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) -xfs_rui_release (RUI_ITEM (lip)); +xfs_rui_release (RUI_ITEM (lip)); }/* @@ -131,7 +130,7 @@ static const struct xfs_item_ops xfs_rui_item_ops = { .iop_size = xfs_rui_item_size, .iop_format = xfs_rui_item_format, .iop_unpin = xfs_rui_item_unpin, - .iop_unlock = xfs_rui_item_unlock, + .iop_release = xfs_rui_item_release, };/* @@ -226,15 +225,13 @@ xfs_rud_item_format(* RUD. */ STATIC void -xfs_rud_item_unlock ( +xfs_rud_item_release (struct xfs_log_item *lip) {struct xfs_rud_log_item *rudp =RUD_ITEM (lip); -if (test_bit (XFS_LI_ABORTED , &lip->li_flags)) { -xfs_rui_release (rudp->rud_ruip); -kmem_zone_free (xfs_rud_zone, rudp); - } +xfs_rui_release (rudp->rud_ruip); +kmem_zone_free (xfs_rud_zone, rudp); }/* @@ -268,7 +265,7 @@ xfs_rud_item_committed(static const struct xfs_item_ops xfs_rud_item_ops = { .iop_size = xfs_rud_item_size, .iop_format = xfs_rud_item_format, - .iop_unlock = xfs_rud_item_unlock, + .iop_release = xfs_rud_item_release, .iop_committed = xfs_rud_item_committed, };fs/xfs/xfs_trace.h +1
-1@@ -475,7 +475,7 @@ DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_pin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin_stale); -DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unlock); +DEFINE_BUF_ITEM_EVENT (xfs_buf_item_release);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_committed);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_push);DEFINE_BUF_ITEM_EVENT (xfs_trans_get_buf);fs/xfs/xfs_trans.c +3
-4@@ -780,9 +780,8 @@ xfs_trans_free_items(xfs_trans_del_item (lip);if (abort)set_bit (XFS_LI_ABORTED , &lip->li_flags); - -if (lip->li_ops->iop_unlock) - lip->li_ops->iop_unlock (lip); +if (lip->li_ops->iop_release) + lip->li_ops->iop_release (lip); } }@@ -815,7 +814,7 @@ xfs_log_item_batch_insert(* * If we are called with the aborted flag set, it is because a log write during * a CIL checkpoint commit has failed. In this case, all the items in the -* checkpoint have already gone through iop_committed and iop_unlock, which +* checkpoint have already gone through iop_committed and iop_committing, which * means that checkpoint commit abort handling is treated exactly the same * as an iclog write error even though we haven't started any IO yet. Hence in * this case all we need to do is iop_committed processing, followed by an fs/xfs/xfs_trans.h +2
-2@@ -72,9 +72,9 @@ struct xfs_item_ops {void (*iop_pin)(xfs_log_item_t *);void (*iop_unpin)(xfs_log_item_t *,int remove);uint (*iop_push)(struct xfs_log_item *,struct list_head *); -void (*iop_unlock)(xfs_log_item_t *); +void (*iop_committing)(struct xfs_log_item *,xfs_lsn_t commit_lsn); +void (*iop_release)(struct xfs_log_item *);xfs_lsn_t (*iop_committed)(xfs_log_item_t *,xfs_lsn_t ); -void (*iop_committing)(xfs_log_item_t *,xfs_lsn_t );void (*iop_error)(xfs_log_item_t *,xfs_buf_t *); };fs/xfs/xfs_trans_buf.c +1
-1@@ -428,7 +428,7 @@ xfs_trans_brelse(/* * Mark the buffer as not needing to be unlocked when the buf item's -* iop_unlock() routine is called. The buffer must already be locked +* iop_committing() routine is called. The buffer must already be locked * and associated with the given transaction. */ /* ARGSUSED */ Signature · 1 line
2.20.1
PATCH 8/20 xfs: add a flag to release log items on commit
In reply to Christoph HellwigWe have various items that are released from ->iop_comitting. Add a flag to just call ->iop_release from the commit path to avoid tons of boilerplate code.
--- fs/xfs/xfs_bmap_item.c | 27 +-------------------------- fs/xfs/xfs_extfree_item.c | 27 +-------------------------- fs/xfs/xfs_icreate_item.c | 18 +----------------- fs/xfs/xfs_refcount_item.c | 27 +-------------------------- fs/xfs/xfs_rmap_item.c | 27 +-------------------------- fs/xfs/xfs_trans.c | 6 ++++++ fs/xfs/xfs_trans.h | 7 +++++++ 7 files changed, 18 insertions(+), 121 deletions(-)
fs/xfs/xfs_bmap_item.c +1 -26
@@ -208,39 +208,14 @@ xfs_bud_item_release(kmem_zone_free (xfs_bud_zone, budp); } -/* -* When the bud item is committed to disk, all we need to do is delete our -* reference to our partner bui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_bud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_bud_log_item *budp =BUD_ITEM (lip); - -/* -* Drop the BUI reference regardless of whether the BUD has been -* aborted. Once the BUD transaction is constructed, it is the sole -* responsibility of the BUD to release the BUI (even if the BUI is -* aborted due to log I/O error). -*/ -xfs_bui_release (budp->bud_buip); -kmem_zone_free (xfs_bud_zone, budp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all bud log items. */ static const struct xfs_item_ops xfs_bud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, .iop_release = xfs_bud_item_release, - .iop_committed = xfs_bud_item_committed, };/*
fs/xfs/xfs_extfree_item.c +1 -26
@@ -307,39 +307,14 @@ xfs_efd_item_release(xfs_efd_item_free (efdp); } -/* -* When the efd item is committed to disk, all we need to do is delete our -* reference to our partner efi item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from further -* referencing this item. -*/ -STATIC xfs_lsn_t -xfs_efd_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_efd_log_item *efdp =EFD_ITEM (lip); - -/* -* Drop the EFI reference regardless of whether the EFD has been -* aborted. Once the EFD transaction is constructed, it is the sole -* responsibility of the EFD to release the EFI (even if the EFI is -* aborted due to log I/O error). -*/ -xfs_efi_release (efdp->efd_efip); -xfs_efd_item_free (efdp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all efd log items. */ static const struct xfs_item_ops xfs_efd_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_efd_item_size, .iop_format = xfs_efd_item_format, .iop_release = xfs_efd_item_release, - .iop_committed = xfs_efd_item_committed, };/*
fs/xfs/xfs_icreate_item.c +1 -17
@@ -63,30 +63,14 @@ xfs_icreate_item_release(kmem_zone_free (xfs_icreate_zone,ICR_ITEM (lip)); } -/* -* Because we have ordered buffers being tracked in the AIL for the inode -* creation, we don't need the create item after this. Hence we can free -* the log item and return -1 to tell the caller we're done with the item. -*/ -STATIC xfs_lsn_t -xfs_icreate_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_icreate_item *icp =ICR_ITEM (lip); - -kmem_zone_free (xfs_icreate_zone, icp); -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all buf log items. */ static const struct xfs_item_ops xfs_icreate_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, .iop_release = xfs_icreate_item_release, - .iop_committed = xfs_icreate_item_committed, };
fs/xfs/xfs_refcount_item.c +1 -26
@@ -213,39 +213,14 @@ xfs_cud_item_release(kmem_zone_free (xfs_cud_zone, cudp); } -/* -* When the cud item is committed to disk, all we need to do is delete our -* reference to our partner cui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_cud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_cud_log_item *cudp =CUD_ITEM (lip); - -/* -* Drop the CUI reference regardless of whether the CUD has been -* aborted. Once the CUD transaction is constructed, it is the sole -* responsibility of the CUD to release the CUI (even if the CUI is -* aborted due to log I/O error). -*/ -xfs_cui_release (cudp->cud_cuip); -kmem_zone_free (xfs_cud_zone, cudp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all cud log items. */ static const struct xfs_item_ops xfs_cud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_cud_item_size, .iop_format = xfs_cud_item_format, .iop_release = xfs_cud_item_release, - .iop_committed = xfs_cud_item_committed, };/*
fs/xfs/xfs_rmap_item.c +1 -26
@@ -234,39 +234,14 @@ xfs_rud_item_release(kmem_zone_free (xfs_rud_zone, rudp); } -/* -* When the rud item is committed to disk, all we need to do is delete our -* reference to our partner rui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_rud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_rud_log_item *rudp =RUD_ITEM (lip); - -/* -* Drop the RUI reference regardless of whether the RUD has been -* aborted. Once the RUD transaction is constructed, it is the sole -* responsibility of the RUD to release the RUI (even if the RUI is -* aborted due to log I/O error). -*/ -xfs_rui_release (rudp->rud_ruip); -kmem_zone_free (xfs_rud_zone, rudp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all rud log items. */ static const struct xfs_item_ops xfs_rud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_rud_item_size, .iop_format = xfs_rud_item_format, .iop_release = xfs_rud_item_release, - .iop_committed = xfs_rud_item_committed, };/*
fs/xfs/xfs_trans.c +6 -0
@@ -851,6 +851,12 @@ xfs_trans_committed_bulk(if (aborted)set_bit (XFS_LI_ABORTED , &lip->li_flags); + +if (lip->li_ops->flags &XFS_ITEM_RELEASE_WHEN_COMMITTED ) { + lip->li_ops->iop_release (lip); +continue ; + } +if (lip->li_ops->iop_committed) item_lsn = lip->li_ops->iop_committed (lip, commit_lsn);else
fs/xfs/xfs_trans.h +7 -0
@@ -67,6 +67,7 @@ typedef struct xfs_log_item { { (1 << XFS_LI_DIRTY), "DIRTY" }struct xfs_item_ops { +unsigned flags;void (*iop_size)(xfs_log_item_t *,int *,int *);void (*iop_format)(xfs_log_item_t *,struct xfs_log_vec *);void (*iop_pin)(xfs_log_item_t *);
@@ -78,6 +79,12 @@ struct xfs_item_ops {void (*iop_error)(xfs_log_item_t *,xfs_buf_t *); }; +/* +* Release the log item as soon as committed. This is for items just logging +* intents that never need to be written back in place. +*/ +#define XFS_ITEM_RELEASE_WHEN_COMMITTED (1 << 0) +void xfs_log_item_init (struct xfs_mount *mp,struct xfs_log_item *item,int type,const struct xfs_item_ops *ops);
Signature · 1 line
2.20.1
Re: [PATCH 08/20] xfs: add a flag to release log items on commit
Quoted 6 lines · Christoph Hellwig
We have various items that are released from ->iop_comitting. Add a flag to just call ->iop_release from the commit path to avoid tons of boilerplate code.
Signed-off-by Christoph Hellwig <[email protected]>---
FYI the commit log still refers to ->iop_committing() instead of ->iop_committed(). With that fixed up:
Quoted 270 lines
fs/xfs/xfs_bmap_item.c | 27 +-------------------------- fs/xfs/xfs_extfree_item.c | 27 +-------------------------- fs/xfs/xfs_icreate_item.c | 18 +----------------- fs/xfs/xfs_refcount_item.c | 27 +-------------------------- fs/xfs/xfs_rmap_item.c | 27 +-------------------------- fs/xfs/xfs_trans.c | 6 ++++++ fs/xfs/xfs_trans.h | 7 +++++++ 7 files changed, 18 insertions(+), 121 deletions(-)fs/xfs/xfs_bmap_item.c +1
-26@@ -208,39 +208,14 @@ xfs_bud_item_release(kmem_zone_free (xfs_bud_zone, budp); } -/* -* When the bud item is committed to disk, all we need to do is delete our -* reference to our partner bui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_bud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_bud_log_item *budp =BUD_ITEM (lip); - -/* -* Drop the BUI reference regardless of whether the BUD has been -* aborted. Once the BUD transaction is constructed, it is the sole -* responsibility of the BUD to release the BUI (even if the BUI is -* aborted due to log I/O error). -*/ -xfs_bui_release (budp->bud_buip); -kmem_zone_free (xfs_bud_zone, budp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all bud log items. */ static const struct xfs_item_ops xfs_bud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_bud_item_size, .iop_format = xfs_bud_item_format, .iop_release = xfs_bud_item_release, - .iop_committed = xfs_bud_item_committed, };/* fs/xfs/xfs_extfree_item.c +1
-26@@ -307,39 +307,14 @@ xfs_efd_item_release(xfs_efd_item_free (efdp); } -/* -* When the efd item is committed to disk, all we need to do is delete our -* reference to our partner efi item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from further -* referencing this item. -*/ -STATIC xfs_lsn_t -xfs_efd_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_efd_log_item *efdp =EFD_ITEM (lip); - -/* -* Drop the EFI reference regardless of whether the EFD has been -* aborted. Once the EFD transaction is constructed, it is the sole -* responsibility of the EFD to release the EFI (even if the EFI is -* aborted due to log I/O error). -*/ -xfs_efi_release (efdp->efd_efip); -xfs_efd_item_free (efdp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all efd log items. */ static const struct xfs_item_ops xfs_efd_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_efd_item_size, .iop_format = xfs_efd_item_format, .iop_release = xfs_efd_item_release, - .iop_committed = xfs_efd_item_committed, };/* fs/xfs/xfs_icreate_item.c +1
-17@@ -63,30 +63,14 @@ xfs_icreate_item_release(kmem_zone_free (xfs_icreate_zone,ICR_ITEM (lip)); } -/* -* Because we have ordered buffers being tracked in the AIL for the inode -* creation, we don't need the create item after this. Hence we can free -* the log item and return -1 to tell the caller we're done with the item. -*/ -STATIC xfs_lsn_t -xfs_icreate_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_icreate_item *icp =ICR_ITEM (lip); - -kmem_zone_free (xfs_icreate_zone, icp); -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all buf log items. */ static const struct xfs_item_ops xfs_icreate_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_icreate_item_size, .iop_format = xfs_icreate_item_format, .iop_release = xfs_icreate_item_release, - .iop_committed = xfs_icreate_item_committed, };fs/xfs/xfs_refcount_item.c +1
-26@@ -213,39 +213,14 @@ xfs_cud_item_release(kmem_zone_free (xfs_cud_zone, cudp); } -/* -* When the cud item is committed to disk, all we need to do is delete our -* reference to our partner cui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_cud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_cud_log_item *cudp =CUD_ITEM (lip); - -/* -* Drop the CUI reference regardless of whether the CUD has been -* aborted. Once the CUD transaction is constructed, it is the sole -* responsibility of the CUD to release the CUI (even if the CUI is -* aborted due to log I/O error). -*/ -xfs_cui_release (cudp->cud_cuip); -kmem_zone_free (xfs_cud_zone, cudp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all cud log items. */ static const struct xfs_item_ops xfs_cud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_cud_item_size, .iop_format = xfs_cud_item_format, .iop_release = xfs_cud_item_release, - .iop_committed = xfs_cud_item_committed, };/* fs/xfs/xfs_rmap_item.c +1
-26@@ -234,39 +234,14 @@ xfs_rud_item_release(kmem_zone_free (xfs_rud_zone, rudp); } -/* -* When the rud item is committed to disk, all we need to do is delete our -* reference to our partner rui item and then free ourselves. Since we're -* freeing ourselves we must return -1 to keep the transaction code from -* further referencing this item. -*/ -STATIC xfs_lsn_t -xfs_rud_item_committed ( -struct xfs_log_item *lip, -xfs_lsn_t lsn) -{ -struct xfs_rud_log_item *rudp =RUD_ITEM (lip); - -/* -* Drop the RUI reference regardless of whether the RUD has been -* aborted. Once the RUD transaction is constructed, it is the sole -* responsibility of the RUD to release the RUI (even if the RUI is -* aborted due to log I/O error). -*/ -xfs_rui_release (rudp->rud_ruip); -kmem_zone_free (xfs_rud_zone, rudp); - -return (xfs_lsn_t)-1 ; -} -/* * This is the ops vector shared by all rud log items. */ static const struct xfs_item_ops xfs_rud_item_ops = { + .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_rud_item_size, .iop_format = xfs_rud_item_format, .iop_release = xfs_rud_item_release, - .iop_committed = xfs_rud_item_committed, };/* fs/xfs/xfs_trans.c +6
-0@@ -851,6 +851,12 @@ xfs_trans_committed_bulk(if (aborted)set_bit (XFS_LI_ABORTED , &lip->li_flags); + +if (lip->li_ops->flags &XFS_ITEM_RELEASE_WHEN_COMMITTED ) { + lip->li_ops->iop_release (lip); +continue ; + } +if (lip->li_ops->iop_committed) item_lsn = lip->li_ops->iop_committed (lip, commit_lsn);else fs/xfs/xfs_trans.h +7
-0@@ -67,6 +67,7 @@ typedef struct xfs_log_item { { (1 << XFS_LI_DIRTY), "DIRTY" }struct xfs_item_ops { +unsigned flags;void (*iop_size)(xfs_log_item_t *,int *,int *);void (*iop_format)(xfs_log_item_t *,struct xfs_log_vec *);void (*iop_pin)(xfs_log_item_t *);@@ -78,6 +79,12 @@ struct xfs_item_ops {void (*iop_error)(xfs_log_item_t *,xfs_buf_t *); }; +/* +* Release the log item as soon as committed. This is for items just logging +* intents that never need to be written back in place. +*/ +#define XFS_ITEM_RELEASE_WHEN_COMMITTED (1 << 0) +void xfs_log_item_init (struct xfs_mount *mp,struct xfs_log_item *item,int type,const struct xfs_item_ops *ops);Signature · 1 line
2.20.1
PATCH 9/20 xfs: don't cast inode_log_items to get the log_item
In reply to Christoph HellwigThe cast is not type safe, and we can just dereference the first member instead to start with.
--- fs/xfs/xfs_inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_inode.c +2 -2
@@ -485,7 +485,7 @@ xfs_lock_inodes(*/ if (!try_lock) {for (j = (i -1 ); j >=0 && !try_lock; j--) { - lp = (xfs_log_item_t *)ips[j]->i_itemp; + lp = &ips[j]->i_itemp->ili_item;if (lp &&test_bit (XFS_LI_IN_AIL , &lp->li_flags)) try_lock++; }
@@ -585,7 +585,7 @@ xfs_lock_two_inodes(* the second lock. If we can't get it, we must release the first one * and try again. */ - lp = (xfs_log_item_t *)ip0->i_itemp; + lp = &ip0->i_itemp->ili_item;if (lp &&test_bit (XFS_LI_IN_AIL , &lp->li_flags)) {if (!xfs_ilock_nowait (ip1,xfs_lock_inumorder (ip1_mode,1 ))) {xfs_iunlock (ip0, ip0_mode);
Signature · 1 line
2.20.1
PATCH 10/20 xfs: remove the xfs_log_item_t typedef
In reply to Christoph Hellwig--- fs/xfs/xfs_buf_item.c | 6 +++--- fs/xfs/xfs_buf_item.h | 6 +++--- fs/xfs/xfs_dquot_item.h | 4 ++-- fs/xfs/xfs_extfree_item.h | 4 ++-- fs/xfs/xfs_inode.c | 12 +++++------ fs/xfs/xfs_inode_item.h | 2 +- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_trans.h | 16 +++++++------- fs/xfs/xfs_trans_ail.c | 44 +++++++++++++++++++-------------------- 9 files changed, 48 insertions(+), 48 deletions(-)
fs/xfs/xfs_buf_item.c +3 -3
@@ -981,9 +981,9 @@ xfs_buf_item_relse(*/ void xfs_buf_attach_iodone ( -xfs_buf_t *bp, -void (*cb)(xfs_buf_t *,xfs_log_item_t *), -xfs_log_item_t *lip) +struct xfs_buf *bp, +void (*cb)(struct xfs_buf *,struct xfs_log_item *), +struct xfs_log_item *lip) {ASSERT (xfs_buf_islocked (bp));
fs/xfs/xfs_buf_item.h +3 -3
@@ -39,7 +39,7 @@ struct xfs_buf_log_item;* locked, and which 128 byte chunks of the buffer are dirty. */ struct xfs_buf_log_item { -xfs_log_item_t bli_item;/* common item structure */ +struct xfs_log_item bli_item;/* common item structure */ struct xfs_buf *bli_buf;/* real buffer pointer */ unsigned int bli_flags;/* misc flags */ unsigned int bli_recur;/* lock recursion count */
@@ -55,8 +55,8 @@ bool xfs_buf_item_put(struct xfs_buf_log_item *);void xfs_buf_item_log (struct xfs_buf_log_item *,uint ,uint );bool xfs_buf_item_dirty_format (struct xfs_buf_log_item *);void xfs_buf_attach_iodone (struct xfs_buf *, -void (*)(struct xfs_buf *,xfs_log_item_t *), -xfs_log_item_t *); +void (*)(struct xfs_buf *,struct xfs_log_item *), +struct xfs_log_item *);void xfs_buf_iodone_callbacks (struct xfs_buf *);void xfs_buf_iodone (struct xfs_buf *,struct xfs_log_item *); bool xfs_buf_resubmit_failed_buffers(struct xfs_buf *,
fs/xfs/xfs_dquot_item.h +2 -2
@@ -12,13 +12,13 @@ struct xfs_mount;struct xfs_qoff_logitem ;typedef struct xfs_dq_logitem { -xfs_log_item_t qli_item;/* common portion */ +struct xfs_log_item qli_item;/* common portion */ struct xfs_dquot *qli_dquot;/* dquot ptr */ xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ }xfs_dq_logitem_t ;typedef struct xfs_qoff_logitem { -xfs_log_item_t qql_item;/* common portion */ +struct xfs_log_item qql_item;/* common portion */ struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ unsigned int qql_flags; }xfs_qoff_logitem_t ;
fs/xfs/xfs_extfree_item.h +2 -2
@@ -51,7 +51,7 @@ struct kmem_zone;* AIL, so at this point both the EFI and EFD are freed. */ typedef struct xfs_efi_log_item { - xfs_log_item_t efi_item; + struct xfs_log_item efi_item; atomic_t efi_refcount; atomic_t efi_next_extent; unsigned long efi_flags; /* misc flags */
@@ -64,7 +64,7 @@ typedef struct xfs_efi_log_item {* have been freed. */ typedef struct xfs_efd_log_item { - xfs_log_item_t efd_item; + struct xfs_log_item efd_item; xfs_efi_log_item_t *efd_efip; uint efd_next_extent; xfs_efd_log_format_t efd_format;
fs/xfs/xfs_inode.c +6 -6
@@ -441,12 +441,12 @@ xfs_lock_inumorder(int lock_mode, int subclass)*/ static void xfs_lock_inodes ( -xfs_inode_t **ips, -int inodes, -uint lock_mode) +struct xfs_inode **ips, +int inodes, +uint lock_mode) { -int attempts =0 , i, j, try_lock; -xfs_log_item_t *lp; +int attempts =0 , i, j, try_lock; +struct xfs_log_item *lp;/* * Currently supports between 2 and 5 inodes with exclusive locking. We
@@ -551,7 +551,7 @@ xfs_lock_two_inodes(struct xfs_inode *temp;uint mode_temp;int attempts =0 ; -xfs_log_item_t *lp; +struct xfs_log_item *lp;ASSERT (hweight32 (ip0_mode) ==1 );ASSERT (hweight32 (ip1_mode) ==1 );
fs/xfs/xfs_inode_item.h +1 -1
@@ -14,7 +14,7 @@ struct xfs_inode;struct xfs_mount ; typedef struct xfs_inode_log_item { - xfs_log_item_t ili_item; /* common portion */ + struct xfs_log_item ili_item; /* common portion */ struct xfs_inode *ili_inode; /* inode ptr */ xfs_lsn_t ili_flush_lsn; /* lsn at last flush */ xfs_lsn_t ili_last_lsn; /* lsn at last transaction */
fs/xfs/xfs_log_recover.c +1 -1
@@ -3385,7 +3385,7 @@ xlog_recover_efd_pass2( {xfs_efd_log_format_t *efd_formatp;xfs_efi_log_item_t *efip =NULL ; -xfs_log_item_t *lip; +struct xfs_log_item *lip;uint64_t efi_id;struct xfs_ail_cursor cur;struct xfs_ail *ailp = log->l_ailp;
fs/xfs/xfs_trans.h +8 -8
@@ -27,7 +27,7 @@ struct xfs_cud_log_item;struct xfs_bui_log_item ;struct xfs_bud_log_item ; -typedef struct xfs_log_item { +struct xfs_log_item {struct list_head li_ail;/* AIL pointers */ struct list_head li_trans;/* transaction list */ xfs_lsn_t li_lsn;/* last on-disk lsn */
@@ -48,7 +48,7 @@ typedef struct xfs_log_item {struct xfs_log_vec *li_lv;/* active log vector */ struct xfs_log_vec *li_lv_shadow;/* standby vector */ xfs_lsn_t li_seq;/* CIL commit seq */ -} xfs_log_item_t; +};/* * li_flags use the (set/test/clear)_bit atomic interfaces because updates can
@@ -68,15 +68,15 @@ typedef struct xfs_log_item {struct xfs_item_ops {unsigned flags; -void (*iop_size)(xfs_log_item_t *,int *,int *); -void (*iop_format)(xfs_log_item_t *,struct xfs_log_vec *); -void (*iop_pin)(xfs_log_item_t *); -void (*iop_unpin)(xfs_log_item_t *,int remove); +void (*iop_size)(struct xfs_log_item *,int *,int *); +void (*iop_format)(struct xfs_log_item *,struct xfs_log_vec *); +void (*iop_pin)(struct xfs_log_item *); +void (*iop_unpin)(struct xfs_log_item *,int remove);uint (*iop_push)(struct xfs_log_item *,struct list_head *);void (*iop_committing)(struct xfs_log_item *,xfs_lsn_t commit_lsn);void (*iop_release)(struct xfs_log_item *); -xfs_lsn_t (*iop_committed)(xfs_log_item_t *,xfs_lsn_t ); -void (*iop_error)(xfs_log_item_t *,xfs_buf_t *); +xfs_lsn_t (*iop_committed)(struct xfs_log_item *,xfs_lsn_t ); +void (*iop_error)(struct xfs_log_item *,xfs_buf_t *); };/*
fs/xfs/xfs_trans_ail.c +22 -22
123 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 11/20 xfs: use a list_head for iclog callbacks
In reply to Christoph HellwigReplace the hand grown linked list handling and cil context attachment with the standard list_head structure.
--- fs/xfs/xfs_log.c | 51 ++++++++----------------------------------- fs/xfs/xfs_log.h | 15 +++---------- fs/xfs/xfs_log_cil.c | 32 ++++++++++++++++++++------- fs/xfs/xfs_log_priv.h | 10 +++------ 4 files changed, 39 insertions(+), 69 deletions(-)
fs/xfs/xfs_log.c +9 -42
@@ -533,32 +533,6 @@ xfs_log_done(return lsn; } -/* -* Attaches a new iclog I/O completion callback routine during -* transaction commit. If the log is in error state, a non-zero -* return code is handed back and the caller is responsible for -* executing the callback at an appropriate time. -*/ -int -xfs_log_notify ( -struct xlog_in_core *iclog, -xfs_log_callback_t *cb) -{ -int abortflg; - -spin_lock (&iclog->ic_callback_lock); - abortflg = (iclog->ic_state &XLOG_STATE_IOERROR ); -if (!abortflg) { -ASSERT_ALWAYS ((iclog->ic_state ==XLOG_STATE_ACTIVE ) || - (iclog->ic_state ==XLOG_STATE_WANT_SYNC )); - cb->cb_next =NULL ; - *(iclog->ic_callback_tail) = cb; - iclog->ic_callback_tail = &(cb->cb_next); - } -spin_unlock (&iclog->ic_callback_lock); -return abortflg; -} - int xfs_log_release_iclog( struct xfs_mount *mp,
@@ -1474,7 +1448,7 @@ xlog_alloc_log( iclog->ic_log = log;atomic_set (&iclog->ic_refcnt,0 );spin_lock_init (&iclog->ic_callback_lock); - iclog->ic_callback_tail = &(iclog->ic_callback); +INIT_LIST_HEAD (&iclog->ic_callbacks); iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize;init_waitqueue_head (&iclog->ic_force_wait);
@@ -2546,7 +2520,7 @@ xlog_state_clean_log(if (iclog->ic_state ==XLOG_STATE_DIRTY ) { iclog->ic_state =XLOG_STATE_ACTIVE ; iclog->ic_offset =0 ; -ASSERT (iclog->ic_callback ==NULL ); +ASSERT (list_empty_careful (&iclog->ic_callbacks));/* * If the number of ops in this iclog indicate it just * contains the dummy transaction, we can
@@ -2642,7 +2616,6 @@ xlog_state_do_callback(xlog_in_core_t *iclog;xlog_in_core_t *first_iclog;/* used to know when we've * processed all iclogs once */ -xfs_log_callback_t *cb, *cb_next;int flushcnt =0 ;xfs_lsn_t lowest_lsn;int ioerrors;/* counter: iclogs with errors */
@@ -2753,7 +2726,7 @@ xlog_state_do_callback(*/ ASSERT (XFS_LSN_CMP (atomic64_read (&log->l_last_sync_lsn),be64_to_cpu (iclog->ic_header.h_lsn)) <=0 ); -if (iclog->ic_callback) +if (!list_empty_careful (&iclog->ic_callbacks))atomic64_set (&log->l_last_sync_lsn,be64_to_cpu (iclog->ic_header.h_lsn));
@@ -2770,26 +2743,20 @@ xlog_state_do_callback(* callbacks being added. */ spin_lock (&iclog->ic_callback_lock); - cb = iclog->ic_callback; -while (cb) { - iclog->ic_callback_tail = &(iclog->ic_callback); - iclog->ic_callback =NULL ; -spin_unlock (&iclog->ic_callback_lock); +while (!list_empty (&iclog->ic_callbacks)) { +LIST_HEAD (tmp); -/* perform callbacks in the order given */ -for (; cb; cb = cb_next) { - cb_next = cb->cb_next; - cb->cb_func (cb->cb_arg, aborted); - } +list_splice_init (&iclog->ic_callbacks, &tmp); + +spin_unlock (&iclog->ic_callback_lock); +xlog_cil_process_committed (&tmp, aborted);spin_lock (&iclog->ic_callback_lock); - cb = iclog->ic_callback; } loopdidcallbacks++; funcdidcallbacks++;spin_lock (&log->l_icloglock); -ASSERT (iclog->ic_callback ==NULL );spin_unlock (&iclog->ic_callback_lock);if (!(iclog->ic_state &XLOG_STATE_IOERROR )) iclog->ic_state =XLOG_STATE_DIRTY ;
fs/xfs/xfs_log.h +3 -12
@@ -6,6 +6,8 @@ #ifndef __XFS_LOG_H__ #define __XFS_LOG_H__ +struct xfs_cil_ctx; + struct xfs_log_vec { struct xfs_log_vec *lv_next; /* next lv in build list */ int lv_niovecs; /* number of iovecs in lv */
@@ -71,16 +73,6 @@ xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,return buf; } -/* -* Structure used to pass callback function and the function's argument -* to the log manager. -*/ -typedef struct xfs_log_callback { -struct xfs_log_callback *cb_next; -void (*cb_func)(void *,bool ); -void *cb_arg; -}xfs_log_callback_t ; -/* * By comparing each component, we don't have to worry about extra * endian issues in treating two 32 bit numbers as one 64 bit number
@@ -129,8 +121,6 @@ int xfs_log_mount_cancel(struct xfs_mount *);xfs_lsn_t xlog_assign_tail_lsn (struct xfs_mount *mp);xfs_lsn_t xlog_assign_tail_lsn_locked (struct xfs_mount *mp);void xfs_log_space_wake (struct xfs_mount *mp); -int xfs_log_notify (struct xlog_in_core *iclog, -struct xfs_log_callback *callback_entry);int xfs_log_release_iclog (struct xfs_mount *mp,struct xlog_in_core *iclog); int xfs_log_reserve(struct xfs_mount *mp,
@@ -148,6 +138,7 @@ void xfs_log_ticket_put(struct xlog_ticket *ticket);void xfs_log_commit_cil (struct xfs_mount *mp,struct xfs_trans *tp,xfs_lsn_t *commit_lsn,bool regrant); +void xlog_cil_process_committed (struct list_head *list,bool aborted);bool xfs_log_item_in_current_chkpt (struct xfs_log_item *lip);void xfs_log_work_queue (struct xfs_mount *mp);
fs/xfs/xfs_log_cil.c +24 -8
@@ -577,10 +577,9 @@ xlog_discard_busy_extents(*/ static void xlog_cil_committed ( -void *args, -bool abort) +struct xfs_cil_ctx *ctx, +bool abort) { -struct xfs_cil_ctx *ctx = args;struct xfs_mount *mp = ctx->cil->xc_log->l_mp;/*
@@ -615,6 +614,20 @@ xlog_cil_committed(kmem_free (ctx); } +void +xlog_cil_process_committed ( +struct list_head *list, +bool aborted) +{ +struct xfs_cil_ctx *ctx; + +while ((ctx =list_first_entry_or_null (list, + struct xfs_cil_ctx, iclog_entry))) { +list_del (&ctx->iclog_entry); +xlog_cil_committed (ctx, aborted); + } +} +/* * Push the Committed Item List to the log. If @push_seq flag is zero, then it * is a background flush and so we can chose to ignore it. Otherwise, if the
@@ -836,12 +849,15 @@ xlog_cil_push(if (commit_lsn ==-1 ) goto out_abort; -/* attach all the transactions w/ busy extents to iclog */ - ctx->log_cb.cb_func = xlog_cil_committed; - ctx->log_cb.cb_arg = ctx; - error =xfs_log_notify (commit_iclog, &ctx->log_cb); -if (error) +spin_lock (&commit_iclog->ic_callback_lock); +if (commit_iclog->ic_state &XLOG_STATE_IOERROR ) { +spin_unlock (&commit_iclog->ic_callback_lock); goto out_abort; + } +ASSERT_ALWAYS (commit_iclog->ic_state ==XLOG_STATE_ACTIVE || + commit_iclog->ic_state ==XLOG_STATE_WANT_SYNC ); +list_add_tail (&ctx->iclog_entry, &commit_iclog->ic_callbacks); +spin_unlock (&commit_iclog->ic_callback_lock);/* * now the checkpoint commit is complete and we've attached the
fs/xfs/xfs_log_priv.h +3 -7
@@ -10,7 +10,6 @@ struct xfs_buf;struct xlog ;struct xlog_ticket ;struct xfs_mount ; -struct xfs_log_callback ;/* * Flags for log structure
@@ -179,8 +178,6 @@ typedef struct xlog_ticket {* - ic_forcewait is used to implement synchronous forcing of the iclog to disk. * - ic_next is the pointer to the next iclog in the ring. * - ic_log is a pointer back to the global log structure. -* - ic_callback is a linked list of callback function/argument pairs to be -* called after an iclog finishes writing. * - ic_size is the full size of the log buffer, minus the cycle headers. * - ic_io_size is the size of the currently pending log buffer write, which * might be smaller than ic_size
@@ -193,7 +190,7 @@ typedef struct xlog_ticket {* structure cacheline aligned. The following fields can be contended on * by independent processes: * -* - ic_callback_* +* - ic_callbacks * - ic_refcnt * - fields protected by the global l_icloglock *
@@ -215,8 +212,7 @@ typedef struct xlog_in_core {/* Callback structures need their own cacheline */ spinlock_t ic_callback_lock____cacheline_aligned_in_smp ; -struct xfs_log_callback *ic_callback; -struct xfs_log_callback **ic_callback_tail; +struct list_head ic_callbacks;/* reference counts need their own cacheline */ atomic_t ic_refcnt____cacheline_aligned_in_smp ;
@@ -249,7 +245,7 @@ struct xfs_cil_ctx {int space_used;/* aggregate size of regions */ struct list_head busy_extents;/* busy extents in chkpt */ struct xfs_log_vec *lv_chain;/* logvecs being pushed */ -struct xfs_log_callback log_cb;/* completion callback hook. */ +struct list_head iclog_entry;struct list_head committing;/* ctx committing list */ struct work_struct discard_endio_work; };
Signature · 1 line
2.20.1
PATCH 12/20 xfs: remove a pointless comment duplicated above all xfs_item_ops instances
In reply to Christoph Hellwig--- fs/xfs/xfs_bmap_item.c | 6 ------ fs/xfs/xfs_buf_item.c | 3 --- fs/xfs/xfs_dquot_item.c | 6 ------ fs/xfs/xfs_extfree_item.c | 6 ------ fs/xfs/xfs_icreate_item.c | 3 --- fs/xfs/xfs_inode_item.c | 3 --- fs/xfs/xfs_refcount_item.c | 6 ------ fs/xfs/xfs_rmap_item.c | 6 ------ 8 files changed, 39 deletions(-)
fs/xfs/xfs_bmap_item.c +0 -6
@@ -125,9 +125,6 @@ xfs_bui_item_release(xfs_bui_release (BUI_ITEM (lip)); } -/* -* This is the ops vector shared by all bui log items. -*/ static const struct xfs_item_ops xfs_bui_item_ops = { .iop_size = xfs_bui_item_size, .iop_format = xfs_bui_item_format,
@@ -208,9 +205,6 @@ xfs_bud_item_release(kmem_zone_free (xfs_bud_zone, budp); } -/* -* This is the ops vector shared by all bud log items. -*/ static const struct xfs_item_ops xfs_bud_item_ops = { .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_bud_item_size,
fs/xfs/xfs_buf_item.c +0 -3
@@ -679,9 +679,6 @@ xfs_buf_item_committed(return lsn; } -/* -* This is the ops vector shared by all buf log items. -*/ static const struct xfs_item_ops xfs_buf_item_ops = { .iop_size = xfs_buf_item_size, .iop_format = xfs_buf_item_format,
fs/xfs/xfs_dquot_item.c +0 -6
@@ -222,9 +222,6 @@ xfs_qm_dquot_logitem_committing(return xfs_qm_dquot_logitem_release (lip); } -/* -* This is the ops vector for dquots -*/ static const struct xfs_item_ops xfs_dquot_item_ops = { .iop_size = xfs_qm_dquot_logitem_size, .iop_format = xfs_qm_dquot_logitem_format,
@@ -320,9 +317,6 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { .iop_committed = xfs_qm_qoffend_logitem_committed, }; -/* -* This is the ops vector shared by all quotaoff-start log items. -*/ static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format,
fs/xfs/xfs_extfree_item.c +0 -6
@@ -135,9 +135,6 @@ xfs_efi_item_release(xfs_efi_release (EFI_ITEM (lip)); } -/* -* This is the ops vector shared by all efi log items. -*/ static const struct xfs_item_ops xfs_efi_item_ops = { .iop_size = xfs_efi_item_size, .iop_format = xfs_efi_item_format,
@@ -307,9 +304,6 @@ xfs_efd_item_release(xfs_efd_item_free (efdp); } -/* -* This is the ops vector shared by all efd log items. -*/ static const struct xfs_item_ops xfs_efd_item_ops = { .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_efd_item_size,
fs/xfs/xfs_icreate_item.c +0 -3
@@ -63,9 +63,6 @@ xfs_icreate_item_release(kmem_zone_free (xfs_icreate_zone,ICR_ITEM (lip)); } -/* -* This is the ops vector shared by all buf log items. -*/ static const struct xfs_item_ops xfs_icreate_item_ops = { .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_icreate_item_size,
fs/xfs/xfs_inode_item.c +0 -3
@@ -627,9 +627,6 @@ xfs_inode_item_committing(return xfs_inode_item_release (lip); } -/* -* This is the ops vector shared by all buf log items. -*/ static const struct xfs_item_ops xfs_inode_item_ops = { .iop_size = xfs_inode_item_size, .iop_format = xfs_inode_item_format,
fs/xfs/xfs_refcount_item.c +0 -6
@@ -124,9 +124,6 @@ xfs_cui_item_release(xfs_cui_release (CUI_ITEM (lip)); } -/* -* This is the ops vector shared by all cui log items. -*/ static const struct xfs_item_ops xfs_cui_item_ops = { .iop_size = xfs_cui_item_size, .iop_format = xfs_cui_item_format,
@@ -213,9 +210,6 @@ xfs_cud_item_release(kmem_zone_free (xfs_cud_zone, cudp); } -/* -* This is the ops vector shared by all cud log items. -*/ static const struct xfs_item_ops xfs_cud_item_ops = { .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_cud_item_size,
fs/xfs/xfs_rmap_item.c +0 -6
@@ -123,9 +123,6 @@ xfs_rui_item_release(xfs_rui_release (RUI_ITEM (lip)); } -/* -* This is the ops vector shared by all rui log items. -*/ static const struct xfs_item_ops xfs_rui_item_ops = { .iop_size = xfs_rui_item_size, .iop_format = xfs_rui_item_format,
@@ -234,9 +231,6 @@ xfs_rud_item_release(kmem_zone_free (xfs_rud_zone, rudp); } -/* -* This is the ops vector shared by all rud log items. -*/ static const struct xfs_item_ops xfs_rud_item_ops = { .flags =XFS_ITEM_RELEASE_WHEN_COMMITTED , .iop_size = xfs_rud_item_size,
Signature · 1 line
2.20.1
PATCH 13/20 xfs: merge xfs_efd_init into xfs_trans_get_efd
In reply to Christoph HellwigThere is no good reason to keep these two functions separate.
--- fs/xfs/xfs_extfree_item.c | 27 +++++++++++++++------------ fs/xfs/xfs_extfree_item.h | 2 -- fs/xfs/xfs_trans_extfree.c | 26 -------------------------- 3 files changed, 15 insertions(+), 40 deletions(-)
fs/xfs/xfs_extfree_item.c +15 -12
@@ -312,32 +312,35 @@ static const struct xfs_item_ops xfs_efd_item_ops = { };/* -* Allocate and initialize an efd item with the given number of extents. +* Allocate an "extent free done" log item that will hold nextents worth of +* extents. The caller must use all nextents extents, because we are not +* flexible about this at all. */ struct xfs_efd_log_item * -xfs_efd_init ( -struct xfs_mount *mp, -struct xfs_efi_log_item *efip, -uint nextents) - +xfs_trans_get_efd ( +struct xfs_trans *tp, +struct xfs_efi_log_item *efip, +unsigned int nextents) { -struct xfs_efd_log_item *efdp; -uint size; +struct xfs_efd_log_item *efdp;ASSERT (nextents >0 ); +if (nextents >XFS_EFD_MAX_FAST_EXTENTS ) { - size = (uint)(sizeof (xfs_efd_log_item_t) + - ((nextents -1 ) *sizeof (xfs_extent_t))); - efdp =kmem_zalloc (size,KM_SLEEP ); + efdp =kmem_zalloc (sizeof (struct xfs_efd_log_item ) + + (nextents -1 ) *sizeof (struct xfs_extent ), +KM_SLEEP ); }else { efdp =kmem_zone_zalloc (xfs_efd_zone,KM_SLEEP ); } -xfs_log_item_init (mp, &efdp->efd_item,XFS_LI_EFD , &xfs_efd_item_ops); +xfs_log_item_init (tp->t_mountp, &efdp->efd_item,XFS_LI_EFD , + &xfs_efd_item_ops); efdp->efd_efip = efip; efdp->efd_format.efd_nextents = nextents; efdp->efd_format.efd_efi_id = efip->efi_format.efi_id; +xfs_trans_add_item (tp, &efdp->efd_item);return efdp; }
fs/xfs/xfs_extfree_item.h +0 -2
@@ -79,8 +79,6 @@ extern struct kmem_zone *xfs_efi_zone;extern struct kmem_zone *xfs_efd_zone;xfs_efi_log_item_t *xfs_efi_init (struct xfs_mount *,uint ); -xfs_efd_log_item_t *xfs_efd_init (struct xfs_mount *,xfs_efi_log_item_t *, -uint );int xfs_efi_copy_format (xfs_log_iovec_t *buf,xfs_efi_log_format_t *dst_efi_fmt);void xfs_efi_item_free (xfs_efi_log_item_t *);
fs/xfs/xfs_trans_extfree.c +0 -26
@@ -19,32 +19,6 @@#include "xfs_bmap.h" #include "xfs_trace.h" -/* -* This routine is called to allocate an "extent free done" -* log item that will hold nextents worth of extents. The -* caller must use all nextents extents, because we are not -* flexible about this at all. -*/ -struct xfs_efd_log_item * -xfs_trans_get_efd (struct xfs_trans *tp, -struct xfs_efi_log_item *efip, -uint nextents) -{ -struct xfs_efd_log_item *efdp; - -ASSERT (tp !=NULL ); -ASSERT (nextents >0 ); - - efdp =xfs_efd_init (tp->t_mountp, efip, nextents); -ASSERT (efdp !=NULL ); - -/* -* Get a log_item_desc to point at the new item. -*/ -xfs_trans_add_item (tp, &efdp->efd_item); -return efdp; -} -/* * Free an extent and log it to the EFD. Note that the transaction is marked * dirty regardless of whether the extent free succeeds or fails to support the
Signature · 1 line
2.20.1
PATCH 14/20 xfs: merge xfs_cud_init into xfs_trans_get_cud
In reply to Christoph HellwigThere is no good reason to keep these two functions separate.
--- fs/xfs/xfs_refcount_item.c | 14 ++++++-------- fs/xfs/xfs_refcount_item.h | 2 -- fs/xfs/xfs_trans_refcount.c | 16 ---------------- 3 files changed, 6 insertions(+), 26 deletions(-)
fs/xfs/xfs_refcount_item.c +6 -8
@@ -217,22 +217,20 @@ static const struct xfs_item_ops xfs_cud_item_ops = { .iop_release = xfs_cud_item_release, }; -/* -* Allocate and initialize an cud item with the given number of extents. -*/ struct xfs_cud_log_item * -xfs_cud_init ( -struct xfs_mount *mp, +xfs_trans_get_cud ( +struct xfs_trans *tp,struct xfs_cui_log_item *cuip) - { -struct xfs_cud_log_item *cudp; +struct xfs_cud_log_item *cudp; cudp =kmem_zone_zalloc (xfs_cud_zone,KM_SLEEP ); -xfs_log_item_init (mp, &cudp->cud_item,XFS_LI_CUD , &xfs_cud_item_ops); +xfs_log_item_init (tp->t_mountp, &cudp->cud_item,XFS_LI_CUD , + &xfs_cud_item_ops); cudp->cud_cuip = cuip; cudp->cud_format.cud_cui_id = cuip->cui_format.cui_id; +xfs_trans_add_item (tp, &cudp->cud_item);return cudp; }
fs/xfs/xfs_refcount_item.h +0 -2
@@ -78,8 +78,6 @@ extern struct kmem_zone *xfs_cui_zone;extern struct kmem_zone *xfs_cud_zone;struct xfs_cui_log_item *xfs_cui_init (struct xfs_mount *,uint ); -struct xfs_cud_log_item *xfs_cud_init (struct xfs_mount *, -struct xfs_cui_log_item *);void xfs_cui_item_free (struct xfs_cui_log_item *);void xfs_cui_release (struct xfs_cui_log_item *);int xfs_cui_recover (struct xfs_trans *parent_tp,struct xfs_cui_log_item *cuip);
fs/xfs/xfs_trans_refcount.c +0 -16
@@ -17,22 +17,6 @@#include "xfs_alloc.h" #include "xfs_refcount.h" -/* -* This routine is called to allocate a "refcount update done" -* log item. -*/ -struct xfs_cud_log_item * -xfs_trans_get_cud ( -struct xfs_trans *tp, -struct xfs_cui_log_item *cuip) -{ -struct xfs_cud_log_item *cudp; - - cudp =xfs_cud_init (tp->t_mountp, cuip); -xfs_trans_add_item (tp, &cudp->cud_item); -return cudp; -} -/* * Finish an refcount update and log it to the CUD. Note that the * transaction is marked dirty regardless of whether the refcount
Signature · 1 line
2.20.1
PATCH 15/20 xfs: merge xfs_rud_init into xfs_trans_get_rud
In reply to Christoph HellwigThere is no good reason to keep these two functions separate.
--- fs/xfs/xfs_rmap_item.c | 14 ++++++-------- fs/xfs/xfs_rmap_item.h | 2 -- fs/xfs/xfs_trans_rmap.c | 12 ------------ 3 files changed, 6 insertions(+), 22 deletions(-)
fs/xfs/xfs_rmap_item.c +6 -8
@@ -238,22 +238,20 @@ static const struct xfs_item_ops xfs_rud_item_ops = { .iop_release = xfs_rud_item_release, }; -/* -* Allocate and initialize an rud item with the given number of extents. -*/ struct xfs_rud_log_item * -xfs_rud_init ( -struct xfs_mount *mp, +xfs_trans_get_rud ( +struct xfs_trans *tp,struct xfs_rui_log_item *ruip) - { -struct xfs_rud_log_item *rudp; +struct xfs_rud_log_item *rudp; rudp =kmem_zone_zalloc (xfs_rud_zone,KM_SLEEP ); -xfs_log_item_init (mp, &rudp->rud_item,XFS_LI_RUD , &xfs_rud_item_ops); +xfs_log_item_init (tp->t_mountp, &rudp->rud_item,XFS_LI_RUD , + &xfs_rud_item_ops); rudp->rud_ruip = ruip; rudp->rud_format.rud_rui_id = ruip->rui_format.rui_id; +xfs_trans_add_item (tp, &rudp->rud_item);return rudp; }
fs/xfs/xfs_rmap_item.h +0 -2
@@ -78,8 +78,6 @@ extern struct kmem_zone *xfs_rui_zone;extern struct kmem_zone *xfs_rud_zone;struct xfs_rui_log_item *xfs_rui_init (struct xfs_mount *,uint ); -struct xfs_rud_log_item *xfs_rud_init (struct xfs_mount *, -struct xfs_rui_log_item *);int xfs_rui_copy_format (struct xfs_log_iovec *buf,struct xfs_rui_log_format *dst_rui_fmt);void xfs_rui_item_free (struct xfs_rui_log_item *);
fs/xfs/xfs_trans_rmap.c +0 -12
@@ -60,18 +60,6 @@ xfs_trans_set_rmap_flags( } } -struct xfs_rud_log_item * -xfs_trans_get_rud ( -struct xfs_trans *tp, -struct xfs_rui_log_item *ruip) -{ -struct xfs_rud_log_item *rudp; - - rudp =xfs_rud_init (tp->t_mountp, ruip); -xfs_trans_add_item (tp, &rudp->rud_item); -return rudp; -} -/* * Finish an rmap update and log it to the RUD. Note that the transaction is * marked dirty regardless of whether the rmap update succeeds or fails to
Signature · 1 line
2.20.1
PATCH 16/20 xfs: merge xfs_bud_init into xfs_trans_get_bud
In reply to Christoph HellwigThere is no good reason to keep these two functions separate.
--- fs/xfs/xfs_bmap_item.c | 14 ++++++-------- fs/xfs/xfs_bmap_item.h | 2 -- fs/xfs/xfs_trans_bmap.c | 16 ---------------- 3 files changed, 6 insertions(+), 26 deletions(-)
fs/xfs/xfs_bmap_item.c +6 -8
@@ -212,22 +212,20 @@ static const struct xfs_item_ops xfs_bud_item_ops = { .iop_release = xfs_bud_item_release, }; -/* -* Allocate and initialize an bud item with the given number of extents. -*/ struct xfs_bud_log_item * -xfs_bud_init ( -struct xfs_mount *mp, +xfs_trans_get_bud ( +struct xfs_trans *tp,struct xfs_bui_log_item *buip) - { -struct xfs_bud_log_item *budp; +struct xfs_bud_log_item *budp; budp =kmem_zone_zalloc (xfs_bud_zone,KM_SLEEP ); -xfs_log_item_init (mp, &budp->bud_item,XFS_LI_BUD , &xfs_bud_item_ops); +xfs_log_item_init (tp->t_mountp, &budp->bud_item,XFS_LI_BUD , + &xfs_bud_item_ops); budp->bud_buip = buip; budp->bud_format.bud_bui_id = buip->bui_format.bui_id; +xfs_trans_add_item (tp, &budp->bud_item);return budp; }
fs/xfs/xfs_bmap_item.h +0 -2
@@ -75,8 +75,6 @@ extern struct kmem_zone *xfs_bui_zone;extern struct kmem_zone *xfs_bud_zone;struct xfs_bui_log_item *xfs_bui_init (struct xfs_mount *); -struct xfs_bud_log_item *xfs_bud_init (struct xfs_mount *, -struct xfs_bui_log_item *);void xfs_bui_item_free (struct xfs_bui_log_item *);void xfs_bui_release (struct xfs_bui_log_item *);int xfs_bui_recover (struct xfs_trans *parent_tp,struct xfs_bui_log_item *buip);
fs/xfs/xfs_trans_bmap.c +0 -16
@@ -18,22 +18,6 @@#include "xfs_bmap.h" #include "xfs_inode.h" -/* -* This routine is called to allocate a "bmap update done" -* log item. -*/ -struct xfs_bud_log_item * -xfs_trans_get_bud ( -struct xfs_trans *tp, -struct xfs_bui_log_item *buip) -{ -struct xfs_bud_log_item *budp; - - budp =xfs_bud_init (tp->t_mountp, buip); -xfs_trans_add_item (tp, &budp->bud_item); -return budp; -} -/* * Finish an bmap update and log it to the BUD. Note that the * transaction is marked dirty regardless of whether the bmap update
Signature · 1 line
2.20.1
PATCH 17/20 xfs: merge xfs_trans_extfree.c into xfs_extfree_item.c
In reply to Christoph HellwigKeep all the extree item related code together in one file.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_extfree_item.c | 247 ++++++++++++++++++++++++++++++++++- fs/xfs/xfs_trans.h | 8 -- fs/xfs/xfs_trans_extfree.c | 260 ------------------------------------- 4 files changed, 246 insertions(+), 270 deletions(-) delete mode 100644 fs/xfs/xfs_trans_extfree.c
fs/xfs/Makefile +0 -1
@@ -107,7 +107,6 @@ xfs-y += xfs_log.o \ xfs_trans_ail.o \ xfs_trans_bmap.o \ xfs_trans_buf.o \ - xfs_trans_extfree.o \ xfs_trans_inode.o \ xfs_trans_refcount.o \ xfs_trans_rmap.o \
fs/xfs/xfs_extfree_item.c +246 -1
276 lines not on this page · raw message
fs/xfs/xfs_trans.h +0 -8
@@ -230,14 +230,6 @@ void xfs_trans_dirty_buf(struct xfs_trans *, struct xfs_buf *);bool xfs_trans_buf_is_dirty (struct xfs_buf *bp);void xfs_trans_log_inode (xfs_trans_t *,struct xfs_inode *,uint ); -struct xfs_efd_log_item *xfs_trans_get_efd (struct xfs_trans *, -struct xfs_efi_log_item *, -uint ); -int xfs_trans_free_extent (struct xfs_trans *, -struct xfs_efd_log_item *,xfs_fsblock_t , -xfs_extlen_t , -const struct xfs_owner_info *, -bool );int xfs_trans_commit (struct xfs_trans *);int xfs_trans_roll (struct xfs_trans **);int xfs_trans_roll_inode (struct xfs_trans **,struct xfs_inode *);
fs/xfs/xfs_trans_extfree.c deleted +0 -260
260 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 18/20 xfs: merge xfs_trans_refcount.c into xfs_refcount_item.c
In reply to Christoph HellwigKeep all the refcount item related code together in one file.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_refcount_item.c | 208 ++++++++++++++++++++++++++++++++- fs/xfs/xfs_trans.h | 11 -- fs/xfs/xfs_trans_refcount.c | 224 ------------------------------------ 4 files changed, 207 insertions(+), 237 deletions(-) delete mode 100644 fs/xfs/xfs_trans_refcount.c
fs/xfs/Makefile +0 -1
@@ -108,7 +108,6 @@ xfs-y += xfs_log.o \ xfs_trans_bmap.o \ xfs_trans_buf.o \ xfs_trans_inode.o \ - xfs_trans_refcount.o \ xfs_trans_rmap.o \ # optional features
fs/xfs/xfs_refcount_item.c +207 -1
220 lines not on this page · raw message
fs/xfs/xfs_trans.h +0 -11
@@ -255,17 +255,6 @@ int xfs_trans_log_finish_rmap_update(struct xfs_trans *tp, xfs_fsblock_t startblock, xfs_filblks_t blockcount, xfs_exntst_t state, struct xfs_btree_cur **pcur); -/* refcount updates */ -enum xfs_refcount_intent_type ; - -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, -enum xfs_refcount_intent_type type,xfs_fsblock_t startblock, -xfs_extlen_t blockcount,xfs_fsblock_t *new_fsb, -xfs_extlen_t *new_len,struct xfs_btree_cur **pcur); -/* mapping updates */ enum xfs_bmap_intent_type ;
fs/xfs/xfs_trans_refcount.c deleted +0 -224
224 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 19/20 xfs: merge xfs_trans_rmap.c into xfs_rmap_item.c
In reply to Christoph HellwigKeep all rmap item related code together in one file.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_rmap_item.c | 229 ++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_trans.h | 11 -- fs/xfs/xfs_trans_rmap.c | 245 ---------------------------------------- 4 files changed, 229 insertions(+), 259 deletions(-) delete mode 100644 fs/xfs/xfs_trans_rmap.c
fs/xfs/Makefile +1 -2
@@ -107,8 +107,7 @@ xfs-y += xfs_log.o \ xfs_trans_ail.o \ xfs_trans_bmap.o \ xfs_trans_buf.o \ - xfs_trans_inode.o \ - xfs_trans_rmap.o \ + xfs_trans_inode.o # optional features xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \
fs/xfs/xfs_rmap_item.c +228 -1
241 lines not on this page · raw message
fs/xfs/xfs_trans.h +0 -11
@@ -244,17 +244,6 @@ void xfs_trans_buf_copy_type(struct xfs_buf *dst_bp,extern kmem_zone_t *xfs_trans_zone; -/* rmap updates */ -enum xfs_rmap_intent_type ; - -struct xfs_rud_log_item *xfs_trans_get_rud (struct xfs_trans *tp, -struct xfs_rui_log_item *ruip); -int xfs_trans_log_finish_rmap_update (struct xfs_trans *tp, -struct xfs_rud_log_item *rudp,enum xfs_rmap_intent_type type, -uint64_t owner,int whichfork,xfs_fileoff_t startoff, -xfs_fsblock_t startblock,xfs_filblks_t blockcount, -xfs_exntst_t state,struct xfs_btree_cur **pcur); -/* mapping updates */ enum xfs_bmap_intent_type ;
fs/xfs/xfs_trans_rmap.c deleted +0 -245
245 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 20/20 xfs: merge xfs_trans_bmap.c into xfs_bmap_item.c
In reply to Christoph HellwigKeep all bmap item related code together.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_bmap_item.c | 200 ++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_trans.h | 11 -- fs/xfs/xfs_trans_bmap.c | 216 ---------------------------------------- 4 files changed, 199 insertions(+), 229 deletions(-) delete mode 100644 fs/xfs/xfs_trans_bmap.c
fs/xfs/Makefile +0 -1
@@ -105,7 +105,6 @@ xfs-y += xfs_log.o \ xfs_rmap_item.o \ xfs_log_recover.o \ xfs_trans_ail.o \ - xfs_trans_bmap.o \ xfs_trans_buf.o \ xfs_trans_inode.o
fs/xfs/xfs_bmap_item.c +199 -1
218 lines not on this page · raw message
fs/xfs/xfs_trans.h +0 -11
@@ -244,15 +244,4 @@ void xfs_trans_buf_copy_type(struct xfs_buf *dst_bp,extern kmem_zone_t *xfs_trans_zone; -/* mapping updates */ -enum xfs_bmap_intent_type ; - -struct xfs_bud_log_item *xfs_trans_get_bud (struct xfs_trans *tp, -struct xfs_bui_log_item *buip); -int xfs_trans_log_finish_bmap_update (struct xfs_trans *tp, -struct xfs_bud_log_item *rudp,enum xfs_bmap_intent_type type, -struct xfs_inode *ip,int whichfork,xfs_fileoff_t startoff, -xfs_fsblock_t startblock,xfs_filblks_t *blockcount, -xfs_exntst_t state); -#endif /* __XFS_TRANS_H__ */
fs/xfs/xfs_trans_bmap.c deleted +0 -216
216 lines not on this page · raw message
Signature · 1 line
2.20.1
Darrick J. Wong
Reviewed-byQuoted 14 lines · Christoph Hellwig
Hi all,
I've recently been trying to debug issue related to latencies related to locked buffers and went all over our log item lifecycles for that.
It turns out a lot of code in that area is rather obsfucated and redundant. This series is almost entirely cleanups, but there are lots of it. The only exception is a fix for systematic memory leaks which appears entirely theoretical.
Note that this series sits on top of the series titled
"use bios directly in the log code v4". To make everyones life easier a git tree is available here:
Quoted 5 lines
git://git.infradead.org/users/hch/xfs.gitxfs-log-item-cleanupGitweb:
http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/xfs-log-item-cleanup
Generally looks good enough for wider testing, so for patches 1-4 and 6-20...
--D
Quoted 8 lines
Changes since v1:
- improve a few commit messages
- add various comments
- minor code style fixes
- drop the patch to removeiop_pushedfrom the quotaoff item
- setXFS_LI_ABORTEDearlier inxfs_trans_committed_bulk