* [PATCH]btrfs-progs: btrfs-convert.c : check source file system state
@ 2016-09-15 12:08 Lakshmipathi.G
2016-09-19 17:10 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Lakshmipathi.G @ 2016-09-15 12:08 UTC (permalink / raw)
To: linux-btrfs
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
---
btrfs-convert.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/btrfs-convert.c b/btrfs-convert.c
index c10dc17..27da9ce 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2171,6 +2171,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
@@ -2340,6 +2351,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 e2fsck is recommended.");
ret = convert_read_used_space(&cctx);
if (ret)
goto fail;
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]btrfs-progs: btrfs-convert.c : check source file system state
2016-09-15 12:08 [PATCH]btrfs-progs: btrfs-convert.c : check source file system state Lakshmipathi.G
@ 2016-09-19 17:10 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-09-19 17:10 UTC (permalink / raw)
To: Lakshmipathi.G; +Cc: linux-btrfs
On Thu, Sep 15, 2016 at 02:08:52PM +0200, Lakshmipathi.G wrote:
> Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
> ---
> btrfs-convert.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/btrfs-convert.c b/btrfs-convert.c
> index c10dc17..27da9ce 100644
> --- a/btrfs-convert.c
> +++ b/btrfs-convert.c
> @@ -2171,6 +2171,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
> @@ -2340,6 +2351,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 e2fsck is recommended.");
I'm wondering if this should be a hard error or not, I'll leave it as a
warning for now.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-19 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 12:08 [PATCH]btrfs-progs: btrfs-convert.c : check source file system state Lakshmipathi.G
2016-09-19 17:10 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.