diff options
author | Jan Kara <jack@suse.cz> | 2016-02-22 23:17:15 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-02-22 23:17:15 -0500 |
commit | 32ab671599a89534f37e97d146c27690e371b661 (patch) | |
tree | 6fe66460f49b278a6c7115fe2d3d03733c91bc2f /fs/jbd2/commit.c | |
parent | 9bcf976cb8b86eb40e0c0b495a14e4cb967b9c6e (diff) |
jbd2: factor out common descriptor block initialization
Descriptor block header is initialized in several places. Factor out the
common code into jbd2_journal_get_descriptor_buffer().
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index ae4402d15d46..cf221f3d955a 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -131,14 +131,12 @@ static int journal_submit_commit_record(journal_t *journal, | |||
131 | if (is_journal_aborted(journal)) | 131 | if (is_journal_aborted(journal)) |
132 | return 0; | 132 | return 0; |
133 | 133 | ||
134 | bh = jbd2_journal_get_descriptor_buffer(journal); | 134 | bh = jbd2_journal_get_descriptor_buffer(commit_transaction, |
135 | JBD2_COMMIT_BLOCK); | ||
135 | if (!bh) | 136 | if (!bh) |
136 | return 1; | 137 | return 1; |
137 | 138 | ||
138 | tmp = (struct commit_header *)bh->b_data; | 139 | tmp = (struct commit_header *)bh->b_data; |
139 | tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); | ||
140 | tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); | ||
141 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); | ||
142 | tmp->h_commit_sec = cpu_to_be64(now.tv_sec); | 140 | tmp->h_commit_sec = cpu_to_be64(now.tv_sec); |
143 | tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec); | 141 | tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec); |
144 | 142 | ||
@@ -379,7 +377,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
379 | ktime_t start_time; | 377 | ktime_t start_time; |
380 | u64 commit_time; | 378 | u64 commit_time; |
381 | char *tagp = NULL; | 379 | char *tagp = NULL; |
382 | journal_header_t *header; | ||
383 | journal_block_tag_t *tag = NULL; | 380 | journal_block_tag_t *tag = NULL; |
384 | int space_left = 0; | 381 | int space_left = 0; |
385 | int first_tag = 0; | 382 | int first_tag = 0; |
@@ -615,7 +612,9 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
615 | 612 | ||
616 | jbd_debug(4, "JBD2: get descriptor\n"); | 613 | jbd_debug(4, "JBD2: get descriptor\n"); |
617 | 614 | ||
618 | descriptor = jbd2_journal_get_descriptor_buffer(journal); | 615 | descriptor = jbd2_journal_get_descriptor_buffer( |
616 | commit_transaction, | ||
617 | JBD2_DESCRIPTOR_BLOCK); | ||
619 | if (!descriptor) { | 618 | if (!descriptor) { |
620 | jbd2_journal_abort(journal, -EIO); | 619 | jbd2_journal_abort(journal, -EIO); |
621 | continue; | 620 | continue; |
@@ -624,11 +623,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
624 | jbd_debug(4, "JBD2: got buffer %llu (%p)\n", | 623 | jbd_debug(4, "JBD2: got buffer %llu (%p)\n", |
625 | (unsigned long long)descriptor->b_blocknr, | 624 | (unsigned long long)descriptor->b_blocknr, |
626 | descriptor->b_data); | 625 | descriptor->b_data); |
627 | header = (journal_header_t *)descriptor->b_data; | ||
628 | header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); | ||
629 | header->h_blocktype = cpu_to_be32(JBD2_DESCRIPTOR_BLOCK); | ||
630 | header->h_sequence = cpu_to_be32(commit_transaction->t_tid); | ||
631 | |||
632 | tagp = &descriptor->b_data[sizeof(journal_header_t)]; | 626 | tagp = &descriptor->b_data[sizeof(journal_header_t)]; |
633 | space_left = descriptor->b_size - | 627 | space_left = descriptor->b_size - |
634 | sizeof(journal_header_t); | 628 | sizeof(journal_header_t); |