Page MenuHomeFreeBSD

loader: add support for gzip compression
ClosedPublic

Authored by tsoome on May 25 2022, 6:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 3:49 AM
Unknown Object (File)
Sat, Apr 27, 3:49 AM
Unknown Object (File)
Sat, Apr 27, 3:49 AM
Unknown Object (File)
Sat, Apr 27, 3:49 AM
Unknown Object (File)
Apr 8 2024, 3:23 AM
Unknown Object (File)
Mar 7 2024, 11:52 AM
Unknown Object (File)
Mar 7 2024, 11:47 AM
Unknown Object (File)
Mar 7 2024, 11:39 AM
Subscribers

Details

Summary

PR: 153173
Submitted by: Mikhail Zakharov <zmey20000@yahoo.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This is a good interim solution.

This revision is now accepted and ready to land.May 25 2022, 6:58 PM

Testing done: did create dataset with compression=gzip, did copy some text files on it. verified from loader with command 'more', those files are readable.

markj added inline comments.
sys/cddl/boot/zfs/gzip.c
104

IMO it does not make sense to have this code in the boot loader at all. QAT will never be used by the boot loader, so this is just dead code.

sys/cddl/boot/zfs/gzip.c
104

Yes, I was just checking it too and came to the same conclusion. I think, I'll remove it from here.

drop hw accelerator related code.

This revision now requires review to proceed.May 26 2022, 1:36 PM

Looks reasonable to me.

This revision is now accepted and ready to land.May 26 2022, 1:41 PM
sys/cddl/boot/zfs/gzip.c
33

Oh, this include can be dropped too.

This revision now requires review to proceed.May 26 2022, 1:43 PM
This revision is now accepted and ready to land.May 26 2022, 1:58 PM

Some minor nits (I think the code can be reduced a little bit).

sys/cddl/boot/zfs/gzip.c
35

Now I wonder if gzip.h is really needed (it's defining constants found in zlib.h after my proposed amendments)...

57

Nit: z_uncompress should be a static inline function, because the sole caller is gz_decompress (I don't particular like the name inconsistency [decompress vs uncompress] here but don't have a better alternative as both are matching pre-existing code)

88

gzip.c is to be #includeed from zfssubr.c, we can define this as static too.

sys/cddl/boot/zfs/gzip.h
17–21 ↗(On Diff #106389)

Nit: Technically these are only needed for compression, so unless the loader would gain write capability (I hope not 😄 ), they can be removed.

22 ↗(On Diff #106389)

Nit: this should be inlined as it's not being used anywhere else.

23 ↗(On Diff #106389)

gzip_decompress is only referenced by zio_compress_table (in zfssubr.c) and can be made static.

tsoome marked 5 inline comments as done.

review feedback.

This revision now requires review to proceed.May 26 2022, 6:50 PM
delphij added inline comments.
sys/cddl/boot/zfs/gzip.c
29

(Subject to approval by original author: I think this should be:

Portions Copyright 2022 Mikhail Zakharov <zmey20000@yahoo.com>

so it would be consistent with other CDDL license code (line 13-17 of this file)
)

This revision is now accepted and ready to land.May 26 2022, 11:31 PM
tsoome marked an inline comment as done.

Update copyright:

I don’t mind, of course! It looks very nice, thank you for making my patch more robust.
And as you decided to cut gzip.h, could you, please, tweak README as well

This revision now requires review to proceed.May 27 2022, 9:33 PM
This revision is now accepted and ready to land.May 28 2022, 7:12 AM

Looks good. Would like to see us replace the specialized gzip routines with the generalized zstd routines, but we don't have to do that here.

This revision was automatically updated to reflect the committed changes.