Support sparsefiles Copy in blockfile snapshotter#12066
Conversation
|
Hi @fidencio. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
I'm revisiting #10197 on this PR, and addressing the comments made by @dmcgowan. @AkihiroSuda, you already approved the previous one, would you mind to also taking a look at this one, considering the original contributor has been busy and didn't have time to address @dmcgowan's comments? |
5d5db28 to
bf60f0b
Compare
bf60f0b to
8ce1824
Compare
b547de5 to
2cd2a04
Compare
|
I've taken the freedom here to do some changes that I'm not sure if they'll be acceptable by the maintainers (@dmcgowan, I'm looking at you). The implementation provided by the first author of this patch was already linux specific, as it'd bring in a dependency on the This new way is not windows friendly, unfortunately, and while I could try harder to get it to work on Windows, I'm not sure whether this is worth it, as AFAICT there's no VMM based runtime for Windows, leading to no-one using it on Windows. Is this assumption correct, @dmcgowan? @hsiangkao suggested to use I'll wait a little bit till I get some feedback and revisit this one during this evening. thanks, |
ca7eddd to
e47709b
Compare
|
I've split the files in a way that we only keep the copySparse for Linux, and warn the users that it has no effect in other OSes. One question is about the default "block size" to copy, which I'm using 2MB here, but maybe it's an overkill and we should go for something bigger (16MB?). In any case, feedback is more than welcome. |
5a84603 to
d385f0a
Compare
b25e0cd to
5a939b3
Compare
2ce808f to
84aeabc
Compare
There was a problem hiding this comment.
We can, but I'd really prefer doing it in a seperate PR, @AkihiroSuda.
The reason for that is this PR just being a revival of #10197, which I was not the author.
If you don't mind, let's get this one merged and I will open a PR adding unit tests to it.
666bd3d to
48b9ba4
Compare
mythi
left a comment
There was a problem hiding this comment.
minor typo nits and a couple of questions
|
|
||
| // CopySparse forces the creation of a sparse file when copying | ||
| // the 'ScratchFile' | ||
| CopySparse bool `toml:"copy_sparse"` |
There was a problem hiding this comment.
I wonder if the config option is still needed/justified? The original implementation had it but was relying on an external tool to sparsify the target layer and needed user opt-in to do it. This PR is mainly about an optimized copy for Linux which skips holes if the admin had already opted-in to create a sparse ScratchFile.
There was a problem hiding this comment.
I think the config option is still justified, as copy_sparse = true leads to oversubscription on disk ... and I can see usecases where the admins are not okay with that.
There was a problem hiding this comment.
If that is the case, then the provided scratch file should not be sparse. My understanding is the code is copy sparse only preserves the sparse nature, it does not make a non-sparse file sparse.
Additionally, this is not the right driver to use for that case, we have better options now. I think we should just enable this by default on ext4 and don't need to a config. Is there another filesystem in use where this would make sense?
4fcec3b to
53b11c3
Compare
|
@dmcgowan is this still targeted for 2.2? I was testing this w/ Kata and rebased to 2.2-beta.0 on Linux XFS today and things worked OK. I could run more tests if needed. Only one observation related to initial scratch creation from (my |
I think we could implement a check during blockfile snapshotter's initialization to detect the cross-filesystem case. If detected, it would log a warning and fallback to using |
Yes that would work but I think documentation would also have to be improved/changed so that users can prepare for that fallback and do the initial configuration properly. |
We can get this in
My understanding is the golang |
dmcgowan
left a comment
There was a problem hiding this comment.
I think this would be much easier to take in without the confusing configuration option. It has no use on some filesystem and on others I don't think there is a good reason not to use it. Additionally some of the comments are misleadering or wrong. Could we initially just enable by default for ext4, this driver was initially not intended to be used on ext4 but this change could make it usable.
|
|
||
| // CopySparse forces the creation of a sparse file when copying | ||
| // the 'ScratchFile' | ||
| CopySparse bool `toml:"copy_sparse"` |
There was a problem hiding this comment.
If that is the case, then the provided scratch file should not be sparse. My understanding is the code is copy sparse only preserves the sparse nature, it does not make a non-sparse file sparse.
Additionally, this is not the right driver to use for that case, we have better options now. I think we should just enable this by default on ext4 and don't need to a config. Is there another filesystem in use where this would make sense?
I got the config entry dropped and hope to get it pushed through @fabiano back to this PR to get it in 2.2. I did some basic testing on ext4 and xfs using Kata containers. |
fdf2557 to
1652928
Compare
1652928 to
5b11937
Compare
This is needed as the golang implementation of `io.Copy` is equivalent to `cp --sparse=never ...`, meaning that even if the initial scratch file is a sparse file, it's copy will still be a non-sparse one, leading to each snapshot block file occupying the full blockfile set by the user. Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com> Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
5b11937 to
6cf6eb3
Compare
|
I'm closing this one as I have no intent to work on this. |
Add the ability to copy sparse files, allowing it to be set in the configuration file.
This is needed as the golang implementatio of
io.Copyis equivalent tocp --sparse=nevar ..., meaning that even if the initial scratch file is a sparse file, it's cop will still be a non-sparse one, leading to each snapshot block file occupying the full blockfile set by the user.