Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] fs/btrfs: remove destination file before generation
@ 2018-08-25 17:47 Yann E. MORIN
  2018-08-25 22:02 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Yann E. MORIN @ 2018-08-25 17:47 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Robert J. Heywood <robert.heywood@codethink.co.uk>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 fs/btrfs/btrfs.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/btrfs.mk b/fs/btrfs/btrfs.mk
index ad00153c26..94bc499084 100644
--- a/fs/btrfs/btrfs.mk
+++ b/fs/btrfs/btrfs.mk
@@ -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
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] fs/btrfs: remove destination file before generation
  2018-08-25 17:47 [Buildroot] [PATCH] fs/btrfs: remove destination file before generation Yann E. MORIN
@ 2018-08-25 22:02 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2018-08-25 22:02 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 25 Aug 2018 19:47:14 +0200, Yann E. MORIN wrote:

>  define ROOTFS_BTRFS_CMD
> +	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
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-25 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-25 17:47 [Buildroot] [PATCH] fs/btrfs: remove destination file before generation Yann E. MORIN
2018-08-25 22:02 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox