diff mbox

[next] usb_modeswitch_data: install packed database

Message ID fbab82af999db5392fe2ae2f671531ff91f801b9.1488260265.git.baruch@tkos.co.il
State Rejected
Headers show

Commit Message

Baruch Siach Feb. 28, 2017, 5:37 a.m. UTC
The packed databased is significantly smaller than the unpacked. The unpacked
database is made of hundreds of small files. So the benefit is larger
filesystems that allocate a minimum of block per file. Database packing adds
some overhead to every invocation of usb_modeswitch. This added overhead
should not be noticeable in practice since usb_modeswitch normally runs only
once per USB device insert event.

Before:

  du -h output/target/usr/share/usb_modeswitch/
  1.9M	output/target/usr/share/usb_modeswitch/

After:

  du -h output/target/usr/share/usb_modeswitch/
  20K	output/target/usr/share/usb_modeswitch/

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 package/usb_modeswitch_data/usb_modeswitch_data.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Baruch Siach March 1, 2017, 9:21 a.m. UTC | #1
Hi Buildroot list,

On Tue, Feb 28, 2017 at 07:37:45AM +0200, Baruch Siach wrote:
> The packed databased is significantly smaller than the unpacked. The unpacked
> database is made of hundreds of small files. So the benefit is larger
> filesystems that allocate a minimum of block per file. Database packing adds
> some overhead to every invocation of usb_modeswitch. This added overhead
> should not be noticeable in practice since usb_modeswitch normally runs only
> once per USB device insert event.

This turns out to be not such a great idea, since our Busybox tar build does 
not support the 'z' command line option. The tcl script embedded in  
usb_modeswitch_dispatcher relies on this option to extract device information 
entries from the packed database.

baruch

> 
> Before:
> 
>   du -h output/target/usr/share/usb_modeswitch/
>   1.9M	output/target/usr/share/usb_modeswitch/
> 
> After:
> 
>   du -h output/target/usr/share/usb_modeswitch/
>   20K	output/target/usr/share/usb_modeswitch/
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  package/usb_modeswitch_data/usb_modeswitch_data.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/usb_modeswitch_data/usb_modeswitch_data.mk b/package/usb_modeswitch_data/usb_modeswitch_data.mk
> index 6d75b3198310..8373b6e2ca20 100644
> --- a/package/usb_modeswitch_data/usb_modeswitch_data.mk
> +++ b/package/usb_modeswitch_data/usb_modeswitch_data.mk
> @@ -14,7 +14,7 @@ USB_MODESWITCH_DATA_LICENSE_FILES = COPYING
>  # Nothing to build, it is a pure data package
>  
>  define USB_MODESWITCH_DATA_INSTALL_TARGET_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-packed
>  endef
>  
>  $(eval $(generic-package))
Thomas Petazzoni March 1, 2017, 9:32 a.m. UTC | #2
Hello,

On Wed, 1 Mar 2017 11:21:34 +0200, Baruch Siach wrote:

> On Tue, Feb 28, 2017 at 07:37:45AM +0200, Baruch Siach wrote:
> > The packed databased is significantly smaller than the unpacked. The unpacked
> > database is made of hundreds of small files. So the benefit is larger
> > filesystems that allocate a minimum of block per file. Database packing adds
> > some overhead to every invocation of usb_modeswitch. This added overhead
> > should not be noticeable in practice since usb_modeswitch normally runs only
> > once per USB device insert event.  
> 
> This turns out to be not such a great idea, since our Busybox tar build does 
> not support the 'z' command line option. The tcl script embedded in  
> usb_modeswitch_dispatcher relies on this option to extract device information 
> entries from the packed database.

Can we adapt the TCL code to do:

	gunzip -dc <file> | tar -xf -

Thomas
Baruch Siach March 1, 2017, 9:46 a.m. UTC | #3
Hi Thomas,

On Wed, Mar 01, 2017 at 10:32:28AM +0100, Thomas Petazzoni wrote:
> On Wed, 1 Mar 2017 11:21:34 +0200, Baruch Siach wrote:
> > On Tue, Feb 28, 2017 at 07:37:45AM +0200, Baruch Siach wrote:
> > > The packed databased is significantly smaller than the unpacked. The unpacked
> > > database is made of hundreds of small files. So the benefit is larger
> > > filesystems that allocate a minimum of block per file. Database packing adds
> > > some overhead to every invocation of usb_modeswitch. This added overhead
> > > should not be noticeable in practice since usb_modeswitch normally runs only
> > > once per USB device insert event.  
> > 
> > This turns out to be not such a great idea, since our Busybox tar build does 
> > not support the 'z' command line option. The tcl script embedded in  
> > usb_modeswitch_dispatcher relies on this option to extract device information 
> > entries from the packed database.
> 
> Can we adapt the TCL code to do:
> 
> 	gunzip -dc <file> | tar -xf -

Of course. But that is something for upstream to deal with. As I'm much more 
time constrained than space constrained at the moment, I'll leave that to 
someone else.

baruch
diff mbox

Patch

diff --git a/package/usb_modeswitch_data/usb_modeswitch_data.mk b/package/usb_modeswitch_data/usb_modeswitch_data.mk
index 6d75b3198310..8373b6e2ca20 100644
--- a/package/usb_modeswitch_data/usb_modeswitch_data.mk
+++ b/package/usb_modeswitch_data/usb_modeswitch_data.mk
@@ -14,7 +14,7 @@  USB_MODESWITCH_DATA_LICENSE_FILES = COPYING
 # Nothing to build, it is a pure data package
 
 define USB_MODESWITCH_DATA_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-packed
 endef
 
 $(eval $(generic-package))