diff options
Diffstat (limited to 'fsck')
-rw-r--r-- | fsck/main.c | 4 | ||||
-rw-r--r-- | fsck/mount.c | 34 |
2 files changed, 35 insertions, 3 deletions
diff --git a/fsck/main.c b/fsck/main.c index 64537cc..39ef8d3 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -301,7 +301,7 @@ void f2fs_parse_options(int argc, char *argv[]) else if (c.func == SLOAD) sload_usage(); } - c.device_name = argv[optind]; + c.devices[0].path = strdup(argv[optind]); } static void do_fsck(struct f2fs_sb_info *sbi) @@ -474,7 +474,7 @@ int main(int argc, char **argv) f2fs_parse_options(argc, argv); - if (f2fs_dev_is_umounted() < 0) { + if (f2fs_devs_are_umounted() < 0) { if (!c.ro || c.func == DEFRAG) { MSG(0, "\tError: Not available on mounted device!\n"); return -1; diff --git a/fsck/mount.c b/fsck/mount.c index 9fcb008..6c29a1a 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -400,7 +400,7 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, u64 offset) return -1; /* Check zoned block device feature */ - if (c.zoned_model == F2FS_ZONED_HM && + if (c.devices[0].zoned_model == F2FS_ZONED_HM && !(sb->feature & cpu_to_le32(F2FS_FEATURE_BLKZONED))) { MSG(0, "\tMissing zoned block device feature\n"); return -1; @@ -470,6 +470,7 @@ int init_sb_info(struct f2fs_sb_info *sbi) { struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); u64 total_sectors; + int i; sbi->log_sectors_per_block = get_sb(log_sectors_per_block); sbi->log_blocksize = get_sb(log_blocksize); @@ -486,6 +487,37 @@ int init_sb_info(struct f2fs_sb_info *sbi) sbi->meta_ino_num = get_sb(meta_ino); sbi->cur_victim_sec = NULL_SEGNO; + for (i = 0; i < MAX_DEVICES; i++) { + if (!sb->devs[i].path[0]) + break; + + if (i) { + c.devices[i].path = strdup((char *)sb->devs[i].path); + if (get_device_info(i)) + ASSERT(0); + } else { + ASSERT(!strcmp((char *)sb->devs[i].path, + (char *)c.devices[i].path)); + } + + c.devices[i].total_segments = + le32_to_cpu(sb->devs[i].total_segments); + if (i) + c.devices[i].start_blkaddr = + c.devices[i - 1].end_blkaddr + 1; + c.devices[i].end_blkaddr = c.devices[i].start_blkaddr + + c.devices[i].total_segments * + c.blks_per_seg - 1; + if (i == 0) + c.devices[i].end_blkaddr += get_sb(segment0_blkaddr); + + c.ndevs = i + 1; + MSG(0, "Info: Device[%d] : %s blkaddr = %"PRIx64"--%"PRIx64"\n", + i, c.devices[i].path, + c.devices[i].start_blkaddr, + c.devices[i].end_blkaddr); + } + total_sectors = get_sb(block_count) << sbi->log_sectors_per_block; MSG(0, "Info: total FS sectors = %"PRIu64" (%"PRIu64" MB)\n", total_sectors, total_sectors >> |