btrfs-progs: build: fix the test for EXT4_EPOCH_MASK

Commit b3df561fbf ("btrfs-progs: convert: copy extra timespec on
ext4") has introduced the ability to convert extended inode time
precision on ext4, but this breaks builds on older distros, where ext4
does not have the nsec time precision.

Commit c615287cc0 ("btrfs-progs: a bunch of typo fixes") tried to fix
that by testing the availability of the EXT4_EPOCH_MASK macro, but the
test is not complete.

This patch aims at fixing the macro test, and changes the
name of the associated HAVE_ macro, since the logic is reverted.

This fixes #353 when ext4 has nsec time precision. Note that the test
convert/019-ext4-copy-timestamps fails when ext4 does not have the nsec
time precision and needs to check for the support.

Issue: #353
Signed-off-by: Pierre Labastie <pierre.labastie@neuf.fr>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Pierre Labastie 2021-03-14 19:49:13 +01:00 committed by David Sterba
parent 3a22f0b25b
commit 1b49370973
2 changed files with 7 additions and 7 deletions

View File

@ -251,10 +251,10 @@ else
AC_DEFINE([HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE], [0], [We did not define FIEMAP_EXTENT_SHARED])
fi
HAVE_OWN_EXT4_EPOCH_MASK_DEFINE=0
AX_CHECK_DEFINE([ext2fs/ext2_fs.h], [EXT4_EPOCH_MASK], [],
[HAVE_OWN_EXT4_EPOCH_MASK_DEFINE=1
AC_MSG_WARN([no definition of EXT4_EPOCH_MASK found, probably old e2fsprogs, will use own definition, no 64bit time precision of converted images])])
AX_CHECK_DEFINE([ext2fs/ext2_fs.h], [EXT4_EPOCH_MASK],
[AC_DEFINE([HAVE_EXT4_EPOCH_MASK_DEFINE], [1],
[Define to 1 if e2fsprogs defines EXT4_EPOCH_MASK])],
[AC_MSG_WARN([no definition of EXT4_EPOCH_MASK found, probably old e2fsprogs, no 64bit time precision of converted images])])
dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config
dnl

View File

@ -698,7 +698,7 @@ static void ext2_copy_inode_item(struct btrfs_inode_item *dst,
memset(&dst->reserved, 0, sizeof(dst->reserved));
}
#if HAVE_OWN_EXT4_EPOCH_MASK_DEFINE
#if HAVE_EXT4_EPOCH_MASK_DEFINE
/*
* Copied and modified from fs/ext4/ext4.h
@ -769,7 +769,7 @@ out:
return ret;
}
#else /* HAVE_OWN_EXT4_EPOCH_MASK_DEFINE */
#else /* HAVE_EXT4_EPOCH_MASK_DEFINE */
static int ext4_copy_inode_timespec_extra(struct btrfs_inode_item *dst,
ext2_ino_t ext2_ino, u32 s_inode_size,
@ -786,7 +786,7 @@ static int ext4_copy_inode_timespec_extra(struct btrfs_inode_item *dst,
return 0;
}
#endif /* !HAVE_OWN_EXT4_EPOCH_MASK_DEFINE */
#endif /* !HAVE_EXT4_EPOCH_MASK_DEFINE */
static int ext2_check_state(struct btrfs_convert_context *cctx)
{