Skip to content

Commit e760040

Browse files
majianpengtorvalds
authored andcommitted
fs/buffer.c: remove unnecessary init operation after allocating buffer_head.
bh allocation uses kmem_cache_zalloc() so we needn't call 'init_buffer(bh, NULL, NULL)' and perform other set-zero-operations. Signed-off-by: Jianpeng Ma <[email protected]> Cc: Jan Kara <[email protected]> Cc: Theodore Ts'o <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3464046 commit e760040

File tree

3 files changed

+0
-6
lines changed

3 files changed

+0
-6
lines changed

fs/buffer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,6 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
865865

866866
/* Link the buffer to its page */
867867
set_bh_page(bh, page, offset);
868-
869-
init_buffer(bh, NULL, NULL);
870868
}
871869
return head;
872870
/*

fs/jbd/journal.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,6 @@ int journal_write_metadata_buffer(transaction_t *transaction,
310310

311311
new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL);
312312
/* keep subsequent assertions sane */
313-
new_bh->b_state = 0;
314-
init_buffer(new_bh, NULL, NULL);
315313
atomic_set(&new_bh->b_count, 1);
316314
new_jh = journal_add_journal_head(new_bh); /* This sleeps */
317315

fs/jbd2/journal.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
367367
}
368368

369369
/* keep subsequent assertions sane */
370-
new_bh->b_state = 0;
371-
init_buffer(new_bh, NULL, NULL);
372370
atomic_set(&new_bh->b_count, 1);
373371
new_jh = jbd2_journal_add_journal_head(new_bh); /* This sleeps */
374372

0 commit comments

Comments
 (0)