diff options
Diffstat (limited to 'fs/xfs/xfs_trans.h')
-rw-r--r-- | fs/xfs/xfs_trans.h | 117 |
1 files changed, 11 insertions, 106 deletions
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index e639e8e9a2a9..c13c0f97b494 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -161,105 +161,14 @@ typedef struct xfs_trans_header { | |||
161 | * the amount of space needed to log the item it describes | 161 | * the amount of space needed to log the item it describes |
162 | * once we get to commit processing (see xfs_trans_commit()). | 162 | * once we get to commit processing (see xfs_trans_commit()). |
163 | */ | 163 | */ |
164 | typedef struct xfs_log_item_desc { | 164 | struct xfs_log_item_desc { |
165 | struct xfs_log_item *lid_item; | 165 | struct xfs_log_item *lid_item; |
166 | ushort lid_size; | 166 | ushort lid_size; |
167 | unsigned char lid_flags; | 167 | unsigned char lid_flags; |
168 | unsigned char lid_index; | 168 | struct list_head lid_trans; |
169 | } xfs_log_item_desc_t; | 169 | }; |
170 | 170 | ||
171 | #define XFS_LID_DIRTY 0x1 | 171 | #define XFS_LID_DIRTY 0x1 |
172 | #define XFS_LID_PINNED 0x2 | ||
173 | |||
174 | /* | ||
175 | * This structure is used to maintain a chunk list of log_item_desc | ||
176 | * structures. The free field is a bitmask indicating which descriptors | ||
177 | * in this chunk's array are free. The unused field is the first value | ||
178 | * not used since this chunk was allocated. | ||
179 | */ | ||
180 | #define XFS_LIC_NUM_SLOTS 15 | ||
181 | typedef struct xfs_log_item_chunk { | ||
182 | struct xfs_log_item_chunk *lic_next; | ||
183 | ushort lic_free; | ||
184 | ushort lic_unused; | ||
185 | xfs_log_item_desc_t lic_descs[XFS_LIC_NUM_SLOTS]; | ||
186 | } xfs_log_item_chunk_t; | ||
187 | |||
188 | #define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1) | ||
189 | #define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1) | ||
190 | |||
191 | |||
192 | /* | ||
193 | * Initialize the given chunk. Set the chunk's free descriptor mask | ||
194 | * to indicate that all descriptors are free. The caller gets to set | ||
195 | * lic_unused to the right value (0 matches all free). The | ||
196 | * lic_descs.lid_index values are set up as each desc is allocated. | ||
197 | */ | ||
198 | static inline void xfs_lic_init(xfs_log_item_chunk_t *cp) | ||
199 | { | ||
200 | cp->lic_free = XFS_LIC_FREEMASK; | ||
201 | } | ||
202 | |||
203 | static inline void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot) | ||
204 | { | ||
205 | cp->lic_descs[slot].lid_index = (unsigned char)(slot); | ||
206 | } | ||
207 | |||
208 | static inline int xfs_lic_vacancy(xfs_log_item_chunk_t *cp) | ||
209 | { | ||
210 | return cp->lic_free & XFS_LIC_FREEMASK; | ||
211 | } | ||
212 | |||
213 | static inline void xfs_lic_all_free(xfs_log_item_chunk_t *cp) | ||
214 | { | ||
215 | cp->lic_free = XFS_LIC_FREEMASK; | ||
216 | } | ||
217 | |||
218 | static inline int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp) | ||
219 | { | ||
220 | return ((cp->lic_free & XFS_LIC_FREEMASK) == XFS_LIC_FREEMASK); | ||
221 | } | ||
222 | |||
223 | static inline int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot) | ||
224 | { | ||
225 | return (cp->lic_free & (1 << slot)); | ||
226 | } | ||
227 | |||
228 | static inline void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot) | ||
229 | { | ||
230 | cp->lic_free &= ~(1 << slot); | ||
231 | } | ||
232 | |||
233 | static inline void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot) | ||
234 | { | ||
235 | cp->lic_free |= 1 << slot; | ||
236 | } | ||
237 | |||
238 | static inline xfs_log_item_desc_t * | ||
239 | xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot) | ||
240 | { | ||
241 | return &(cp->lic_descs[slot]); | ||
242 | } | ||
243 | |||
244 | static inline int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp) | ||
245 | { | ||
246 | return (uint)dp->lid_index; | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * Calculate the address of a chunk given a descriptor pointer: | ||
251 | * dp - dp->lid_index give the address of the start of the lic_descs array. | ||
252 | * From this we subtract the offset of the lic_descs field in a chunk. | ||
253 | * All of this yields the address of the chunk, which is | ||
254 | * cast to a chunk pointer. | ||
255 | */ | ||
256 | static inline xfs_log_item_chunk_t * | ||
257 | xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp) | ||
258 | { | ||
259 | return (xfs_log_item_chunk_t*) \ | ||
260 | (((xfs_caddr_t)((dp) - (dp)->lid_index)) - \ | ||
261 | (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs)); | ||
262 | } | ||
263 | 172 | ||
264 | #define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ | 173 | #define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ |
265 | /* | 174 | /* |
@@ -275,8 +184,6 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp) | |||
275 | /* | 184 | /* |
276 | * Values for call flags parameter. | 185 | * Values for call flags parameter. |
277 | */ | 186 | */ |
278 | #define XFS_TRANS_NOSLEEP 0x1 | ||
279 | #define XFS_TRANS_WAIT 0x2 | ||
280 | #define XFS_TRANS_RELEASE_LOG_RES 0x4 | 187 | #define XFS_TRANS_RELEASE_LOG_RES 0x4 |
281 | #define XFS_TRANS_ABORT 0x8 | 188 | #define XFS_TRANS_ABORT 0x8 |
282 | 189 | ||
@@ -438,8 +345,7 @@ typedef struct xfs_item_ops { | |||
438 | uint (*iop_size)(xfs_log_item_t *); | 345 | uint (*iop_size)(xfs_log_item_t *); |
439 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); | 346 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); |
440 | void (*iop_pin)(xfs_log_item_t *); | 347 | void (*iop_pin)(xfs_log_item_t *); |
441 | void (*iop_unpin)(xfs_log_item_t *); | 348 | void (*iop_unpin)(xfs_log_item_t *, int remove); |
442 | void (*iop_unpin_remove)(xfs_log_item_t *, struct xfs_trans *); | ||
443 | uint (*iop_trylock)(xfs_log_item_t *); | 349 | uint (*iop_trylock)(xfs_log_item_t *); |
444 | void (*iop_unlock)(xfs_log_item_t *); | 350 | void (*iop_unlock)(xfs_log_item_t *); |
445 | xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); | 351 | xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); |
@@ -451,8 +357,7 @@ typedef struct xfs_item_ops { | |||
451 | #define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip) | 357 | #define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip) |
452 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) | 358 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) |
453 | #define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip) | 359 | #define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip) |
454 | #define IOP_UNPIN(ip) (*(ip)->li_ops->iop_unpin)(ip) | 360 | #define IOP_UNPIN(ip, remove) (*(ip)->li_ops->iop_unpin)(ip, remove) |
455 | #define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp) | ||
456 | #define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip) | 361 | #define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip) |
457 | #define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip) | 362 | #define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip) |
458 | #define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) | 363 | #define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) |
@@ -516,8 +421,7 @@ typedef struct xfs_trans { | |||
516 | int64_t t_rblocks_delta;/* superblock rblocks change */ | 421 | int64_t t_rblocks_delta;/* superblock rblocks change */ |
517 | int64_t t_rextents_delta;/* superblocks rextents chg */ | 422 | int64_t t_rextents_delta;/* superblocks rextents chg */ |
518 | int64_t t_rextslog_delta;/* superblocks rextslog chg */ | 423 | int64_t t_rextslog_delta;/* superblocks rextslog chg */ |
519 | unsigned int t_items_free; /* log item descs free */ | 424 | struct list_head t_items; /* log item descriptors */ |
520 | xfs_log_item_chunk_t t_items; /* first log item desc chunk */ | ||
521 | xfs_trans_header_t t_header; /* header for in-log trans */ | 425 | xfs_trans_header_t t_header; /* header for in-log trans */ |
522 | struct list_head t_busy; /* list of busy extents */ | 426 | struct list_head t_busy; /* list of busy extents */ |
523 | unsigned long t_pflags; /* saved process flags state */ | 427 | unsigned long t_pflags; /* saved process flags state */ |
@@ -569,8 +473,8 @@ void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); | |||
569 | void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); | 473 | void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); |
570 | int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *, | 474 | int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *, |
571 | xfs_ino_t , uint, uint, struct xfs_inode **); | 475 | xfs_ino_t , uint, uint, struct xfs_inode **); |
572 | void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint); | 476 | void xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, uint); |
573 | void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); | 477 | void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *); |
574 | void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); | 478 | void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); |
575 | void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); | 479 | void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); |
576 | struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); | 480 | struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); |
@@ -595,6 +499,7 @@ int xfs_trans_ail_init(struct xfs_mount *); | |||
595 | void xfs_trans_ail_destroy(struct xfs_mount *); | 499 | void xfs_trans_ail_destroy(struct xfs_mount *); |
596 | 500 | ||
597 | extern kmem_zone_t *xfs_trans_zone; | 501 | extern kmem_zone_t *xfs_trans_zone; |
502 | extern kmem_zone_t *xfs_log_item_desc_zone; | ||
598 | 503 | ||
599 | #endif /* __KERNEL__ */ | 504 | #endif /* __KERNEL__ */ |
600 | 505 | ||