Commit 847fff5ca881670ca8ec617afeb943950f0c804b

Authored by Barry Naujok
Committed by Lachlan McIlroy
1 parent 24ee0e49c9

[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>

Showing 14 changed files with 383 additions and 389 deletions Side-by-side Diff

... ... @@ -192,15 +192,16 @@
192 192 xfs_agino_t pagi_freecount; /* number of free inodes */
193 193 xfs_agino_t pagi_count; /* number of allocated inodes */
194 194 int pagb_count; /* pagb slots in use */
  195 + xfs_perag_busy_t *pagb_list; /* unstable blocks */
195 196 #ifdef __KERNEL__
196 197 spinlock_t pagb_lock; /* lock for pagb_list */
197   -#endif
198   - xfs_perag_busy_t *pagb_list; /* unstable blocks */
  198 +
199 199 atomic_t pagf_fstrms; /* # of filestreams active in this AG */
200 200  
201 201 int pag_ici_init; /* incore inode cache initialised */
202 202 rwlock_t pag_ici_lock; /* incore inode lock */
203 203 struct radix_tree_root pag_ici_root; /* incore inode cache root */
  204 +#endif
204 205 } xfs_perag_t;
205 206  
206 207 #define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
... ... @@ -121,6 +121,19 @@
121 121 #define XFS_ALLOC_KTRACE_BUSYSEARCH 6
122 122 #endif
123 123  
  124 +void
  125 +xfs_alloc_mark_busy(xfs_trans_t *tp,
  126 + xfs_agnumber_t agno,
  127 + xfs_agblock_t bno,
  128 + xfs_extlen_t len);
  129 +
  130 +void
  131 +xfs_alloc_clear_busy(xfs_trans_t *tp,
  132 + xfs_agnumber_t ag,
  133 + int idx);
  134 +
  135 +#endif /* __KERNEL__ */
  136 +
124 137 /*
125 138 * Compute and fill in value of m_ag_maxlevels.
126 139 */
... ... @@ -195,20 +208,6 @@
195 208 struct xfs_trans *tp, /* transaction pointer */
196 209 xfs_fsblock_t bno, /* starting block number of extent */
197 210 xfs_extlen_t len); /* length of extent */
198   -
199   -void
200   -xfs_alloc_mark_busy(xfs_trans_t *tp,
201   - xfs_agnumber_t agno,
202   - xfs_agblock_t bno,
203   - xfs_extlen_t len);
204   -
205   -void
206   -xfs_alloc_clear_busy(xfs_trans_t *tp,
207   - xfs_agnumber_t ag,
208   - int idx);
209   -
210   -
211   -#endif /* __KERNEL__ */
212 211  
213 212 #endif /* __XFS_ALLOC_H__ */
... ... @@ -41,20 +41,35 @@
41 41 #endif
42 42  
43 43 #ifdef XFS_NATIVE_HOST
44   -#define cpu_to_be16(val) ((__be16)(val))
45   -#define cpu_to_be32(val) ((__be32)(val))
46   -#define cpu_to_be64(val) ((__be64)(val))
47   -#define be16_to_cpu(val) ((__uint16_t)(val))
48   -#define be32_to_cpu(val) ((__uint32_t)(val))
49   -#define be64_to_cpu(val) ((__uint64_t)(val))
  44 +#define cpu_to_be16(val) ((__force __be16)(__u16)(val))
  45 +#define cpu_to_be32(val) ((__force __be32)(__u32)(val))
  46 +#define cpu_to_be64(val) ((__force __be64)(__u64)(val))
  47 +#define be16_to_cpu(val) ((__force __u16)(__be16)(val))
  48 +#define be32_to_cpu(val) ((__force __u32)(__be32)(val))
  49 +#define be64_to_cpu(val) ((__force __u64)(__be64)(val))
