Showing the changes to include/linux (1 of 21 files). Show all
Unified · Split
| @@ -456,7 +456,9 @@ struct jbd2_revoke_table_s; · 455 unmodified lines | ||
| 456 | 456 | * @h_transaction: Which compound transaction is this update a part of? |
| 457 | 457 | * @h_journal: Which journal handle belongs to - used iff h_reserved set. |
| 458 | 458 | * @h_rsv_handle: Handle reserved for finishing the logical operation. |
| 459 | − * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. | |
| 459 | + * @h_total_credits: Number of remaining buffers we are allowed to add to | |
| 460 | + journal. These are dirty buffers and revoke descriptor blocks. | |
| 461 | + * @h_revoke_credits: Number of remaining revoke records available for handle | |
| 460 | 462 | * @h_ref: Reference count on this handle. |
| 461 | 463 | * @h_err: Field for caller's use to track errors through large fs operations. |
| 462 | 464 | * @h_sync: Flag for sync-on-close. |
| @@ -466,7 +468,8 @@ struct jbd2_revoke_table_s; · 3 unmodified lines | ||
| 466 | 468 | * @h_type: For handle statistics. |
| 467 | 469 | * @h_line_no: For handle statistics. |
| 468 | 470 | * @h_start_jiffies: Handle Start time. |
| 469 | − * @h_requested_credits: Holds @h_buffer_credits after handle is started. | |
| 471 | + * @h_requested_credits: Holds @h_total_credits after handle is started. | |
| 472 | + * @h_revoke_credits_requested: Holds @h_revoke_credits after handle is started. | |
| 470 | 473 | * @saved_alloc_context: Saved context while transaction is open. |
| 471 | 474 | **/ |
| 472 | 475 | |
| @@ -483,7 +486,9 @@ struct jbd2_journal_handle · 10 unmodified lines | ||
| 483 | 486 | }; |
| 484 | 487 | |
| 485 | 488 | handle_t *h_rsv_handle; |
| 486 | − int h_buffer_credits; | |
| 489 | + int h_total_credits; | |
| 490 | + int h_revoke_credits; | |
| 491 | + int h_revoke_credits_requested; | |
| 487 | 492 | int h_ref; |
| 488 | 493 | int h_err; |
| 489 | 494 | |
| @@ -660,11 +665,24 @@ struct transaction_s · 170 unmodified lines | ||
| 660 | 665 | atomic_t t_updates; |
| 661 | 666 | |
| 662 | 667 | /* |
| 663 | − * Number of buffers reserved for use by all handles in this transaction | |
| 664 | − * handle but not yet modified. [none] | |
| 668 | + * Number of blocks reserved for this transaction in the journal. | |
| 669 | + * This is including all credits reserved when starting transaction | |
| 670 | + * handles as well as all journal descriptor blocks needed for this | |
| 671 | + * transaction. [none] | |
| 665 | 672 | */ |
| 666 | 673 | atomic_t t_outstanding_credits; |
| 667 | 674 | |
| 675 | + /* | |
| 676 | + * Number of revoke records for this transaction added by already | |
| 677 | + * stopped handles. [none] | |
| 678 | + */ | |
| 679 | + atomic_t t_outstanding_revokes; | |
| 680 | + | |
| 681 | + /* | |
| 682 | + * How many handles used this transaction? [none] | |
| 683 | + */ | |
| 684 | + atomic_t t_handle_count; | |
| 685 | + | |
| 668 | 686 | /* |
| 669 | 687 | * Forward and backward links for the circular list of all transactions |
| 670 | 688 | * awaiting checkpoint. [j_list_lock] |
| @@ -682,11 +700,6 @@ struct transaction_s · 11 unmodified lines | ||
| 682 | 700 | */ |
| 683 | 701 | ktime_t t_start_time; |
| 684 | 702 | |
| 685 | − /* | |
| 686 | − * How many handles used this transaction? [none] | |
| 687 | − */ | |
| 688 | − atomic_t t_handle_count; | |
| 689 | − | |
| 690 | 703 | /* |
| 691 | 704 | * This transaction is being forced and some process is |
| 692 | 705 | * waiting for it to finish. |
| @@ -1003,6 +1016,13 @@ struct journal_s · 310 unmodified lines | ||
| 1003 | 1016 | */ |
| 1004 | 1017 | int j_max_transaction_buffers; |
| 1005 | 1018 | |
| 1019 | + /** | |
| 1020 | + * @j_revoke_records_per_block: | |
| 1021 | + * | |
| 1022 | + * Number of revoke records that fit in one descriptor block. | |
| 1023 | + */ | |
| 1024 | + int j_revoke_records_per_block; | |
| 1025 | + | |
| 1006 | 1026 | /** |
| 1007 | 1027 | * @j_commit_interval: |
| 1008 | 1028 | * |
| @@ -1337,14 +1357,16 @@ static inline handle_t *journal_current_handle(void) · 328 unmodified lines | ||
| 1337 | 1357 | |
| 1338 | 1358 | extern handle_t *jbd2_journal_start(journal_t *, int nblocks); |
| 1339 | 1359 | extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks, |
| 1340 | − gfp_t gfp_mask, unsigned int type, | |
| 1341 | − unsigned int line_no); | |
| 1360 | + int revoke_records, gfp_t gfp_mask, | |
| 1361 | + unsigned int type, unsigned int line_no); | |
| 1342 | 1362 | extern int jbd2_journal_restart(handle_t *, int nblocks); |
| 1343 | −extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); | |
| 1363 | +extern int jbd2__journal_restart(handle_t *, int nblocks, | |
| 1364 | + int revoke_records, gfp_t gfp_mask); | |
| 1344 | 1365 | extern int jbd2_journal_start_reserved(handle_t *handle, |
| 1345 | 1366 | unsigned int type, unsigned int line_no); |
| 1346 | 1367 | extern void jbd2_journal_free_reserved(handle_t *handle); |
| 1347 | −extern int jbd2_journal_extend (handle_t *, int nblocks); | |
| 1368 | +extern int jbd2_journal_extend(handle_t *handle, int nblocks, | |
| 1369 | + int revoke_records); | |
| 1348 | 1370 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); |
| 1349 | 1371 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); |
| 1350 | 1372 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); |
| @@ -1539,38 +1561,19 @@ static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) · 188 unmodified lines | ||
| 1539 | 1561 | return journal->j_chksum_driver != NULL; |
| 1540 | 1562 | } |
| 1541 | 1563 | |
| 1542 | −/* | |
| 1543 | − * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for | |
| 1544 | − * transaction control blocks. | |
| 1545 | − */ | |
| 1546 | −#define JBD2_CONTROL_BLOCKS_SHIFT 5 | |
| 1547 | − | |
| 1548 | −/* | |
| 1549 | − * Return the minimum number of blocks which must be free in the journal | |
| 1550 | − * before a new transaction may be started. Must be called under j_state_lock. | |
| 1551 | − */ | |
| 1552 | −static inline int jbd2_space_needed(journal_t *journal) | |
| 1553 | −{ | |
| 1554 | − int nblocks = journal->j_max_transaction_buffers; | |
| 1555 | − return nblocks + (nblocks >> JBD2_CONTROL_BLOCKS_SHIFT); | |
| 1556 | −} | |
| 1557 | − | |
| 1558 | 1564 | /* |
| 1559 | 1565 | * Return number of free blocks in the log. Must be called under j_state_lock. |
| 1560 | 1566 | */ |
| 1561 | 1567 | static inline unsigned long jbd2_log_space_left(journal_t *journal) |
| 1562 | 1568 | { |
| 1563 | 1569 | /* Allow for rounding errors */ |
| 1564 | − unsigned long free = journal->j_free - 32; | |
| 1570 | + long free = journal->j_free - 32; | |
| 1565 | 1571 | |
| 1566 | 1572 | if (journal->j_committing_transaction) { |
| 1567 | − unsigned long committing = atomic_read(&journal-> | |
| 1568 | − j_committing_transaction->t_outstanding_credits); | |
| 1569 | − | |
| 1570 | − /* Transaction + control blocks */ | |
| 1571 | − free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT); | |
| 1573 | + free -= atomic_read(&journal-> | |
| 1574 | + j_committing_transaction->t_outstanding_credits); | |
| 1572 | 1575 | } |
| 1573 | − return free; | |
| 1576 | + return max_t(long, free, 0); | |
| 1574 | 1577 | } |
| 1575 | 1578 | |
| 1576 | 1579 | /* |
| @@ -1624,6 +1627,16 @@ static inline tid_t jbd2_get_latest_transaction(journal_t *journal) · 47 unmodified lines | ||
| 1624 | 1627 | return tid; |
| 1625 | 1628 | } |
| 1626 | 1629 | |
| 1630 | + | |
| 1631 | +static inline int jbd2_handle_buffer_credits(handle_t *handle) | |
| 1632 | +{ | |
| 1633 | + journal_t *journal = handle->h_transaction->t_journal; | |
| 1634 | + | |
| 1635 | + return handle->h_total_credits - | |
| 1636 | + DIV_ROUND_UP(handle->h_revoke_credits_requested, | |
| 1637 | + journal->j_revoke_records_per_block); | |
| 1638 | +} | |
| 1639 | + | |
| 1627 | 1640 | #ifdef __KERNEL__ |
| 1628 | 1641 | |
| 1629 | 1642 | #define buffer_trace_init(bh) do {} while (0) |