Skip to content

Commit

Permalink
ext4: Do not clear zalloc'ed buffers a second time
Browse files Browse the repository at this point in the history
zero_buffer is never written, thus clearing it is pointless.
journal_buffer is completely initialized by ext4fs_devread (or in case
of failure, not used).

Signed-off-by: Stefan Brüns <[email protected]>
Reviewed-by: Lukasz Majewski <[email protected]>
  • Loading branch information
StefanBruens authored and trini committed Sep 23, 2016
1 parent 398d6fa commit e927265
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions fs/ext4/ext4_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ uint32_t ext4fs_get_new_blk_no(void)

if (le16_to_cpu(bgd[bg_idx].bg_flags) & EXT4_BG_BLOCK_UNINIT) {
uint16_t new_flags;
memset(zero_buffer, '\0', fs->blksz);
put_ext4((uint64_t)le32_to_cpu(bgd[bg_idx].block_id) * fs->blksz,
zero_buffer, fs->blksz);
memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz);
Expand All @@ -946,7 +945,6 @@ uint32_t ext4fs_get_new_blk_no(void)

/* journal backup */
if (prev_bg_bitmap_index != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
status = ext4fs_devread(
(lbaint_t)le32_to_cpu(bgd[bg_idx].block_id)
* fs->sect_perblk,
Expand Down Expand Up @@ -1040,7 +1038,6 @@ int ext4fs_get_new_inode_no(void)
ibmap_idx = fs->curr_inode_no / inodes_per_grp;
if (le16_to_cpu(bgd[ibmap_idx].bg_flags) & EXT4_BG_INODE_UNINIT) {
int new_flags;
memset(zero_buffer, '\0', fs->blksz);
put_ext4((uint64_t)le32_to_cpu(bgd[ibmap_idx].inode_id) * fs->blksz,
zero_buffer, fs->blksz);
new_flags = le16_to_cpu(bgd[ibmap_idx].bg_flags) & ~EXT4_BG_INODE_UNINIT;
Expand Down

0 comments on commit e927265

Please sign in to comment.