cmd_device_set_state: use buffered IO for writing superblock

The layout may be unaligned on 4k sector devices - but there's no reason
we need to use direct IO here.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-07-11 23:06:17 -04:00
parent cc1f2deb96
commit a29cb4b9f8

View File

@ -418,9 +418,12 @@ int cmd_device_set_state(int argc, char *argv[])
le64_add_cpu(&sb.sb->seq, 1);
bch2_super_write(sb.bdev->bd_fd, sb.sb);
bch2_super_write(sb.bdev->bd_buffered_fd, sb.sb);
ret = fsync(sb.bdev->bd_buffered_fd);
if (ret)
fprintf(stderr, "error writing superblock: fsync error (%m)");
bch2_free_super(&sb);
return 0;
return ret;
}
char *fs_path = arg_pop();