set bdev->bd_block_size to reduce formatting time

When bdev->bd_block_size is bigger than bytesPerSec, e.g. 1024 bytes,
block write should read first to sync-up the mapped block.
This fix could prevent unnecessary read by temporarily change
bd_block_size to bytesPerSec size while flushing fat data.
bd_block_size would be reconfigured again at open() or mount() time.

Test: newfs_msdos -A /dev/<foo> (/dev/block/sdh1)
    [2TB disk / 32kb cluster] : FAT#1/#2
      476879KiB/512 bytes to write,
      before : 476864 read I/Os (each 1024 bytes) : takes 180 seconds
      after  : 0 read I/Os : takes 20 seconds

Bug: 152893650

Change-Id: Idaa8d73e056cf740647345457ef9061c429f35a7
Signed-off-by: hyeongseok.kim <hyeongseok@gmail.com>
1 file changed