50 50 #else
51   -#define cpu_to_be16(val) (__swab16((__uint16_t)(val)))
52   -#define cpu_to_be32(val) (__swab32((__uint32_t)(val)))
53   -#define cpu_to_be64(val) (__swab64((__uint64_t)(val)))
54   -#define be16_to_cpu(val) (__swab16((__be16)(val)))
55   -#define be32_to_cpu(val) (__swab32((__be32)(val)))
56   -#define be64_to_cpu(val) (__swab64((__be64)(val)))
  51 +#define cpu_to_be16(val) ((__force __be16)__swab16((__u16)(val)))
  52 +#define cpu_to_be32(val) ((__force __be32)__swab32((__u32)(val)))
  53 +#define cpu_to_be64(val) ((__force __be64)__swab64((__u64)(val)))
  54 +#define be16_to_cpu(val) (__swab16((__force __u16)(__be16)(val)))
  55 +#define be32_to_cpu(val) (__swab32((__force __u32)(__be32)(val)))
  56 +#define be64_to_cpu(val) (__swab64((__force __u64)(__be64)(val)))
57 57 #endif
  58 +
  59 +static inline void be16_add_cpu(__be16 *a, __s16 b)
  60 +{
  61 + *a = cpu_to_be16(be16_to_cpu(*a) + b);
  62 +}
  63 +
  64 +static inline void be32_add_cpu(__be32 *a, __s32 b)
  65 +{
  66 + *a = cpu_to_be32(be32_to_cpu(*a) + b);
  67 +}
  68 +
  69 +static inline void be64_add_cpu(__be64 *a, __s64 b)
  70 +{
  71 + *a = cpu_to_be64(be64_to_cpu(*a) + b);
  72 +}
58 73  
59 74 #endif /* __KERNEL__ */
60 75  
... ... @@ -61,8 +61,7 @@
61 61 /* Get low bit set out of 32-bit argument, -1 if none set */
62 62 static inline int xfs_lowbit32(__uint32_t v)
63 63 {
64   - unsigned long t = v;
65   - return (v) ? find_first_bit(&t, 32) : -1;
  64 + return ffs(v) - 1;
66 65 }
67 66  
68 67 /* Get low bit set out of 64-bit argument, -1 if none set */
... ... @@ -137,9 +137,7 @@
137 137 char conv; /* overwriting unwritten extents */
138 138 } xfs_bmalloca_t;
139 139  
140   -#ifdef __KERNEL__
141   -
142   -#if defined(XFS_BMAP_TRACE)
  140 +#if defined(__KERNEL__) && defined(XFS_BMAP_TRACE)
143 141 /*
144 142 * Trace operations for bmap extent tracing
145 143 */
146 144  
147 145  
... ... @@ -163,10 +161,13 @@
163 161 int whichfork); /* data or attr fork */
164 162 #define XFS_BMAP_TRACE_EXLIST(ip,c,w) \
165 163 xfs_bmap_trace_exlist(__func__,ip,c,w)
166   -#else
  164 +
  165 +#else /* __KERNEL__ && XFS_BMAP_TRACE */
  166 +
167 167 #define XFS_BMAP_TRACE_EXLIST(ip,c,w)
168   -#endif
169 168  
  169 +#endif /* __KERNEL__ && XFS_BMAP_TRACE */
  170 +
