Skip to contentSkip to conversation

Btrfs-progs: convert: do not clear nodatasum flag in inode item

PATCH Applied Liu Bo 3 participants 3 messages Jun 28, 2017 – Jun 30, 2017 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Btrfs-progs: convert: do not clear nodatasum flag in inode item

With the current btrfs-convert, if we convert a ext4 without data checksum, it'd not set nodatasum flag in inode item, nor create csum item, reading file ends up with checksum errors.

---
 convert/source-ext2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
convert/source-ext2.c +1 -1
index 1b0576b..64b95c5 100644
@@ -742,7 +742,7 @@ static int ext2_check_state(struct btrfs_convert_context *cctx)
 static void ext2_convert_inode_flags(struct btrfs_inode_item *dst,
 				     struct ext2_inode *src)
 {
-	u64 flags = 0;
+	u64 flags = btrfs_stack_inode_flags(dst);
 
 	COPY_ONE_EXT2_FLAG(flags, src, APPEND);
 	COPY_ONE_EXT2_FLAG(flags, src, SYNC);
Signature · 1 line
2.5.0
#1 lore raw

Could you please add also a test-script for this interesting issue under tests/convert-tests
(If its not already there)?. thanks.

----
Cheers,
Lakshmipathi.G
http://www.giis.co.in http://www.webminal.org

Quoted 29 lines · Liu Bo

With the current btrfs-convert, if we convert a ext4 without data checksum, it'd not set nodatasum flag in inode item, nor create csum item, reading file ends up with checksum errors.

---
 convert/source-ext2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
convert/source-ext2.c +1 -2
index 1b0576b..64b95c5 100644
@@ -742,7 +742,7 @@ static int ext2_check_state(struct btrfs_convert_context *cctx)
 static void ext2_convert_inode_flags(struct btrfs_inode_item *dst,
                                     struct ext2_inode *src)
 {
-       u64 flags = 0;
+       u64 flags = btrfs_stack_inode_flags(dst);
 
        COPY_ONE_EXT2_FLAG(flags, src, APPEND);
        COPY_ONE_EXT2_FLAG(flags, src, SYNC);
--

2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#2 lore raw
In reply to Liu Bo
Quoted 5 lines · Liu Bo

With the current btrfs-convert, if we convert a ext4 without data checksum, it'd not set nodatasum flag in inode item, nor create csum item, reading file ends up with checksum errors.

Applied, thanks.