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>
Este commit está contenido en:
@@ -805,10 +805,13 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
|
||||
* But we don't bother doing that, so there will be coherency problems with
|
||||
* mmaps of blockdevs which hold live JBD-controlled filesystems.
|
||||
*/
|
||||
struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
|
||||
struct buffer_head *
|
||||
jbd2_journal_get_descriptor_buffer(transaction_t *transaction, int type)
|
||||
{
|
||||
journal_t *journal = transaction->t_journal;
|
||||
struct buffer_head *bh;
|
||||
unsigned long long blocknr;
|
||||
journal_header_t *header;
|
||||
int err;
|
||||
|
||||
err = jbd2_journal_next_log_block(journal, &blocknr);
|
||||
@@ -821,6 +824,10 @@ struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
|
||||
return NULL;
|
||||
lock_buffer(bh);
|
||||
memset(bh->b_data, 0, journal->j_blocksize);
|
||||
header = (journal_header_t *)bh->b_data;
|
||||
header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
|
||||
header->h_blocktype = cpu_to_be32(type);
|
||||
header->h_sequence = cpu_to_be32(transaction->t_tid);
|
||||
set_buffer_uptodate(bh);
|
||||
unlock_buffer(bh);
|
||||
BUFFER_TRACE(bh, "return this buffer");
|
||||
|
Referencia en una nueva incidencia
Block a user