git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Understanding version 4 packs

From
Nicolas Pitre <nico@cam.org>
Date
Mar 26, 2007, 18:43 UTC
Message-ID
<alpine.LFD.0.83.0703261417520.3041@xanadu.home>
In-Reply-To
<e5bfff550703261010u67aa1207j1c6f0200bb7744a@mail.gmail.com>
On Mon, 26 Mar 2007, Marco Costalba wrote:
> I fail to see wher's the losing on space saving. More, you probably
> have many paths both under 'drivers' and 'drivers/usb' and for each
> added path it would be possible to avoid to store the prefix ('driver'
> or 'driver/usb').
I'm under the impression you don't understand how tree objects work.
Show 8 quoted lines
> To better clarify, OBJ_DICT_TREE data *currently* looks like:
> 
> +------------+-------+-------+-------+-------+----
> | NR_ENTRIES | name1 | hash1 | name2 | hash2 | ...
> +------------+-------+-------+-------+-------+----
>  vint        2 bytes 4 bytes 2 bytes 4 bytes
> 
> where name1 is an index into the packfile's sole EXTOBJ_FILENAME_TABLE.
Exact.
Show 9 quoted lines
> The possible improve is to define OBJ_DICT_TREE like
> 
> +------------+-------+-------+-------+-------+----
> | NR_ENTRIES | dir1   | fiile1 | hash1| dir 2| fiile2|...
> +------------+-------+-------+-------+-------+----
>  vint        2 bytes 2 bytes 2 bytes 4 bytes
> 
> where dir1 is an index into a new EXTOBJ_DIRNAME_TABLE and file1 is an
> index in a new  EXTOBJ_FILENAME_TABLE.
You definitely don't understand how tree objects are used.

Tree objects have no notion of full path at all. They only contain directory component from a single path level only.

If you have the following files:
	drivers/Kconfig
	drivers/usb/Makefile
	drivers/usb/host/ehci.h
	drivers/usb/host/ehci-pci.c
	drivers/usb/host/ohci-pci.c
	kernel/sched.c

then you'll start with one tree objects for the root directory that contains:

	drivers (tree)
	kernel (tree)
Then a second tree object for the "drivers" directory that contains:
	Kconfig (blob)
	usb (tree)
Then a third tree object for the "usb" directory with:
	Makefile (blob)
	host (tree)
Then the fourth tree object with:
	ehci.h (blob)
	ehci-pci.c (blob)
	ohci-pci.c (blob)
And finally a fifth tree object for the "kernel" directory with:
	sched.c (blob)
Hence, the path component table would contain:
	drivers
	usb
	host
	Kconfig
	Makefile
	ehci.h
	ehci-pci.c
	ohci-pci.c
	sched.c

along with the mode bits for each of those path components, and this is what the new tree object would index into for each tree record.

Show 9 quoted lines
> EXTOBJ_FILENAME_TABLE is defined as the currently (but much smaller in
> size!!) and keeps only the file names, not the full paths, while
> EXTOBJ_DIRNAME_TABLE is defined as EXTOBJ_FILENAME_TABLE but without
> MODE field (associated to files only) and is used to store the dir
> names.
> 
> Decopuling dir names from file names could improve saving space
> because the length of proposed EXTOBJ_FILENAME_TABLE +
> EXTOBJ_DIRNAME_TABLE < current EXTOBJ_FILENAME_TABLE.

I hope the explanation above made it clear that what you're proposing cannot ever be smaller than current EXTOBJ_FILENAME_TABLE.

Nicolas
Previous: Nicolas PitreNext: Marco Costalba
Message 15 of 19 in “Understanding version 4 packs”
  1. Peter EriksenMar 24, 2007
  2. Nicolas PitreMar 24, 2007
  3. Peter EriksenMar 25, 2007
  4. Shawn O. PearceMar 25, 2007
  5. Linus TorvaldsMar 25, 2007
  6. Shawn O. PearceMar 25, 2007
  7. Nicolas PitreMar 26, 2007
  8. Shawn O. PearceMar 26, 2007
  9. Jakub NarebskiMar 26, 2007
  10. Nicolas PitreMar 26, 2007
  11. Marco CostalbaMar 26, 2007
  12. Nicolas PitreMar 26, 2007
  13. Marco CostalbaMar 26, 2007
  14. Nicolas PitreMar 26, 2007
  15. Nicolas PitreMar 26, 2007
  16. Marco CostalbaMar 27, 2007
  17. Shawn O. PearceMar 27, 2007
  18. Shawn O. PearceMar 25, 2007
  19. Shawn O. PearceMar 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.