170 171 /*
171 172 * Convert inode from non-attributed to attributed.
172 173 * Must not be in a transaction, ip must not be locked.
... ... @@ -206,20 +207,6 @@
206 207 int whichfork); /* data or attr fork */
207 208  
208 209 /*
209   - * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
210   - * caller. Frees all the extents that need freeing, which must be done
211   - * last due to locking considerations.
212   - *
213   - * Return 1 if the given transaction was committed and a new one allocated,
214   - * and 0 otherwise.
215   - */
216   -int /* error */
217   -xfs_bmap_finish(
218   - struct xfs_trans **tp, /* transaction pointer addr */
219   - xfs_bmap_free_t *flist, /* i/o: list extents to free */
220   - int *committed); /* xact committed or not */
221   -
222   -/*
223 210 * Returns the file-relative block number of the first unused block in the file.
224 211 * This is the lowest-address hole if the file has holes, else the first block
225 212 * past the end of file.
... ... @@ -344,6 +331,32 @@
344 331 int *done); /* set if not done yet */
345 332  
346 333 /*
  334 + * Check an extent list, which has just been read, for
  335 + * any bit in the extent flag field.
  336 + */
  337 +int
  338 +xfs_check_nostate_extents(
  339 + struct xfs_ifork *ifp,
  340 + xfs_extnum_t idx,
  341 + xfs_extnum_t num);
  342 +
  343 +#ifdef __KERNEL__
  344 +
  345 +/*
  346 + * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
  347 + * caller. Frees all the extents that need freeing, which must be done
  348 + * last due to locking considerations.
  349 + *
  350 + * Return 1 if the given transaction was committed and a new one allocated,
  351 + * and 0 otherwise.
  352 + */
  353 +int /* error */
  354 +xfs_bmap_finish(
  355 + struct xfs_trans **tp, /* transaction pointer addr */
  356 + xfs_bmap_free_t *flist, /* i/o: list extents to free */
  357 + int *committed); /* xact committed or not */
  358 +
  359 +/*
347 360 * Fcntl interface to xfs_bmapi.
348 361 */
349 362 int /* error code */
... ... @@ -373,16 +386,6 @@
373 386 struct xfs_inode *ip,
374 387 int whichfork,
375 388 int *count);
376   -
377   -/*
378   - * Check an extent list, which has just been read, for
379   - * any bit in the extent flag field.
380   - */
381   -int
382   -xfs_check_nostate_extents(
383   - struct xfs_ifork *ifp,
384   - xfs_extnum_t idx,
385   - xfs_extnum_t num);
386 389  
387 390 /*
388 391 * Search the extent records for the entry containing block bno.
fs/xfs/xfs_bmap_btree.h
... ... @@ -231,8 +231,6 @@
231 231 be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0])
232 232  
233 233  
234   -#ifdef __KERNEL__
235   -
236 234 /*
237 235 * Prototypes for xfs_bmap.c to call.
238 236 */
... ... @@ -264,7 +262,6 @@
264 262 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
265 263 struct xfs_trans *, struct xfs_inode *, int);
266 264  
267   -#endif /* __KERNEL__ */
268 265  
269 266 #endif /* __XFS_BMAP_BTREE_H__ */
... ... @@ -327,8 +327,6 @@
327 327 #define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)XFS_BUF_PTR(bp))
328 328  
329 329  
330   -#ifdef __KERNEL__
331   -
332 330 /*
333 331 * Check that long form block header is ok.
334 332 */
... ... @@ -514,8 +512,6 @@
514 512 {
515 513 return be16_to_cpu(block->bb_level);
516 514 }
517   -
518   -#endif /* __KERNEL__ */
519 515  
520 516  
521 517 /*
fs/xfs/xfs_da_btree.h
... ... @@ -206,9 +206,8 @@
206 206 };
207 207  
208 208  
209   -#ifdef __KERNEL__
210 209 /*========================================================================
211   - * Function prototypes for the kernel.
  210 + * Function prototypes.
212 211 *========================================================================*/
213 212  
214 213 /*
... ... @@ -269,7 +268,6 @@
269 268  
270 269 extern struct kmem_zone *xfs_da_state_zone;
271 270 extern struct kmem_zone *xfs_dabuf_zone;
272   -#endif /* __KERNEL__ */
273 271  
274 272 #endif /* __XFS_DA_BTREE_H__ */
... ... @@ -56,7 +56,6 @@
56 56 }
57 57  
58 58  
59   -#ifdef __KERNEL__
60 59 /*
61 60 * Allocate an inode on disk.
62 61 * Mode is used to tell whether the new inode will need space, and whether
... ... @@ -173,8 +172,6 @@
173 172 */
174 173 extern int xfs_inobt_get_rec(struct xfs_btree_cur *cur, xfs_agino_t *ino,
175 174 __int32_t *fcnt, xfs_inofree_t *free, int *stat);
176   -
177   -#endif /* __KERNEL__ */
178 175  
179 176 #endif /* __XFS_IALLOC_H__ */
... ... @@ -30,12 +30,10 @@
30 30 ushort im_boffset; /* inode offset in block in bytes */
31 31 } xfs_imap_t;
32 32  
33   -#ifdef __KERNEL__
34 33 struct xfs_mount;
35 34 struct xfs_trans;
36 35 int xfs_imap(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
37 36 xfs_imap_t *, uint);
38   -#endif
39 37  
40 38 #endif /* __XFS_IMAP_H__ */
... ... @@ -20,8 +20,8 @@
20 20  
21 21 struct xfs_dinode;
22 22 struct xfs_dinode_core;
  23 +struct xfs_inode;
