diff options
author | Lakshmipathi.G <Lakshmipathi.G@giis.co.in> | 2016-09-15 14:08:52 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-10-03 11:35:49 +0200 |
commit | b56fe169227a17bc92dea2fa399d1fb77e7cd233 (patch) | |
tree | 6baf8d20aae8246a2913fcbe02f0199113622250 /btrfs-convert.c | |
parent | 2a9daceb07fff04e4a54d5cce6607f1fa253a73f (diff) |
btrfs-progs: convert: check source file system state
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ add doc note ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-convert.c')
-rw-r--r-- | btrfs-convert.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/btrfs-convert.c b/btrfs-convert.c index 727bfea1..a62d2f01 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -2183,6 +2183,17 @@ static void ext2_copy_inode_item(struct btrfs_inode_item *dst, } memset(&dst->reserved, 0, sizeof(dst->reserved)); } +static int check_filesystem_state(struct btrfs_convert_context *cctx) +{ + ext2_filsys fs = cctx->fs_data; + + if (!(fs->super->s_state & EXT2_VALID_FS)) + return 1; + else if (fs->super->s_state & EXT2_ERROR_FS) + return 1; + else + return 0; +} /* * copy a single inode. do all the required works, such as cloning @@ -2352,6 +2363,10 @@ static int do_convert(const char *devname, int datacsum, int packing, ret = convert_open_fs(devname, &cctx); if (ret) goto fail; + ret = check_filesystem_state(&cctx); + if (ret) + warning( + "source filesystem is not clean, running filesystem check is recommended"); ret = convert_read_used_space(&cctx); if (ret) goto fail; |