forked from luck/tmp_suning_uos_patched
xfs: factor log item initialisation
Each log item type does manual initialisation of the log item. Delayed logging introduces new fields that need initialisation, so factor all the open coded initialisation into a common function first. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
e2a07812e9
commit
43f5efc5b5
|
@ -357,9 +357,8 @@ xfs_qm_dquot_logitem_init(
|
|||
xfs_dq_logitem_t *lp;
|
||||
lp = &dqp->q_logitem;
|
||||
|
||||
lp->qli_item.li_type = XFS_LI_DQUOT;
|
||||
lp->qli_item.li_ops = &xfs_dquot_item_ops;
|
||||
lp->qli_item.li_mountp = dqp->q_mount;
|
||||
xfs_log_item_init(dqp->q_mount, &lp->qli_item, XFS_LI_DQUOT,
|
||||
&xfs_dquot_item_ops);
|
||||
lp->qli_dquot = dqp;
|
||||
lp->qli_format.qlf_type = XFS_LI_DQUOT;
|
||||
lp->qli_format.qlf_id = be32_to_cpu(dqp->q_core.d_id);
|
||||
|
@ -586,11 +585,8 @@ xfs_qm_qoff_logitem_init(
|
|||
|
||||
qf = (xfs_qoff_logitem_t*) kmem_zalloc(sizeof(xfs_qoff_logitem_t), KM_SLEEP);
|
||||
|
||||
qf->qql_item.li_type = XFS_LI_QUOTAOFF;
|
||||
if (start)
|
||||
qf->qql_item.li_ops = &xfs_qm_qoffend_logitem_ops;
|
||||
else
|
||||
qf->qql_item.li_ops = &xfs_qm_qoff_logitem_ops;
|
||||
xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ?
|
||||
&xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops);
|
||||
qf->qql_item.li_mountp = mp;
|
||||
qf->qql_format.qf_type = XFS_LI_QUOTAOFF;
|
||||
qf->qql_format.qf_flags = flags;
|
||||
|
|
|
@ -733,10 +733,7 @@ xfs_buf_item_init(
|
|||
|
||||
bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone,
|
||||
KM_SLEEP);
|
||||
bip->bli_item.li_type = XFS_LI_BUF;
|
||||
bip->bli_item.li_ops = &xfs_buf_item_ops;
|
||||
bip->bli_item.li_mountp = mp;
|
||||
bip->bli_item.li_ailp = mp->m_ail;
|
||||
xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops);
|
||||
bip->bli_buf = bp;
|
||||
xfs_buf_hold(bp);
|
||||
bip->bli_format.blf_type = XFS_LI_BUF;
|
||||
|
|
|
@ -259,10 +259,7 @@ xfs_efi_init(xfs_mount_t *mp,
|
|||
KM_SLEEP);
|
||||
}
|
||||
|
||||
efip->efi_item.li_type = XFS_LI_EFI;
|
||||
efip->efi_item.li_ops = &xfs_efi_item_ops;
|
||||
efip->efi_item.li_mountp = mp;
|
||||
efip->efi_item.li_ailp = mp->m_ail;
|
||||
xfs_log_item_init(mp, &efip->efi_item, XFS_LI_EFI, &xfs_efi_item_ops);
|
||||
efip->efi_format.efi_nextents = nextents;
|
||||
efip->efi_format.efi_id = (__psint_t)(void*)efip;
|
||||
|
||||
|
@ -554,10 +551,7 @@ xfs_efd_init(xfs_mount_t *mp,
|
|||
KM_SLEEP);
|
||||
}
|
||||
|
||||
efdp->efd_item.li_type = XFS_LI_EFD;
|
||||
efdp->efd_item.li_ops = &xfs_efd_item_ops;
|
||||
efdp->efd_item.li_mountp = mp;
|
||||
efdp->efd_item.li_ailp = mp->m_ail;
|
||||
xfs_log_item_init(mp, &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;
|
||||
|
|
|
@ -865,17 +865,9 @@ xfs_inode_item_init(
|
|||
ASSERT(ip->i_itemp == NULL);
|
||||
iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
|
||||
|
||||
iip->ili_item.li_type = XFS_LI_INODE;
|
||||
iip->ili_item.li_ops = &xfs_inode_item_ops;
|
||||
iip->ili_item.li_mountp = mp;
|
||||
iip->ili_item.li_ailp = mp->m_ail;
|
||||
iip->ili_inode = ip;
|
||||
|
||||
/*
|
||||
We have zeroed memory. No need ...
|
||||
iip->ili_extents_buf = NULL;
|
||||
*/
|
||||
|
||||
xfs_log_item_init(mp, &iip->ili_item, XFS_LI_INODE,
|
||||
&xfs_inode_item_ops);
|
||||
iip->ili_format.ilf_type = XFS_LI_INODE;
|
||||
iip->ili_format.ilf_ino = ip->i_ino;
|
||||
iip->ili_format.ilf_blkno = ip->i_imap.im_blkno;
|
||||
|
|
|
@ -648,6 +648,19 @@ xfs_log_unmount(xfs_mount_t *mp)
|
|||
xlog_dealloc_log(mp->m_log);
|
||||
}
|
||||
|
||||
void
|
||||
xfs_log_item_init(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_log_item *item,
|
||||
int type,
|
||||
struct xfs_item_ops *ops)
|
||||
{
|
||||
item->li_mountp = mp;
|
||||
item->li_ailp = mp->m_ail;
|
||||
item->li_type = type;
|
||||
item->li_ops = ops;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write region vectors to log. The write happens using the space reservation
|
||||
* of the ticket (tic). It is not a requirement that all writes for a given
|
||||
|
|
|
@ -126,6 +126,13 @@ typedef struct xfs_log_callback {
|
|||
struct xfs_mount;
|
||||
struct xlog_in_core;
|
||||
struct xlog_ticket;
|
||||
struct xfs_log_item;
|
||||
struct xfs_item_ops;
|
||||
|
||||
void xfs_log_item_init(struct xfs_mount *mp,
|
||||
struct xfs_log_item *item,
|
||||
int type,
|
||||
struct xfs_item_ops *ops);
|
||||
|
||||
xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
|
||||
struct xlog_ticket *ticket,
|
||||
|
|
Loading…
Reference in New Issue
Block a user