23 24  
24   -
25 25 /*
26 26 * Fork identifiers.
27 27 */
... ... @@ -84,54 +84,6 @@
84 84 } xfs_ifork_t;
85 85  
86 86 /*
87   - * Flags for xfs_ichgtime().
88   - */
89   -#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
90   -#define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */
91   -
92   -/*
93   - * Per-fork incore inode flags.
94   - */
95   -#define XFS_IFINLINE 0x01 /* Inline data is read in */
96   -#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
97   -#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
98   -#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
99   -
100   -/*
101   - * Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
102   - */
103   -#define XFS_IMAP_LOOKUP 0x1
104   -#define XFS_IMAP_BULKSTAT 0x2
105   -
106   -#ifdef __KERNEL__
107   -struct bhv_desc;
108   -struct cred;
109   -struct ktrace;
110   -struct xfs_buf;
111   -struct xfs_bmap_free;
112   -struct xfs_bmbt_irec;
113   -struct xfs_bmbt_block;
114   -struct xfs_inode;
115   -struct xfs_inode_log_item;
116   -struct xfs_mount;
117   -struct xfs_trans;
118   -struct xfs_dquot;
119   -
120   -#if defined(XFS_ILOCK_TRACE)
121   -#define XFS_ILOCK_KTRACE_SIZE 32
122   -extern ktrace_t *xfs_ilock_trace_buf;
123   -extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
124   -#else
125   -#define xfs_ilock_trace(i,n,f,ra)
126   -#endif
127   -
128   -typedef struct dm_attrs_s {
129   - __uint32_t da_dmevmask; /* DMIG event mask */
130   - __uint16_t da_dmstate; /* DMIG state info */
131   - __uint16_t da_pad; /* DMIG extra padding */
132   -} dm_attrs_t;
133   -
134   -/*
135 87 * This is the xfs in-core inode structure.
136 88 * Most of the on-disk inode is embedded in the i_d field.
137 89 *
... ... @@ -191,6 +143,96 @@
191 143 __uint32_t di_gen; /* generation number */
192 144 } xfs_icdinode_t;
193 145  
  146 +/*
  147 + * Flags for xfs_ichgtime().
  148 + */
  149 +#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
  150 +#define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */
  151 +
  152 +/*
  153 + * Per-fork incore inode flags.
  154 + */
  155 +#define XFS_IFINLINE 0x01 /* Inline data is read in */
  156 +#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
  157 +#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
  158 +#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
  159 +
  160 +/*
  161 + * Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
  162 + */
  163 +#define XFS_IMAP_LOOKUP 0x1
  164 +#define XFS_IMAP_BULKSTAT 0x2
  165 +
  166 +/*
  167 + * Fork handling.
  168 + */
  169 +
  170 +#define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0)
  171 +#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3))
  172 +
  173 +#define XFS_IFORK_PTR(ip,w) \
  174 + ((w) == XFS_DATA_FORK ? \
  175 + &(ip)->i_df : \
  176 + (ip)->i_afp)
  177 +#define XFS_IFORK_DSIZE(ip) \
  178 + (XFS_IFORK_Q(ip) ? \
  179 + XFS_IFORK_BOFF(ip) : \
  180 + XFS_LITINO((ip)->i_mount))
  181 +#define XFS_IFORK_ASIZE(ip) \
  182 + (XFS_IFORK_Q(ip) ? \
  183 + XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
  184 + 0)
  185 +#define XFS_IFORK_SIZE(ip,w) \
  186 + ((w) == XFS_DATA_FORK ? \
  187 + XFS_IFORK_DSIZE(ip) : \
  188 + XFS_IFORK_ASIZE(ip))
  189 +#define XFS_IFORK_FORMAT(ip,w) \
  190 + ((w) == XFS_DATA_FORK ? \
  191 + (ip)->i_d.di_format : \
  192 + (ip)->i_d.di_aformat)
  193 +#define XFS_IFORK_FMT_SET(ip,w,n) \
  194 + ((w) == XFS_DATA_FORK ? \
  195 + ((ip)->i_d.di_format = (n)) : \
  196 + ((ip)->i_d.di_aformat = (n)))
  197 +#define XFS_IFORK_NEXTENTS(ip,w) \
  198 + ((w) == XFS_DATA_FORK ? \
  199 + (ip)->i_d.di_nextents : \
  200 + (ip)->i_d.di_anextents)
  201 +#define XFS_IFORK_NEXT_SET(ip,w,n) \
  202 + ((w) == XFS_DATA_FORK ? \
  203 + ((ip)->i_d.di_nextents = (n)) : \
  204 + ((ip)->i_d.di_anextents = (n)))
  205 +
  206 +
  207 +
  208 +#ifdef __KERNEL__
  209 +
  210 +struct bhv_desc;
  211 +struct cred;
  212 +struct ktrace;
  213 +struct xfs_buf;
  214 +struct xfs_bmap_free;
  215 +struct xfs_bmbt_irec;
  216 +struct xfs_bmbt_block;
  217 +struct xfs_inode_log_item;
  218 +struct xfs_mount;
  219 +struct xfs_trans;
  220 +struct xfs_dquot;
  221 +
  222 +#if defined(XFS_ILOCK_TRACE)
  223 +#define XFS_ILOCK_KTRACE_SIZE 32
  224 +extern ktrace_t *xfs_ilock_trace_buf;
  225 +extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
  226 +#else
  227 +#define xfs_ilock_trace(i,n,f,ra)
  228 +#endif
  229 +
  230 +typedef struct dm_attrs_s {
  231 + __uint32_t da_dmevmask; /* DMIG event mask */
  232 + __uint16_t da_dmstate; /* DMIG state info */
  233 + __uint16_t da_pad; /* DMIG extra padding */
  234 +} dm_attrs_t;
  235 +
