1
0
mirror of https://gitlab.gnome.org/GNOME/gparted synced 2024-07-02 15:58:47 +00:00

Increase minimum bcachefs size to 32 MiB (!123)

For bcachefs file systems 19 MiB and smaller, the available space is
reported as a very large value.  The calculation went negative in a
64-bit signed value but then was interpreted as an unsiged value.
Writing any significant amount of data to the file system hangs.
    # truncate -s $((19*1024*1024)) /tmp/test.img
    # losetup --find --show /tmp/test.img
    /dev/loop0
    # bcachefs format /dev/loop0
    # mkdir /mnt/0
    # mount /dev/loop0 /mnt/0
    # strace -e statfs df -k /mnt/0
    statfs("/mnt/0", {f_type=0xca451a4e, f_bsize=4096, f_blocks=2305843009213693856,
        f_bfree=2305843009213693600, f_bavail=35474507834056483, f_files=18446744073709529090,
        f_ffree=18446744073709529088, f_fsid={val=[0xddb6645d, 0x8560584]}, f_namelen=512,
        f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
    Filesystem               1K-blocks  Used          Available Use% Mounted on
    /dev/loop0     9223372036854775424  1024 141898031336225932   1% /mnt/0

For a 20 MiB bcachefs the available space is 0 so the file system
overhead is 100%.
    # umount /mnt/0
    # truncate -s $((20*1024*1024)) /tmp/disk.img
    # losetup --set-capacity /dev/loop0
    # bcachefs format --force /dev/loop0
    # mount /dev/loop0 /mnt/0
    # strace -e statfs df -k /mnt/0
    statfs("/mnt/0", {f_type=0xca451a4e, f_bsize=512, f_blocks=1280, f_bfree=0, f_bavail=0,
        f_files=2, f_ffree=0, f_fsid={val=[0x6b3e4926, 0x33f99a32]}, f_namelen=512, f_frsize=512,
        f_flags=ST_VALID|ST_RELATIME}) = 0
    Filesystem     1K-blocks  Used Available Use% Mounted on
    /dev/loop0           640   640         0 100% /mnt/0

For a 32 MiB bcachefs the file system overhead is a more reasonable 9%
so use this as the minimum bcachefs file system size.
    ...
    # truncate -s $((32*1024*1024)) /tmp/disk.img
    ...
    # strace -e statfs df -k /mnt/0
    statfs("/mnt/0", {f_type=0xca451a4e, f_bsize=512, f_blocks=24832, f_bfree=22784,
        f_bavail=22433, f_files=182274, f_ffree=182272, f_fsid={val=[0xfdddedd3, 0xe90be3cb]},
        f_namelen=512, f_frsize=512, f_flags=ST_VALID|ST_RELATIME}) = 0
    Filesystem     1K-blocks  Used Available Use% Mounted on
    /dev/loop0         12416  1024     11217   9% /mnt/0

Closes !123 - Add support for bcachefs, single device file systems only
This commit is contained in:
Mike Fleetwood 2024-03-21 09:14:33 +00:00
parent b891498d0a
commit 0da4f5999a

View File

@ -45,7 +45,7 @@ FS bcachefs::get_filesystem_support()
fs.create_with_label = FS::EXTERNAL;
}
fs_limits.min_size = 16 * MEBIBYTE;
fs_limits.min_size = 32 * MEBIBYTE;
return fs;
}