This source file includes following definitions.
- ICR_ITEM
- xfs_icreate_item_size
- xfs_icreate_item_format
- xfs_icreate_item_release
- xfs_icreate_log
1
2
3
4
5
6 #include "xfs.h"
7 #include "xfs_fs.h"
8 #include "xfs_shared.h"
9 #include "xfs_log_format.h"
10 #include "xfs_trans.h"
11 #include "xfs_trans_priv.h"
12 #include "xfs_icreate_item.h"
13 #include "xfs_log.h"
14
15 kmem_zone_t *xfs_icreate_zone;
16
17 static inline struct xfs_icreate_item *ICR_ITEM(struct xfs_log_item *lip)
18 {
19 return container_of(lip, struct xfs_icreate_item, ic_item);
20 }
21
22
23
24
25
26
27 STATIC void
28 xfs_icreate_item_size(
29 struct xfs_log_item *lip,
30 int *nvecs,
31 int *nbytes)
32 {
33 *nvecs += 1;
34 *nbytes += sizeof(struct xfs_icreate_log);
35 }
36
37
38
39
40
41 STATIC void
42 xfs_icreate_item_format(
43 struct xfs_log_item *lip,
44 struct xfs_log_vec *lv)
45 {
46 struct xfs_icreate_item *icp = ICR_ITEM(lip);
47 struct xfs_log_iovec *vecp = NULL;
48
49 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ICREATE,
50 &icp->ic_format,
51 sizeof(struct xfs_icreate_log));
52 }
53
54 STATIC void
55 xfs_icreate_item_release(
56 struct xfs_log_item *lip)
57 {
58 kmem_zone_free(xfs_icreate_zone, ICR_ITEM(lip));
59 }
60
61 static const struct xfs_item_ops xfs_icreate_item_ops = {
62 .flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
63 .iop_size = xfs_icreate_item_size,
64 .iop_format = xfs_icreate_item_format,
65 .iop_release = xfs_icreate_item_release,
66 };
67
68
69
70
71
72
73
74
75
76
77
78
79
80 void
81 xfs_icreate_log(
82 struct xfs_trans *tp,
83 xfs_agnumber_t agno,
84 xfs_agblock_t agbno,
85 unsigned int count,
86 unsigned int inode_size,
87 xfs_agblock_t length,
88 unsigned int generation)
89 {
90 struct xfs_icreate_item *icp;
91
92 icp = kmem_zone_zalloc(xfs_icreate_zone, 0);
93
94 xfs_log_item_init(tp->t_mountp, &icp->ic_item, XFS_LI_ICREATE,
95 &xfs_icreate_item_ops);
96
97 icp->ic_format.icl_type = XFS_LI_ICREATE;
98 icp->ic_format.icl_size = 1;
99 icp->ic_format.icl_ag = cpu_to_be32(agno);
100 icp->ic_format.icl_agbno = cpu_to_be32(agbno);
101 icp->ic_format.icl_count = cpu_to_be32(count);
102 icp->ic_format.icl_isize = cpu_to_be32(inode_size);
103 icp->ic_format.icl_length = cpu_to_be32(length);
104 icp->ic_format.icl_gen = cpu_to_be32(generation);
105
106 xfs_trans_add_item(tp, &icp->ic_item);
107 tp->t_flags |= XFS_TRANS_DIRTY;
108 set_bit(XFS_LI_DIRTY, &icp->ic_item.li_flags);
109 }