194 236 typedef struct {
195 237 struct xfs_inode *ip_mnext; /* next inode in mount list */
196 238 struct xfs_inode *ip_mprev; /* ptr to prev inode */
197 239  
198 240  
199 241  
200 242  
201 243  
202 244  
... ... @@ -327,51 +369,27 @@
327 369 spin_unlock(&ip->i_flags_lock);
328 370 return ret;
329 371 }
330   -#endif /* __KERNEL__ */
331 372  
332   -
333 373 /*
334   - * Fork handling.
  374 + * Manage the i_flush queue embedded in the inode. This completion
  375 + * queue synchronizes processes attempting to flush the in-core
  376 + * inode back to disk.
335 377 */
  378 +static inline void xfs_iflock(xfs_inode_t *ip)
  379 +{
  380 + wait_for_completion(&ip->i_flush);
  381 +}
336 382  
337   -#define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0)
338   -#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3))
  383 +static inline int xfs_iflock_nowait(xfs_inode_t *ip)
  384 +{
  385 + return try_wait_for_completion(&ip->i_flush);
  386 +}
339 387  
340   -#define XFS_IFORK_PTR(ip,w) \
341   - ((w) == XFS_DATA_FORK ? \
342   - &(ip)->i_df : \
343   - (ip)->i_afp)
344   -#define XFS_IFORK_DSIZE(ip) \
345   - (XFS_IFORK_Q(ip) ? \
346   - XFS_IFORK_BOFF(ip) : \
347   - XFS_LITINO((ip)->i_mount))
348   -#define XFS_IFORK_ASIZE(ip) \
349   - (XFS_IFORK_Q(ip) ? \
350   - XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
351   - 0)
352   -#define XFS_IFORK_SIZE(ip,w) \
353   - ((w) == XFS_DATA_FORK ? \
354   - XFS_IFORK_DSIZE(ip) : \
355   - XFS_IFORK_ASIZE(ip))
356   -#define XFS_IFORK_FORMAT(ip,w) \
357   - ((w) == XFS_DATA_FORK ? \
358   - (ip)->i_d.di_format : \
359   - (ip)->i_d.di_aformat)
360   -#define XFS_IFORK_FMT_SET(ip,w,n) \
361   - ((w) == XFS_DATA_FORK ? \
362   - ((ip)->i_d.di_format = (n)) : \
363   - ((ip)->i_d.di_aformat = (n)))
364   -#define XFS_IFORK_NEXTENTS(ip,w) \
365   - ((w) == XFS_DATA_FORK ? \
366   - (ip)->i_d.di_nextents : \
367   - (ip)->i_d.di_anextents)
368   -#define XFS_IFORK_NEXT_SET(ip,w,n) \
369   - ((w) == XFS_DATA_FORK ? \
370   - ((ip)->i_d.di_nextents = (n)) : \
371   - ((ip)->i_d.di_anextents = (n)))
  388 +static inline void xfs_ifunlock(xfs_inode_t *ip)
  389 +{
  390 + complete(&ip->i_flush);
  391 +}
