* [PATCH v2] btrfs-progs: btrfs-convert: Add larger device support
@ 2017-05-13 12:56 Lakshmipathi.G
[not found] ` <b9f29fde-1e8a-d481-971a-b1951bf9b2a8@cn.fujitsu.com>
0 siblings, 1 reply; 4+ messages in thread
From: Lakshmipathi.G @ 2017-05-13 12:56 UTC (permalink / raw)
To: dsterba, Qu Wenruo, btrfs
With larger file system (in this case its 22TB), ext2fs_open() returns
EXT2_ET_CANT_USE_LEGACY_BITMAPS error message with ext2fs_read_block_bitmap().
To overcome this issue, we need pass EXT2_FLAG_64BITS flag with ext2fs_open
and also use 64-bit functions like ext2fs_get_block_bitmap_range2,
ext2fs_inode_data_blocks2,ext2fs_read_ext_attr2
bug: https://bugzilla.kernel.org/show_bug.cgi?id=194795
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
---
convert/source-ext2.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/convert/source-ext2.c b/convert/source-ext2.c
index 1b0576b..275cb89 100644
--- a/convert/source-ext2.c
+++ b/convert/source-ext2.c
@@ -34,8 +34,9 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name)
ext2_filsys ext2_fs;
ext2_ino_t ino;
u32 ro_feature;
+ int open_flag = EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS;
- ret = ext2fs_open(name, 0, 0, 0, unix_io_manager, &ext2_fs);
+ ret = ext2fs_open(name, open_flag, 0, 0, unix_io_manager, &ext2_fs);
if (ret) {
fprintf(stderr, "ext2fs_open: %s\n", error_message(ret));
return -1;
@@ -148,7 +149,7 @@ static int ext2_read_used_space(struct btrfs_convert_context *cctx)
return -ENOMEM;
for (i = 0; i < fs->group_desc_count; i++) {
- ret = ext2fs_get_block_bitmap_range(fs->block_map, blk_itr,
+ ret = ext2fs_get_block_bitmap_range2(fs->block_map, blk_itr,
block_nbytes * 8, block_bitmap);
if (ret) {
error("fail to get bitmap from ext2, %s",
@@ -353,7 +354,7 @@ static int ext2_create_symlink(struct btrfs_trans_handle *trans,
int ret;
char *pathname;
u64 inode_size = btrfs_stack_inode_size(btrfs_inode);
- if (ext2fs_inode_data_blocks(ext2_fs, ext2_inode)) {
+ if (ext2fs_inode_data_blocks2(ext2_fs, ext2_inode)) {
btrfs_set_stack_inode_size(btrfs_inode, inode_size + 1);
ret = ext2_create_file_extents(trans, root, objectid,
btrfs_inode, ext2_fs, ext2_ino,
@@ -627,9 +628,9 @@ static int ext2_copy_extended_attrs(struct btrfs_trans_handle *trans,
ret = -ENOMEM;
goto out;
}
- err = ext2fs_read_ext_attr(ext2_fs, ext2_inode->i_file_acl, buffer);
+ err = ext2fs_read_ext_attr2(ext2_fs, ext2_inode->i_file_acl, buffer);
if (err) {
- fprintf(stderr, "ext2fs_read_ext_attr: %s\n",
+ fprintf(stderr, "ext2fs_read_ext_attr2: %s\n",
error_message(err));
ret = -1;
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: btrfs-convert: Add larger device support
[not found] ` <b9f29fde-1e8a-d481-971a-b1951bf9b2a8@cn.fujitsu.com>
@ 2017-05-15 8:36 ` Lakshmipathi.G
2017-05-30 17:20 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: Lakshmipathi.G @ 2017-05-15 8:36 UTC (permalink / raw)
To: Qu Wenruo; +Cc: dsterba, btrfs
On Mon, May 15, 2017 at 09:40:29AM +0800, Qu Wenruo wrote:
> >bug: https://bugzilla.kernel.org/show_bug.cgi?id=194795
>
> Errr, it seems that you forgot to update ext2_open_fs() to update how we get
> cctx->block_counts.
>
> Without that update, we still get wrong total size of original fs, so
> converted image will be corrupted.
>
> In this 22T case, it can't pass convert test since after conversion,
> converted image can't pass e2fsck.
>
> Thanks,
> Qu
>
Thanks for pointing out the issue. So we need to update
common.h/cctx->block_count from u32 to u64?
do we also need to change other fields like inodes_count and
free_inode_count?
Cheers.
Lakshmipathi.G
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: btrfs-convert: Add larger device support
2017-05-15 8:36 ` Lakshmipathi.G
@ 2017-05-30 17:20 ` David Sterba
2017-06-02 3:16 ` Lakshmipathi.G
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2017-05-30 17:20 UTC (permalink / raw)
To: Lakshmipathi.G; +Cc: Qu Wenruo, dsterba, btrfs
On Mon, May 15, 2017 at 02:06:54PM +0530, Lakshmipathi.G wrote:
> On Mon, May 15, 2017 at 09:40:29AM +0800, Qu Wenruo wrote:
> > >bug: https://bugzilla.kernel.org/show_bug.cgi?id=194795
> >
> > Errr, it seems that you forgot to update ext2_open_fs() to update how we get
> > cctx->block_counts.
> >
> > Without that update, we still get wrong total size of original fs, so
> > converted image will be corrupted.
> >
> > In this 22T case, it can't pass convert test since after conversion,
> > converted image can't pass e2fsck.
> >
> > Thanks,
> > Qu
> >
>
> Thanks for pointing out the issue. So we need to update
> common.h/cctx->block_count from u32 to u64?
I think we should use the 64bit types just to be safe.
> do we also need to change other fields like inodes_count and
> free_inode_count?
Yes please.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: btrfs-convert: Add larger device support
2017-05-30 17:20 ` David Sterba
@ 2017-06-02 3:16 ` Lakshmipathi.G
0 siblings, 0 replies; 4+ messages in thread
From: Lakshmipathi.G @ 2017-06-02 3:16 UTC (permalink / raw)
To: dsterba, Qu Wenruo, btrfs
>
> I think we should use the 64bit types just to be safe.
>
Dave, Okay made those changes and new patch sent.
>If we need to modify tons of things, then please split such modification to
>different patches.
Qu, Seems like only minor changes needed, so used a single patch.
Cheers.
Lakshmipathi.G
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-02 3:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-13 12:56 [PATCH v2] btrfs-progs: btrfs-convert: Add larger device support Lakshmipathi.G
[not found] ` <b9f29fde-1e8a-d481-971a-b1951bf9b2a8@cn.fujitsu.com>
2017-05-15 8:36 ` Lakshmipathi.G
2017-05-30 17:20 ` David Sterba
2017-06-02 3:16 ` Lakshmipathi.G
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.