diff options
Diffstat (limited to 'fs/ocfs2/journal.h')
| -rw-r--r-- | fs/ocfs2/journal.h | 77 |
1 files changed, 62 insertions, 15 deletions
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 172850a9a12..619dd7f6c05 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
| @@ -38,6 +38,17 @@ enum ocfs2_journal_state { | |||
| 38 | struct ocfs2_super; | 38 | struct ocfs2_super; |
| 39 | struct ocfs2_dinode; | 39 | struct ocfs2_dinode; |
| 40 | 40 | ||
| 41 | /* | ||
| 42 | * The recovery_list is a simple linked list of node numbers to recover. | ||
| 43 | * It is protected by the recovery_lock. | ||
| 44 | */ | ||
| 45 | |||
| 46 | struct ocfs2_recovery_map { | ||
| 47 | unsigned int rm_used; | ||
| 48 | unsigned int *rm_entries; | ||
| 49 | }; | ||
| 50 | |||
| 51 | |||
| 41 | struct ocfs2_journal { | 52 | struct ocfs2_journal { |
| 42 | enum ocfs2_journal_state j_state; /* Journals current state */ | 53 | enum ocfs2_journal_state j_state; /* Journals current state */ |
| 43 | 54 | ||
| @@ -139,6 +150,7 @@ void ocfs2_wait_for_recovery(struct ocfs2_super *osb); | |||
| 139 | int ocfs2_recovery_init(struct ocfs2_super *osb); | 150 | int ocfs2_recovery_init(struct ocfs2_super *osb); |
| 140 | void ocfs2_recovery_exit(struct ocfs2_super *osb); | 151 | void ocfs2_recovery_exit(struct ocfs2_super *osb); |
| 141 | 152 | ||
| 153 | int ocfs2_compute_replay_slots(struct ocfs2_super *osb); | ||
| 142 | /* | 154 | /* |
| 143 | * Journal Control: | 155 | * Journal Control: |
| 144 | * Initialize, Load, Shutdown, Wipe a journal. | 156 | * Initialize, Load, Shutdown, Wipe a journal. |
| @@ -266,6 +278,12 @@ int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, | |||
| 266 | /* dirblock */ | 278 | /* dirblock */ |
| 267 | int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, | 279 | int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, |
| 268 | struct buffer_head *bh, int type); | 280 | struct buffer_head *bh, int type); |
| 281 | /* ocfs2_dx_root_block */ | ||
| 282 | int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, | ||
| 283 | struct buffer_head *bh, int type); | ||
| 284 | /* ocfs2_dx_leaf */ | ||
| 285 | int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, | ||
| 286 | struct buffer_head *bh, int type); | ||
| 269 | /* Anything that has no ecc */ | 287 | /* Anything that has no ecc */ |
| 270 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, | 288 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, |
| 271 | struct buffer_head *bh, int type); | 289 | struct buffer_head *bh, int type); |
| @@ -368,14 +386,29 @@ static inline int ocfs2_remove_extent_credits(struct super_block *sb) | |||
| 368 | } | 386 | } |
| 369 | 387 | ||
| 370 | /* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + | 388 | /* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + |
| 371 | * bitmap block for the new bit) */ | 389 | * bitmap block for the new bit) dx_root update for free list */ |
| 372 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2) | 390 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2 + 1) |
| 391 | |||
| 392 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) | ||
| 393 | { | ||
| 394 | /* 1 block for index, 2 allocs (data, metadata), 1 clusters | ||
| 395 | * worth of blocks for initial extent. */ | ||
| 396 | return 1 + 2 * OCFS2_SUBALLOC_ALLOC + | ||
| 397 | ocfs2_clusters_to_blocks(sb, 1); | ||
| 398 | } | ||
| 373 | 399 | ||
| 374 | /* parent fe, parent block, new file entry, inode alloc fe, inode alloc | 400 | /* parent fe, parent block, new file entry, index leaf, inode alloc fe, inode |
| 375 | * group descriptor + mkdir/symlink blocks + quota update */ | 401 | * alloc group descriptor + mkdir/symlink blocks + dir blocks + xattr |
| 376 | static inline int ocfs2_mknod_credits(struct super_block *sb) | 402 | * blocks + quota update */ |
| 403 | static inline int ocfs2_mknod_credits(struct super_block *sb, int is_dir, | ||
| 404 | int xattr_credits) | ||
| 377 | { | 405 | { |
| 378 | return 3 + OCFS2_SUBALLOC_ALLOC + OCFS2_DIR_LINK_ADDITIONAL_CREDITS + | 406 | int dir_credits = OCFS2_DIR_LINK_ADDITIONAL_CREDITS; |
| 407 | |||
| 408 | if (is_dir) | ||
| 409 | dir_credits += ocfs2_add_dir_index_credits(sb); | ||
| 410 | |||
| 411 | return 4 + OCFS2_SUBALLOC_ALLOC + dir_credits + xattr_credits + | ||
| 379 | ocfs2_quota_trans_credits(sb); | 412 | ocfs2_quota_trans_credits(sb); |
| 380 | } | 413 | } |
| 381 | 414 | ||
| @@ -388,31 +421,31 @@ static inline int ocfs2_mknod_credits(struct super_block *sb) | |||
| 388 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) | 421 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) |
| 389 | 422 | ||
| 390 | /* file update (nlink, etc) + directory mtime/ctime + dir entry block + quota | 423 | /* file update (nlink, etc) + directory mtime/ctime + dir entry block + quota |
| 391 | * update on dir */ | 424 | * update on dir + index leaf + dx root update for free list */ |
| 392 | static inline int ocfs2_link_credits(struct super_block *sb) | 425 | static inline int ocfs2_link_credits(struct super_block *sb) |
| 393 | { | 426 | { |
| 394 | return 2*OCFS2_INODE_UPDATE_CREDITS + 1 + | 427 | return 2*OCFS2_INODE_UPDATE_CREDITS + 3 + |
| 395 | ocfs2_quota_trans_credits(sb); | 428 | ocfs2_quota_trans_credits(sb); |
| 396 | } | 429 | } |
| 397 | 430 | ||
| 398 | /* inode + dir inode (if we unlink a dir), + dir entry block + orphan | 431 | /* inode + dir inode (if we unlink a dir), + dir entry block + orphan |
| 399 | * dir inode link */ | 432 | * dir inode link + dir inode index leaf + dir index root */ |
| 400 | static inline int ocfs2_unlink_credits(struct super_block *sb) | 433 | static inline int ocfs2_unlink_credits(struct super_block *sb) |
| 401 | { | 434 | { |
| 402 | /* The quota update from ocfs2_link_credits is unused here... */ | 435 | /* The quota update from ocfs2_link_credits is unused here... */ |
| 403 | return 2 * OCFS2_INODE_UPDATE_CREDITS + 1 + ocfs2_link_credits(sb); | 436 | return 2 * OCFS2_INODE_UPDATE_CREDITS + 3 + ocfs2_link_credits(sb); |
| 404 | } | 437 | } |
| 405 | 438 | ||
| 406 | /* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry + | 439 | /* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry + |
| 407 | * inode alloc group descriptor */ | 440 | * inode alloc group descriptor + orphan dir index leaf */ |
| 408 | #define OCFS2_DELETE_INODE_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 1 + 1) | 441 | #define OCFS2_DELETE_INODE_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 3) |
| 409 | 442 | ||
| 410 | /* dinode update, old dir dinode update, new dir dinode update, old | 443 | /* dinode update, old dir dinode update, new dir dinode update, old |
| 411 | * dir dir entry, new dir dir entry, dir entry update for renaming | 444 | * dir dir entry, new dir dir entry, dir entry update for renaming |
| 412 | * directory + target unlink */ | 445 | * directory + target unlink + 3 x dir index leaves */ |
| 413 | static inline int ocfs2_rename_credits(struct super_block *sb) | 446 | static inline int ocfs2_rename_credits(struct super_block *sb) |
| 414 | { | 447 | { |
| 415 | return 3 * OCFS2_INODE_UPDATE_CREDITS + 3 + ocfs2_unlink_credits(sb); | 448 | return 3 * OCFS2_INODE_UPDATE_CREDITS + 6 + ocfs2_unlink_credits(sb); |
| 416 | } | 449 | } |
| 417 | 450 | ||
| 418 | /* global bitmap dinode, group desc., relinked group, | 451 | /* global bitmap dinode, group desc., relinked group, |
| @@ -422,6 +455,20 @@ static inline int ocfs2_rename_credits(struct super_block *sb) | |||
| 422 | + OCFS2_INODE_UPDATE_CREDITS \ | 455 | + OCFS2_INODE_UPDATE_CREDITS \ |
| 423 | + OCFS2_XATTR_BLOCK_UPDATE_CREDITS) | 456 | + OCFS2_XATTR_BLOCK_UPDATE_CREDITS) |
| 424 | 457 | ||
| 458 | /* inode update, removal of dx root block from allocator */ | ||
| 459 | #define OCFS2_DX_ROOT_REMOVE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + \ | ||
| 460 | OCFS2_SUBALLOC_FREE) | ||
| 461 | |||
| 462 | static inline int ocfs2_calc_dxi_expand_credits(struct super_block *sb) | ||
| 463 | { | ||
| 464 | int credits = 1 + OCFS2_SUBALLOC_ALLOC; | ||
| 465 | |||
| 466 | credits += ocfs2_clusters_to_blocks(sb, 1); | ||
| 467 | credits += ocfs2_quota_trans_credits(sb); | ||
| 468 | |||
| 469 | return credits; | ||
| 470 | } | ||
| 471 | |||
| 425 | /* | 472 | /* |
| 426 | * Please note that the caller must make sure that root_el is the root | 473 | * Please note that the caller must make sure that root_el is the root |
| 427 | * of extent tree. So for an inode, it should be &fe->id2.i_list. Otherwise | 474 | * of extent tree. So for an inode, it should be &fe->id2.i_list. Otherwise |
| @@ -457,7 +504,7 @@ static inline int ocfs2_calc_extend_credits(struct super_block *sb, | |||
| 457 | 504 | ||
| 458 | static inline int ocfs2_calc_symlink_credits(struct super_block *sb) | 505 | static inline int ocfs2_calc_symlink_credits(struct super_block *sb) |
| 459 | { | 506 | { |
| 460 | int blocks = ocfs2_mknod_credits(sb); | 507 | int blocks = ocfs2_mknod_credits(sb, 0, 0); |
| 461 | 508 | ||
| 462 | /* links can be longer than one block so we may update many | 509 | /* links can be longer than one block so we may update many |
| 463 | * within our single allocated extent. */ | 510 | * within our single allocated extent. */ |
