mkfs should initialize unused fields properly
authorJan Schmidt <list.btrfs@jan-o-sch.net>
Fri, 19 Nov 2010 15:05:27 +0000 (16:05 +0100)
committerChris Mason <chris.mason@oracle.com>
Tue, 25 Oct 2011 13:18:32 +0000 (09:18 -0400)
commit42f9568bfdbec6a294320b955e28ccd9c7178a01
tree5f1b38a4f75485c1d0632e817f78f67fc8346243
parentc55248003ca39fa5d102c795474029bf1cfec999
mkfs should initialize unused fields properly

we discovered speed setting is (probably unintentionally) initialized to 1 in make_btrfs(), while being initialized to 0 in btrfs_add_to_fsid(). initialization in make_btrfs() is due to reuse of buf after pwrite() without clearing it. consequently, code like

  btrfs_set_extent_generation(buf, extent_item, 1);

writes to the same location in buf where speed will be placed, later. It may be a good idea to clear buf after each pwrite(), though leaving the struct btrfs_header intact.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
utils.c