On 2/28/20 4:27 PM, Qu Wenruo wrote:
On 2020/2/28 下午4:03, Anand Jain wrote:
On aarch64 with pagesize 64k, btrfs-convert of ext4 is successful,
but it won't mount because we don't yet support subpage blocksize/
sectorsize.
BTRFS error (device vda): sectorsize 4096 not supported yet, only support 65536
So in this case during convert provide a warning and a 10s delay to
terminate the command.
This is no different than calling mkfs.btrfs -s 64k on x86 system.
And I see no warning from mkfs.btrfs.
Thus I don't see the point of only introducing such warning to
btrfs-convert.
I have equal weight-age on the choices if blocksize != pagesize viz..
delay and warn (this patch)
quit (Nikolay).
keep it as it is without warning (Qu).
Here we are dealing with already user data. Should it be different
from mkfs?
Quit is fine, but convert tool should it be system neutral?
I am not sure.
David, any idea?
Thanks, Anand
Thanks,
Qu
For example:
WARNING: Blocksize 4096 is not equal to the pagesize 65536,
converted filesystem won't mount on this system.
The operation will start in 10 seconds. Use Ctrl-c to stop it.
10 9 8 7 6 5 4^C
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
convert/main.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/convert/main.c b/convert/main.c
index a04ec7a36abf..f936ec37d30a 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -1140,6 +1140,21 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
error("block size is too small: %u < 4096", blocksize);
goto fail;
}
+ if (blocksize != getpagesize()) {
+ int delay = 10;
+
+ warning("Blocksize %u is not equal to the pagesize %u,\n\
+ converted filesystem won't mount on this system.\n\
+ The operation will start in %d seconds. Use Ctrl-C to stop it.",
+ blocksize, getpagesize(), delay);
+
+ while (delay) {
+ printf("%2d", delay--);
+ fflush(stdout);
+ sleep(1);
+ }
+ }
+
if (btrfs_check_nodesize(nodesize, blocksize, features))
goto fail;
fd = open(devname, O_RDWR);