372 392  
373   -#ifdef __KERNEL__
374   -
375 393 /*
376 394 * In-core inode flags.
377 395 */
378 396  
379 397  
... ... @@ -490,19 +508,11 @@
490 508 /*
491 509 * xfs_inode.c prototypes.
492 510 */
493   -int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
494   - xfs_inode_t *, struct xfs_dinode **, struct xfs_buf **,
495   - xfs_daddr_t, uint, uint);
496 511 int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
497 512 xfs_inode_t **, xfs_daddr_t, uint);
498   -int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
499 513 int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
500 514 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
501 515 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
502   -void xfs_dinode_from_disk(struct xfs_icdinode *,
503   - struct xfs_dinode_core *);
504   -void xfs_dinode_to_disk(struct xfs_dinode_core *,
505   - struct xfs_icdinode *);
506 516  
507 517 uint xfs_ip2xflags(struct xfs_inode *);
508 518 uint xfs_dic2xflags(struct xfs_dinode *);
509 519  
510 520  
511 521  
... ... @@ -514,15 +524,11 @@
514 524 int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
515 525  
516 526 struct xfs_inode * xfs_inode_alloc(struct xfs_mount *, xfs_ino_t);
517   -void xfs_idestroy_fork(xfs_inode_t *, int);
518 527 void xfs_idestroy(xfs_inode_t *);
519   -void xfs_idata_realloc(xfs_inode_t *, int, int);
520 528 void xfs_iextract(xfs_inode_t *);
521 529 void xfs_iext_realloc(xfs_inode_t *, int, int);
522   -void xfs_iroot_realloc(xfs_inode_t *, int, int);
523 530 void xfs_ipin(xfs_inode_t *);
524 531 void xfs_iunpin(xfs_inode_t *);
525   -int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
526 532 int xfs_iflush(xfs_inode_t *, uint);
527 533 void xfs_iflush_all(struct xfs_mount *);
528 534 void xfs_ichgtime(xfs_inode_t *, int);
... ... @@ -533,6 +539,21 @@
533 539 void xfs_synchronize_atime(xfs_inode_t *);
534 540 void xfs_mark_inode_dirty_sync(xfs_inode_t *);
535 541  
  542 +#endif /* __KERNEL__ */
  543 +
  544 +int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
  545 + struct xfs_inode *, struct xfs_dinode **,
  546 + struct xfs_buf **, xfs_daddr_t, uint, uint);
  547 +void xfs_dinode_from_disk(struct xfs_icdinode *,
  548 + struct xfs_dinode_core *);
  549 +void xfs_dinode_to_disk(struct xfs_dinode_core *,
  550 + struct xfs_icdinode *);
  551 +void xfs_idestroy_fork(struct xfs_inode *, int);
  552 +void xfs_idata_realloc(struct xfs_inode *, int, int);
  553 +void xfs_iroot_realloc(struct xfs_inode *, int, int);
  554 +int xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, int);
  555 +int xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int);
  556 +
536 557 xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
537 558 void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
538 559 xfs_bmbt_irec_t *);
... ... @@ -562,7 +583,8 @@
562 583 #define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
563 584  
564 585 #ifdef DEBUG
565   -void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t);
  586 +void xfs_isize_check(struct xfs_mount *, struct xfs_inode *,
  587 + xfs_fsize_t);
