Skip to content

Conversation

@CharanSriramUni
Copy link
Collaborator

Just a progress check!

Comment on lines +27 to +37
#[repr(i32)]
#[allow(non_camel_case_types)]
enum FALLOC_FLAG {
FALLOC_FL_KEEP_SIZE = 0x01,
FALLOC_FL_PUNCH_HOLE = 0x02,
// FALLOC_FL_NO_HIDE_STALE = 0x04,
FALLOC_FL_COLLAPSE_RANGE = 0x08,
FALLOC_FL_ZERO_RANGE = 0x10,
FALLOC_FL_INSERT_RANGE = 0x20,
// FALLOC_FL_UNSHARE_RANGE = 0x40,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should be able to import these flags from rust/bindings/bindings_generated.rs. If they aren't there, we probably have to add the file in which they are defined by the kernel to rust/bindings/bindings_helper.h. The Rust build system incorporated with the kernel uses this .h file to set up Rust-friendly definitions of everything defined by files it includes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, looks like they are defined as C macros for some reason, which makes our lives a little more difficult. The automatic binding generation doesn't work on C macros, sohe cleanest way to handle this at the moment would be to manually add a wrapper for each macro in rust/helpers.c, following the same style as the existing functions in that file.

Comment on lines 274 to 281
// truncate extends the flie size when the size is greater than the current size
match hayleyfs_truncate(sbi, pi, final_file_size as i64){
Ok(_) => pr_info!("OK"),
Err(e) => pr_info!("{:?}", e)
}

// size will be restored at the end of this function.
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than calling hayleyfs_truncate and then setting the size back to the original value, you should implement a function that adds the pages to the file but does not change its size at all. With the current design (which appears to not reset the inode size anyway?), if we crash after the hayleyfs_truncate call completes but before fixing up the file size, the file size will end up incorrect.

Comment on lines +2 to +3
source /home/rustfs/.bashrc
source /home/rustfs/.profile
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this references some files that are not part of the repo; if there is something defined in these files that is required for this script, you should copy it into the script or include it in a file that is part of the repo.

}


fn hayleyfs_fallocate(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good! Looks like the default mode for fallocate got lost when moving the code over to the new function though (or is it going to be replaced with something else?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this file do anything anymore? If not, let's remove it (or move it to the tests/ directory if it does help with something that I didn't see on a quick scan).

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.

3 participants