btrfs-progs: convert: make ext2 compilation honor the configure options

Now ext2 conversion will be built in iff it's selected by --with-convert
option. Default is yes.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-08-23 18:05:56 +02:00
parent d7244f9582
commit e0c6cf3c0e
1 changed files with 14 additions and 1 deletions

View File

@ -38,12 +38,12 @@
#include "utils.h" #include "utils.h"
#include "task-utils.h" #include "task-utils.h"
#if BTRFSCONVERT_EXT2
#include <ext2fs/ext2_fs.h> #include <ext2fs/ext2_fs.h>
#include <ext2fs/ext2fs.h> #include <ext2fs/ext2fs.h>
#include <ext2fs/ext2_ext_attr.h> #include <ext2fs/ext2_ext_attr.h>
#define INO_OFFSET (BTRFS_FIRST_FREE_OBJECTID - EXT2_ROOT_INO) #define INO_OFFSET (BTRFS_FIRST_FREE_OBJECTID - EXT2_ROOT_INO)
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
/* /*
* Compatibility code for e2fsprogs 1.41 which doesn't support RO compat flag * Compatibility code for e2fsprogs 1.41 which doesn't support RO compat flag
@ -57,6 +57,10 @@
#define EXT2FS_B2C(fs, blk) (blk) #define EXT2FS_B2C(fs, blk) (blk)
#endif #endif
#endif
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
struct task_ctx { struct task_ctx {
uint32_t max_copy_inodes; uint32_t max_copy_inodes;
uint32_t cur_copy_inodes; uint32_t cur_copy_inodes;
@ -1392,6 +1396,8 @@ static int prepare_system_chunk_sb(struct btrfs_super_block *super)
return 0; return 0;
} }
#if BTRFSCONVERT_EXT2
/* /*
* Open Ext2fs in readonly mode, read block allocation bitmap and * Open Ext2fs in readonly mode, read block allocation bitmap and
* inode bitmap into memory. * inode bitmap into memory.
@ -2249,8 +2255,12 @@ static const struct btrfs_convert_operations ext2_convert_ops = {
.close_fs = ext2_close_fs, .close_fs = ext2_close_fs,
}; };
#endif
static const struct btrfs_convert_operations *convert_operations[] = { static const struct btrfs_convert_operations *convert_operations[] = {
#if BTRFSCONVERT_EXT2
&ext2_convert_ops, &ext2_convert_ops,
#endif
}; };
static int convert_open_fs(const char *devname, static int convert_open_fs(const char *devname,
@ -2929,6 +2939,9 @@ static void print_usage(void)
printf("\t-p|--progress show converting progress (default)\n"); printf("\t-p|--progress show converting progress (default)\n");
printf("\t-O|--features LIST comma separated list of filesystem features\n"); printf("\t-O|--features LIST comma separated list of filesystem features\n");
printf("\t--no-progress show only overview, not the detailed progress\n"); printf("\t--no-progress show only overview, not the detailed progress\n");
printf("\n");
printf("Suported filesystems:\n");
printf("\text2/3/4: %s\n", BTRFSCONVERT_EXT2 ? "yes" : "no");
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])