566 588 #else /* DEBUG */
567 589 #define xfs_isize_check(mp, ip, isize)
568 590 #endif /* DEBUG */
... ... @@ -576,28 +598,6 @@
576 598 extern struct kmem_zone *xfs_ifork_zone;
577 599 extern struct kmem_zone *xfs_inode_zone;
578 600 extern struct kmem_zone *xfs_ili_zone;
579   -
580   -/*
581   - * Manage the i_flush queue embedded in the inode. This completion
582   - * queue synchronizes processes attempting to flush the in-core
583   - * inode back to disk.
584   - */
585   -static inline void xfs_iflock(xfs_inode_t *ip)
586   -{
587   - wait_for_completion(&ip->i_flush);
588   -}
589   -
590   -static inline int xfs_iflock_nowait(xfs_inode_t *ip)
591   -{
592   - return try_wait_for_completion(&ip->i_flush);
593   -}
594   -
595   -static inline void xfs_ifunlock(xfs_inode_t *ip)
596   -{
597   - complete(&ip->i_flush);
598   -}
599   -
600   -#endif /* __KERNEL__ */
601 601  
602 602 #endif /* __XFS_INODE_H__ */
fs/xfs/xfs_inode_item.h
... ... @@ -112,6 +112,24 @@
112 112 #define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
113 113  
114 114  
  115 +#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
  116 +static inline int xfs_ilog_fbroot(int w)
  117 +{
  118 + return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
  119 +}
  120 +
  121 +#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
  122 +static inline int xfs_ilog_fext(int w)
  123 +{
  124 + return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
  125 +}
  126 +
  127 +#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
  128 +static inline int xfs_ilog_fdata(int w)
  129 +{
  130 + return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
  131 +}
  132 +
115 133 #ifdef __KERNEL__
116 134  
117 135 struct xfs_buf;
118 136  
... ... @@ -148,35 +166,12 @@
148 166 } xfs_inode_log_item_t;
149 167  
150 168  
151   -#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
152   -static inline int xfs_ilog_fdata(int w)
153   -{
154   - return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
155   -}
156   -
157   -#endif /* __KERNEL__ */
158   -
159   -#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
160   -static inline int xfs_ilog_fbroot(int w)
161   -{
162   - return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
163   -}
164   -
165   -#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
166   -static inline int xfs_ilog_fext(int w)
167   -{
168   - return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
169   -}
170   -
171 169 static inline int xfs_inode_clean(xfs_inode_t *ip)
172 170 {
173 171 return (!ip->i_itemp ||
174 172 !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
175 173 !ip->i_update_core;
176 174 }
177   -
178   -
179   -#ifdef __KERNEL__
180 175  
181 176 extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
182 177 extern void xfs_inode_item_destroy(struct xfs_inode *);
... ... @@ -44,14 +44,14 @@
44 44 } xfs_trans_reservations_t;
45 45  
46 46 #ifndef __KERNEL__
47   -/*
48   - * Moved here from xfs_ag.h to avoid reordering header files
49   - */
  47 +
50 48 #define XFS_DADDR_TO_AGNO(mp,d) \
51 49 ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
52 50 #define XFS_DADDR_TO_AGBNO(mp,d) \
53 51 ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
54   -#else
  52 +
  53 +#else /* __KERNEL__ */
  54 +
55 55 struct cred;
56 56 struct log;
57 57 struct xfs_mount_args;
... ... @@ -507,7 +507,6 @@
507 507 #define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock))
508 508 #define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
509 509  
510   -extern void xfs_mod_sb(xfs_trans_t *, __int64_t);
511 510 extern int xfs_log_sbcount(xfs_mount_t *, uint);
512 511 extern int xfs_mountfs(xfs_mount_t *mp);
513 512 extern void xfs_mountfs_check_barriers(xfs_mount_t *mp);
... ... @@ -526,9 +525,6 @@
526 525 extern int xfs_fs_writable(xfs_mount_t *);
527 526 extern int xfs_syncsub(xfs_mount_t *, int, int *);
528 527 extern int xfs_sync_inodes(xfs_mount_t *, int, int *);
529   -extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t);
530   -extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
531   -extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
532 528 extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t);
533 529  
534 530 extern int xfs_dmops_get(struct xfs_mount *, struct xfs_mount_args *);
... ... @@ -539,6 +535,11 @@
539 535 extern struct xfs_dmops xfs_dmcore_xfs;
540 536  
541 537 #endif /* __KERNEL__ */
  538 +
  539 +extern void xfs_mod_sb(struct xfs_trans *, __int64_t);
  540 +extern xfs_agnumber_t xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t);
  541 +extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
  542 +extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
