Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability of prefetch for rafs v6 format #319

Merged
merged 8 commits into from
Mar 10, 2022
Merged

Add capability of prefetch for rafs v6 format #319

merged 8 commits into from
Mar 10, 2022

Conversation

changweige
Copy link
Contributor

@changweige changweige commented Mar 3, 2022

Rafs v6 now has the capability of prefetch with this patch set merged if it would.
By design, it places a prefetch table very closely to blob devices table on v6 extended block when creating v6 nydus image.
The nydus-image command line user interface is exactly the same with v5 style. Each file that needs to be prefetched will have its nid persisted into the prefetch table.
When nydusd starts, the prefetching files will be found from the prefetch table and the files' contents will be downloaded in ahead of time.

@changweige changweige changed the title wip: V6 prefetch Add Mar 4, 2022
@changweige changweige changed the title Add Add capability of prefetch for rafs v6 format Mar 4, 2022
rafs/src/fs.rs Outdated Show resolved Hide resolved
rafs/src/metadata/direct_v6.rs Show resolved Hide resolved
rafs/src/metadata/layout/v6.rs Show resolved Hide resolved
rafs/src/metadata/layout/v6.rs Outdated Show resolved Hide resolved
src/bin/nydus-image/core/bootstrap.rs Show resolved Hide resolved
src/bin/nydus-image/core/bootstrap.rs Outdated Show resolved Hide resolved
src/bin/nydus-image/core/bootstrap.rs Show resolved Hide resolved
bios.iter_mut().for_each(|b| {
if let Some(ref chunks_meta) = self.meta {
// TODO: the first blob backend io triggers chunks array download.
if let BlobIoChunk::Address(_blob_index, chunk_index) = b.chunkinfo {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but it looks a bit wired to construct BlobIoChunk::Address and convert it to BlobIoChunk::Base for v6 IO desc. Looks like we can just create BlobIoChunk::Base and remove BlobIoChunk::Address. @jiangliu wdyt?

Copy link
Member

@bergwolf bergwolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

pub struct RafsV6PrefetchTable {
/// List of inode numbers for prefetch.
/// Note: It's not inode index of inodes table being stored here.
pub inodes: Vec<u64>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, we could use 32bit nid here, since blob.meta won't be too large for nydus v6 format.
it can support 4*32 = 128GB bootstrap size, which I think it's enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already changed to u32

Place a prefetch table which has nids for files and directories that
needs to be prefetched. The prefetch table is very close to blobs
table on v6 rafs extended super block.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Load v6 prefetch table from extended super block and
prefetch files' contents per as the table.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Because seek is transitive.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Rafs prefetch needs the functionality.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
V6 format does not have chunks' particualer addresses
in bootstrap but only their indexes by which to locate each
chunk from blob.
For prefetch, we aslo have to map the chunks info so that
bios can be sorted when handling prefetch requests.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Right now, when prefetch enabled and xattrs packed,
extended sb will be revised and rewritten more than
onece. It is not necessary.

Only write extended block when all the settings are
done.

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
@bergwolf bergwolf merged commit ccb6584 into dragonflyoss:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants