diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-20 20:35:03 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-20 20:35:03 -0400 |
commit | 1261ec42b3d3a3ad878bd172144940e3ac710749 (patch) | |
tree | 4b317d8fa13e56a5dd02f37605b9fed5952d723a /fs/btrfs/disk-io.c | |
parent | 293ffd5fd340428276fbbd24ce7b98bf6728466b (diff) |
Btrfs: Better block record keeping, real mkfs
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index bacaa38ea82e..0322c55162cb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -293,20 +293,15 @@ struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *super) | |||
293 | fs_info->inode_root = inode_root; | 293 | fs_info->inode_root = inode_root; |
294 | fs_info->last_inode_alloc = 0; | 294 | fs_info->last_inode_alloc = 0; |
295 | fs_info->last_inode_alloc_dirid = 0; | 295 | fs_info->last_inode_alloc_dirid = 0; |
296 | fs_info->disk_super = super; | ||
296 | memset(&fs_info->current_insert, 0, sizeof(fs_info->current_insert)); | 297 | memset(&fs_info->current_insert, 0, sizeof(fs_info->current_insert)); |
297 | memset(&fs_info->last_insert, 0, sizeof(fs_info->last_insert)); | 298 | memset(&fs_info->last_insert, 0, sizeof(fs_info->last_insert)); |
298 | 299 | ||
299 | ret = pread(fp, super, sizeof(struct btrfs_super_block), | 300 | ret = pread(fp, super, sizeof(struct btrfs_super_block), |
300 | BTRFS_SUPER_INFO_OFFSET); | 301 | BTRFS_SUPER_INFO_OFFSET); |
301 | if (ret == 0 || btrfs_super_root(super) == 0) { | 302 | if (ret == 0 || btrfs_super_root(super) == 0) { |
302 | printf("making new FS!\n"); | 303 | BUG(); |
303 | ret = mkfs(fp, 0, 1024); | 304 | return NULL; |
304 | if (ret) | ||
305 | return NULL; | ||
306 | ret = pread(fp, super, sizeof(struct btrfs_super_block), | ||
307 | BTRFS_SUPER_INFO_OFFSET); | ||
308 | if (ret != sizeof(struct btrfs_super_block)) | ||
309 | return NULL; | ||
310 | } | 305 | } |
311 | BUG_ON(ret < 0); | 306 | BUG_ON(ret < 0); |
312 | 307 | ||