fs/btrfs: remove destination file before generation
PATCH 1/1 fs/btrfs: remove destination file before generation
btrfs will happily use an existing destination file if it already exists, increasing its size if needed. Hoever, it will never decrease the size, even if the requested size is smaller than the existing file.
So, remove any previously existing destination file before generating the new filesystem.
Note: the original submission by Robert did that, but as this case was not obvious, the removal was dropped by a refactoring when the patch was initially applied.
--- fs/btrfs/btrfs.mk | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/btrfs.mk +1 -0
@@ -29,6 +29,7 @@ BTRFS_OPTS = \ ROOTFS_BTRFS_DEPENDENCIES = host-btrfs-progs define ROOTFS_BTRFS_CMD + rm -f $(@) $(HOST_DIR)/bin/mkfs.btrfs $(BTRFS_OPTS) $@ endef
Signature · 1 line
2.14.1
PATCH 1/1 fs/btrfs: remove destination file before generation
Hello,
fs/btrfs/btrfs.mk BTRFS_OPTS = \ · line 32
Quoted 2 lines · Yann E. MORIN
define
ROOTFS_BTRFS_CMDfs/btrfs/btrfs.mk +1
-0+ rm -f $(@)
I changed to use $(RM) instead of rm, and $@ instead of $(@), since we use $@ everywhere.
With those changes: applied to next. Thanks for noticing this mistake in my changes to Robert's patch!
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com