[Linux-cachefs] [PATCH v4 44/68] cachefiles: Implement key to filename encoding

David Howells dhowells at redhat.com
Fri Jan 7 11:19:52 UTC 2022


Jeff Layton <jlayton at kernel.org> wrote:

> Since most cookies are fairly small, is there any real benefit to
> optimizing for length here? How much inflation are we talking about?

Taking AFS as an example, a vnode is represented at the file level by two
numbers: a 32-bit or 96-bit file ID and a 32-bit uniquifier.  If it's a 96-bit
file ID, a lot of the time, the upper 64-bits will be zero, so we're talking
something like:

	S421d4,1f07f34,,

instead of:

	S000421d401f07f340000000000000000

or:

	E0AAQh1AHwfzQAAAAAAAAAAA==

The first makes for a more readable name in the cache.  The real fun is with
NFS, where the name can be very long.  For one that's just 5 words in length:

	T81010001,1,20153e2,,a906194b

instead of:

	T8101000100000001020153e200000000a906194b

or:

	E0gQEAAQAAAAECAVPiAAAAAKkGGUs=

(The letter on the front represents the encoding scheme; in the base64 encoding
the second digit indicates the amount of padding).

I don't know how much difference it makes to the backing filesystem's
directory packing - and it may depend on the particular filesystem.

David




More information about the Linux-cachefs mailing list