542 543  
543 544 #endif /* __XFS_MOUNT_H__ */
... ... @@ -18,6 +18,8 @@
18 18 #ifndef __XFS_TRANS_H__
19 19 #define __XFS_TRANS_H__
20 20  
  21 +struct xfs_log_item;
  22 +
21 23 /*
22 24 * This is the structure written in the log at the head of
23 25 * every transaction. It identifies the type and id of the
24 26  
... ... @@ -98,77 +100,7 @@
98 100 #define XFS_TRANS_TYPE_MAX 41
99 101 /* new transaction types need to be reflected in xfs_logprint(8) */
100 102  
101   -
102   -#ifdef __KERNEL__
103   -struct xfs_buf;
104   -struct xfs_buftarg;
105   -struct xfs_efd_log_item;
106   -struct xfs_efi_log_item;
107   -struct xfs_inode;
108   -struct xfs_item_ops;
109   -struct xfs_log_iovec;
110   -struct xfs_log_item;
111   -struct xfs_log_item_desc;
112   -struct xfs_mount;
113   -struct xfs_trans;
114   -struct xfs_dquot_acct;
115   -
116   -typedef 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   -
134   -typedef 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 103 /*
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   -/*
172 104 * This structure is used to track log items associated with
173 105 * a transaction. It points to the log item and keeps some
174 106 * flags to track the state of the log item. It also tracks
... ... @@ -176,7 +108,7 @@
176 108 * once we get to commit processing (see xfs_trans_commit()).
177 109 */
178 110 typedef struct xfs_log_item_desc {
179   - xfs_log_item_t *lid_item;
  111 + struct xfs_log_item *lid_item;
180 112 ushort lid_size;
181 113 unsigned char lid_flags;
182 114 unsigned char lid_index;
... ... @@ -276,94 +208,6 @@
276 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   -
286   -typedef 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
292   -typedef 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   - */
312   -typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
313   -
314   -/*
315   - * This is the structure maintained for every active transaction.
316   - */
317   -typedef 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 211 #define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
368 212 /*
369 213 * Values for t_flags.
370 214  
... ... @@ -906,7 +750,157 @@
906 750 #define XFS_DQUOT_REF 1
907 751  
908 752 #ifdef __KERNEL__
  753 +
  754 +struct xfs_buf;
  755 +struct xfs_buftarg;
  756 +struct xfs_efd_log_item;
  757 +struct xfs_efi_log_item;
  758 +struct xfs_inode;
  759 +struct xfs_item_ops;
  760 +struct xfs_log_iovec;
  761 +struct xfs_log_item_desc;
  762 +struct xfs_mount;
  763 +struct xfs_trans;
  764 +struct xfs_dquot_acct;
  765 +
  766 +typedef 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 +
  784 +typedef 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 +
909 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 +
  825 +typedef 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
  831 +typedef 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 + */
  851 +typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
  852 +
  853 +/*
  854 + * This is the structure maintained for every active transaction.
  855 + */
  856 +typedef 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 +
  903 +/*
910 904 * XFS transaction mechanism exported interfaces that are
911 905 * actually macros.
912 906 */
... ... @@ -928,7 +922,6 @@
928 922 /*
929 923 * XFS transaction mechanism exported interfaces.
930 924 */
931   -void xfs_trans_init(struct xfs_mount *);
932 925 xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint);
933 926 xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint);
934 927 xfs_trans_t *xfs_trans_dup(xfs_trans_t *);
... ... @@ -975,7 +968,6 @@
975 968 int *);
976 969 #define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL)
977 970 void xfs_trans_cancel(xfs_trans_t *, int);
978   -int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
979 971 int xfs_trans_ail_init(struct xfs_mount *);
980 972 void xfs_trans_ail_destroy(struct xfs_mount *);
981 973 void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
... ... @@ -989,6 +981,9 @@
989 981 extern kmem_zone_t *xfs_trans_zone;
990 982  
991 983 #endif /* __KERNEL__ */
  984 +
  985 +void xfs_trans_init(struct xfs_mount *);
  986 +int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
992 987  
993 988 #endif /* __XFS_TRANS_H__ */