aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans.h
diff options
context:
space:
mode:
authorBarry Naujok <bnaujok@sgi.com>2008-10-30 02:05:38 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:05:38 -0400
commit847fff5ca881670ca8ec617afeb943950f0c804b (patch)
treecd03cf7a3422842978332a22de51c91827821841 /fs/xfs/xfs_trans.h
parent24ee0e49c9cce23acb1758728cb09e8d2b53bd33 (diff)
[XFS] Sync up kernel and user-space headers
SGI-PV: 986558 SGI-Modid: xfs-linux-melb:xfs-kern:32231a Signed-off-by: Barry Naujok <bnaujok@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans.h')
-rw-r--r--fs/xfs/xfs_trans.h317
1 files changed, 156 insertions, 161 deletions
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 74c80bd2b0ec..1d89d50a5b99 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -18,6 +18,8 @@
18#ifndef __XFS_TRANS_H__ 18#ifndef __XFS_TRANS_H__
19#define __XFS_TRANS_H__ 19#define __XFS_TRANS_H__
20 20
21struct xfs_log_item;
22
21/* 23/*
22 * This is the structure written in the log at the head of 24 * This is the structure written in the log at the head of
23 * every transaction. It identifies the type and id of the 25 * every transaction. It identifies the type and id of the
@@ -98,76 +100,6 @@ typedef struct xfs_trans_header {
98#define XFS_TRANS_TYPE_MAX 41 100#define XFS_TRANS_TYPE_MAX 41
99/* new transaction types need to be reflected in xfs_logprint(8) */ 101/* new transaction types need to be reflected in xfs_logprint(8) */
100 102
101
102#ifdef __KERNEL__
103struct xfs_buf;
104struct xfs_buftarg;
105struct xfs_efd_log_item;
106struct xfs_efi_log_item;
107struct xfs_inode;
108struct xfs_item_ops;
109struct xfs_log_iovec;
110struct xfs_log_item;
111struct xfs_log_item_desc;
112struct xfs_mount;
113struct xfs_trans;
114struct xfs_dquot_acct;
115
116typedef struct xfs_log_item {
117 struct list_head li_ail; /* AIL pointers */
118 xfs_lsn_t li_lsn; /* last on-disk lsn */
119 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
120 struct xfs_mount *li_mountp; /* ptr to fs mount */
121 uint li_type; /* item type */
122 uint li_flags; /* misc flags */
123 struct xfs_log_item *li_bio_list; /* buffer item list */
124 void (*li_cb)(struct xfs_buf *,
125 struct xfs_log_item *);
126 /* buffer item iodone */
127 /* callback func */
128 struct xfs_item_ops *li_ops; /* function list */
129} xfs_log_item_t;
130
131#define XFS_LI_IN_AIL 0x1
132#define XFS_LI_ABORTED 0x2
133
134typedef struct xfs_item_ops {
135 uint (*iop_size)(xfs_log_item_t *);
136 void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
137 void (*iop_pin)(xfs_log_item_t *);
138 void (*iop_unpin)(xfs_log_item_t *, int);
139 void (*iop_unpin_remove)(xfs_log_item_t *, struct xfs_trans *);
140 uint (*iop_trylock)(xfs_log_item_t *);
141 void (*iop_unlock)(xfs_log_item_t *);
142 xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
143 void (*iop_push)(xfs_log_item_t *);
144 void (*iop_pushbuf)(xfs_log_item_t *);
145 void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
146} xfs_item_ops_t;
147
148#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
149#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
150#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
151#define IOP_UNPIN(ip, flags) (*(ip)->li_ops->iop_unpin)(ip, flags)
152#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
153#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
154#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
155#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
156#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
157#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
158#define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)
159
160/*
161 * Return values for the IOP_TRYLOCK() routines.
162 */
163#define XFS_ITEM_SUCCESS 0
164#define XFS_ITEM_PINNED 1
165#define XFS_ITEM_LOCKED 2
166#define XFS_ITEM_FLUSHING 3
167#define XFS_ITEM_PUSHBUF 4
168
169#endif /* __KERNEL__ */
170
171/* 103/*
172 * This structure is used to track log items associated with 104 * This structure is used to track log items associated with
173 * a transaction. It points to the log item and keeps some 105 * a transaction. It points to the log item and keeps some
@@ -176,7 +108,7 @@ typedef struct xfs_item_ops {
176 * once we get to commit processing (see xfs_trans_commit()). 108 * once we get to commit processing (see xfs_trans_commit()).
177 */ 109 */
178typedef struct xfs_log_item_desc { 110typedef struct xfs_log_item_desc {
179 xfs_log_item_t *lid_item; 111 struct xfs_log_item *lid_item;
180 ushort lid_size; 112 ushort lid_size;
181 unsigned char lid_flags; 113 unsigned char lid_flags;
182 unsigned char lid_index; 114 unsigned char lid_index;
@@ -276,94 +208,6 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
276 (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs)); 208 (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs));
277} 209}
278 210
279#ifdef __KERNEL__
280/*
281 * This structure is used to maintain a list of block ranges that have been
282 * freed in the transaction. The ranges are listed in the perag[] busy list
283 * between when they're freed and the transaction is committed to disk.
284 */
285
286typedef struct xfs_log_busy_slot {
287 xfs_agnumber_t lbc_ag;
288 ushort lbc_idx; /* index in perag.busy[] */
289} xfs_log_busy_slot_t;
290
291#define XFS_LBC_NUM_SLOTS 31
292typedef struct xfs_log_busy_chunk {
293 struct xfs_log_busy_chunk *lbc_next;
294 uint lbc_free; /* free slots bitmask */
295 ushort lbc_unused; /* first unused */
296 xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
297} xfs_log_busy_chunk_t;
298
299#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1)
300#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1)
301
302#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK)
303#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot)))
304#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)]))
305#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK)
306#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot)))
307
308/*
309 * This is the type of function which can be given to xfs_trans_callback()
310 * to be called upon the transaction's commit to disk.
311 */
312typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
313
314/*
315 * This is the structure maintained for every active transaction.
316 */
317typedef struct xfs_trans {
318 unsigned int t_magic; /* magic number */
319 xfs_log_callback_t t_logcb; /* log callback struct */
320 unsigned int t_type; /* transaction type */
321 unsigned int t_log_res; /* amt of log space resvd */
322 unsigned int t_log_count; /* count for perm log res */
323 unsigned int t_blk_res; /* # of blocks resvd */
324 unsigned int t_blk_res_used; /* # of resvd blocks used */
325 unsigned int t_rtx_res; /* # of rt extents resvd */
326 unsigned int t_rtx_res_used; /* # of resvd rt extents used */
327 xfs_log_ticket_t t_ticket; /* log mgr ticket */
328 xfs_lsn_t t_lsn; /* log seq num of start of
329 * transaction. */
330 xfs_lsn_t t_commit_lsn; /* log seq num of end of
331 * transaction. */
332 struct xfs_mount *t_mountp; /* ptr to fs mount struct */
333 struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */
334 xfs_trans_callback_t t_callback; /* transaction callback */
335 void *t_callarg; /* callback arg */
336 unsigned int t_flags; /* misc flags */
337 int64_t t_icount_delta; /* superblock icount change */
338 int64_t t_ifree_delta; /* superblock ifree change */
339 int64_t t_fdblocks_delta; /* superblock fdblocks chg */
340 int64_t t_res_fdblocks_delta; /* on-disk only chg */
341 int64_t t_frextents_delta;/* superblock freextents chg*/
342 int64_t t_res_frextents_delta; /* on-disk only chg */
343#ifdef DEBUG
344 int64_t t_ag_freeblks_delta; /* debugging counter */
345 int64_t t_ag_flist_delta; /* debugging counter */
346 int64_t t_ag_btree_delta; /* debugging counter */
347#endif
348 int64_t t_dblocks_delta;/* superblock dblocks change */
349 int64_t t_agcount_delta;/* superblock agcount change */
350 int64_t t_imaxpct_delta;/* superblock imaxpct change */
351 int64_t t_rextsize_delta;/* superblock rextsize chg */
352 int64_t t_rbmblocks_delta;/* superblock rbmblocks chg */
353 int64_t t_rblocks_delta;/* superblock rblocks change */
354 int64_t t_rextents_delta;/* superblocks rextents chg */
355 int64_t t_rextslog_delta;/* superblocks rextslog chg */
356 unsigned int t_items_free; /* log item descs free */
357 xfs_log_item_chunk_t t_items; /* first log item desc chunk */
358 xfs_trans_header_t t_header; /* header for in-log trans */
359 unsigned int t_busy_free; /* busy descs free */
360 xfs_log_busy_chunk_t t_busy; /* busy/async free blocks */
361 unsigned long t_pflags; /* saved process flags state */
362} xfs_trans_t;
363
364#endif /* __KERNEL__ */
365
366
367#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ 211#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
368/* 212/*
369 * Values for t_flags. 213 * Values for t_flags.
@@ -906,6 +750,156 @@ typedef struct xfs_trans {
906#define XFS_DQUOT_REF 1 750#define XFS_DQUOT_REF 1
907 751
908#ifdef __KERNEL__ 752#ifdef __KERNEL__
753
754struct xfs_buf;
755struct xfs_buftarg;
756struct xfs_efd_log_item;
757struct xfs_efi_log_item;
758struct xfs_inode;
759struct xfs_item_ops;
760struct xfs_log_iovec;
761struct xfs_log_item_desc;
762struct xfs_mount;
763struct xfs_trans;
764struct xfs_dquot_acct;
765
766typedef struct xfs_log_item {
767 struct list_head li_ail; /* AIL pointers */
768 xfs_lsn_t li_lsn; /* last on-disk lsn */
769 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
770 struct xfs_mount *li_mountp; /* ptr to fs mount */
771 uint li_type; /* item type */
772 uint li_flags; /* misc flags */
773 struct xfs_log_item *li_bio_list; /* buffer item list */
774 void (*li_cb)(struct xfs_buf *,
775 struct xfs_log_item *);
776 /* buffer item iodone */
777 /* callback func */
778 struct xfs_item_ops *li_ops; /* function list */
779} xfs_log_item_t;
780
781#define XFS_LI_IN_AIL 0x1
782#define XFS_LI_ABORTED 0x2
783
784typedef struct xfs_item_ops {
785 uint (*iop_size)(xfs_log_item_t *);
786 void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
787 void (*iop_pin)(xfs_log_item_t *);
788 void (*iop_unpin)(xfs_log_item_t *, int);
789 void (*iop_unpin_remove)(xfs_log_item_t *, struct xfs_trans *);
790 uint (*iop_trylock)(xfs_log_item_t *);
791 void (*iop_unlock)(xfs_log_item_t *);
792 xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
793 void (*iop_push)(xfs_log_item_t *);
794 void (*iop_pushbuf)(xfs_log_item_t *);
795 void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
796} xfs_item_ops_t;
797
798#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
799#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
800#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
801#define IOP_UNPIN(ip, flags) (*(ip)->li_ops->iop_unpin)(ip, flags)
802#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
803#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
804#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
805#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
806#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
807#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
808#define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)
809
810/*
811 * Return values for the IOP_TRYLOCK() routines.
812 */
813#define XFS_ITEM_SUCCESS 0
814#define XFS_ITEM_PINNED 1
815#define XFS_ITEM_LOCKED 2
816#define XFS_ITEM_FLUSHING 3
817#define XFS_ITEM_PUSHBUF 4
818
819/*
820 * This structure is used to maintain a list of block ranges that have been
821 * freed in the transaction. The ranges are listed in the perag[] busy list
822 * between when they're freed and the transaction is committed to disk.
823 */
824
825typedef struct xfs_log_busy_slot {
826 xfs_agnumber_t lbc_ag;
827 ushort lbc_idx; /* index in perag.busy[] */
828} xfs_log_busy_slot_t;
829
830#define XFS_LBC_NUM_SLOTS 31
831typedef struct xfs_log_busy_chunk {
832 struct xfs_log_busy_chunk *lbc_next;
833 uint lbc_free; /* free slots bitmask */
834 ushort lbc_unused; /* first unused */
835 xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
836} xfs_log_busy_chunk_t;
837
838#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1)
839#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1)
840
841#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK)
842#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot)))
843#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)]))
844#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK)
845#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot)))
846
847/*
848 * This is the type of function which can be given to xfs_trans_callback()
849 * to be called upon the transaction's commit to disk.
850 */
851typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
852
853/*
854 * This is the structure maintained for every active transaction.
855 */
856typedef struct xfs_trans {
857 unsigned int t_magic; /* magic number */
858 xfs_log_callback_t t_logcb; /* log callback struct */
859 unsigned int t_type; /* transaction type */
860 unsigned int t_log_res; /* amt of log space resvd */
861 unsigned int t_log_count; /* count for perm log res */
862 unsigned int t_blk_res; /* # of blocks resvd */
863 unsigned int t_blk_res_used; /* # of resvd blocks used */
864 unsigned int t_rtx_res; /* # of rt extents resvd */
865 unsigned int t_rtx_res_used; /* # of resvd rt extents used */
866 xfs_log_ticket_t t_ticket; /* log mgr ticket */
867 xfs_lsn_t t_lsn; /* log seq num of start of
868 * transaction. */
869 xfs_lsn_t t_commit_lsn; /* log seq num of end of
870 * transaction. */
871 struct xfs_mount *t_mountp; /* ptr to fs mount struct */
872 struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */
873 xfs_trans_callback_t t_callback; /* transaction callback */
874 void *t_callarg; /* callback arg */
875 unsigned int t_flags; /* misc flags */
876 int64_t t_icount_delta; /* superblock icount change */
877 int64_t t_ifree_delta; /* superblock ifree change */
878 int64_t t_fdblocks_delta; /* superblock fdblocks chg */
879 int64_t t_res_fdblocks_delta; /* on-disk only chg */
880 int64_t t_frextents_delta;/* superblock freextents chg*/
881 int64_t t_res_frextents_delta; /* on-disk only chg */
882#ifdef DEBUG
883 int64_t t_ag_freeblks_delta; /* debugging counter */
884 int64_t t_ag_flist_delta; /* debugging counter */
885 int64_t t_ag_btree_delta; /* debugging counter */
886#endif
887 int64_t t_dblocks_delta;/* superblock dblocks change */
888 int64_t t_agcount_delta;/* superblock agcount change */
889 int64_t t_imaxpct_delta;/* superblock imaxpct change */
890 int64_t t_rextsize_delta;/* superblock rextsize chg */
891 int64_t t_rbmblocks_delta;/* superblock rbmblocks chg */
892 int64_t t_rblocks_delta;/* superblock rblocks change */
893 int64_t t_rextents_delta;/* superblocks rextents chg */
894 int64_t t_rextslog_delta;/* superblocks rextslog chg */
895 unsigned int t_items_free; /* log item descs free */
896 xfs_log_item_chunk_t t_items; /* first log item desc chunk */
897 xfs_trans_header_t t_header; /* header for in-log trans */
898 unsigned int t_busy_free; /* busy descs free */
899 xfs_log_busy_chunk_t t_busy; /* busy/async free blocks */
900 unsigned long t_pflags; /* saved process flags state */
901} xfs_trans_t;
902
909/* 903/*
910 * XFS transaction mechanism exported interfaces that are 904 * XFS transaction mechanism exported interfaces that are
911 * actually macros. 905 * actually macros.
@@ -928,7 +922,6 @@ typedef struct xfs_trans {
928/* 922/*
929 * XFS transaction mechanism exported interfaces. 923 * XFS transaction mechanism exported interfaces.
930 */ 924 */
931void xfs_trans_init(struct xfs_mount *);
932xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint); 925xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint);
933xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint); 926xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint);
934xfs_trans_t *xfs_trans_dup(xfs_trans_t *); 927xfs_trans_t *xfs_trans_dup(xfs_trans_t *);
@@ -975,7 +968,6 @@ int _xfs_trans_commit(xfs_trans_t *,
975 int *); 968 int *);
976#define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL) 969#define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL)
977void xfs_trans_cancel(xfs_trans_t *, int); 970void xfs_trans_cancel(xfs_trans_t *, int);
978int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
979int xfs_trans_ail_init(struct xfs_mount *); 971int xfs_trans_ail_init(struct xfs_mount *);
980void xfs_trans_ail_destroy(struct xfs_mount *); 972void xfs_trans_ail_destroy(struct xfs_mount *);
981void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t); 973void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
@@ -990,4 +982,7 @@ extern kmem_zone_t *xfs_trans_zone;
990 982
991#endif /* __KERNEL__ */ 983#endif /* __KERNEL__ */
992 984
985void xfs_trans_init(struct xfs_mount *);
986int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
987
993#endif /* __XFS_TRANS_H__ */ 988#endif /* __XFS_TRANS_H__ */