mars-research / redleaf

RedLeaf Operating System
118 stars 10 forks source link

Refactor FS Log #19

Open tjhu opened 4 years ago

tjhu commented 4 years ago

In xv6, syscalls manually do begin_op() and end_op() to open and close transactions. This is unsafe and hard to port to Rust. Maybe wrap these two calls into a guard and use RAII to auto-close a transaction when the guard goes out of the scope. But we need to fully understand the logging layer and make sure that we are able to refactor every single call site.

tjhu commented 4 years ago

Fixed. You can now use fs::log::Transaction to manage your transaction.

TODO: change it to a cleaner interface. For example, Transaction::get() instead of LOG.r#try().unwrap().begin_transaction() to acquire a transaction.