123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- #include "xfs.h"
- #include "xfs_fs.h"
- #include "xfs_shared.h"
- #include "xfs_format.h"
- #include "xfs_log_format.h"
- #include "xfs_trans_resv.h"
- #include "xfs_bit.h"
- #include "xfs_mount.h"
- #include "xfs_trans.h"
- #include "xfs_trans_priv.h"
- #include "xfs_error.h"
- #include "xfs_icreate_item.h"
- #include "xfs_log.h"
- kmem_zone_t *xfs_icreate_zone;
- static inline struct xfs_icreate_item *ICR_ITEM(struct xfs_log_item *lip)
- {
- return container_of(lip, struct xfs_icreate_item, ic_item);
- }
- STATIC void
- xfs_icreate_item_size(
- struct xfs_log_item *lip,
- int *nvecs,
- int *nbytes)
- {
- *nvecs += 1;
- *nbytes += sizeof(struct xfs_icreate_log);
- }
- STATIC void
- xfs_icreate_item_format(
- struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
- {
- struct xfs_icreate_item *icp = ICR_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ICREATE,
- &icp->ic_format,
- sizeof(struct xfs_icreate_log));
- }
- STATIC void
- xfs_icreate_item_pin(
- struct xfs_log_item *lip)
- {
- }
- STATIC void
- xfs_icreate_item_unpin(
- struct xfs_log_item *lip,
- int remove)
- {
- }
- STATIC void
- xfs_icreate_item_unlock(
- struct xfs_log_item *lip)
- {
- struct xfs_icreate_item *icp = ICR_ITEM(lip);
- if (icp->ic_item.li_flags & XFS_LI_ABORTED)
- kmem_zone_free(xfs_icreate_zone, icp);
- return;
- }
- 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;
- }
- STATIC uint
- xfs_icreate_item_push(
- struct xfs_log_item *lip,
- struct list_head *buffer_list)
- {
- ASSERT(0);
- return XFS_ITEM_SUCCESS;
- }
- STATIC void
- xfs_icreate_item_committing(
- struct xfs_log_item *lip,
- xfs_lsn_t lsn)
- {
- }
- static 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,
- };
- void
- xfs_icreate_log(
- struct xfs_trans *tp,
- xfs_agnumber_t agno,
- xfs_agblock_t agbno,
- unsigned int count,
- unsigned int inode_size,
- xfs_agblock_t length,
- unsigned int generation)
- {
- struct xfs_icreate_item *icp;
- icp = kmem_zone_zalloc(xfs_icreate_zone, KM_SLEEP);
- xfs_log_item_init(tp->t_mountp, &icp->ic_item, XFS_LI_ICREATE,
- &xfs_icreate_item_ops);
- icp->ic_format.icl_type = XFS_LI_ICREATE;
- icp->ic_format.icl_size = 1;
- icp->ic_format.icl_ag = cpu_to_be32(agno);
- icp->ic_format.icl_agbno = cpu_to_be32(agbno);
- icp->ic_format.icl_count = cpu_to_be32(count);
- icp->ic_format.icl_isize = cpu_to_be32(inode_size);
- icp->ic_format.icl_length = cpu_to_be32(length);
- icp->ic_format.icl_gen = cpu_to_be32(generation);
- xfs_trans_add_item(tp, &icp->ic_item);
- tp->t_flags |= XFS_TRANS_DIRTY;
- icp->ic_item.li_desc->lid_flags |= XFS_LID_DIRTY;
- }
|