Skip to content

Commit

Permalink
chore: remove some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenRuiwei committed Jul 31, 2024
1 parent de73c2c commit 5849e5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
24 changes: 12 additions & 12 deletions modules/page/src/buffer_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ impl BufferCache {
}

pub fn read_block(&mut self, block_id: usize, buf: &mut [u8]) {
// let buffer_head = self.get_buffer_head_from_disk(block_id);
// if buffer_head.has_cached() {
// buffer_head.read_block(buf)
// } else {
self.device().base_read_block(block_id, buf)
// }
let buffer_head = self.get_buffer_head_from_disk(block_id);
if buffer_head.has_cached() {
buffer_head.read_block(buf)
} else {
self.device().base_read_block(block_id, buf)
}
}

pub fn write_block(&mut self, block_id: usize, buf: &[u8]) {
// let buffer_head = self.get_buffer_head_from_disk(block_id);
// if buffer_head.has_cached() {
// buffer_head.write_block(buf)
// } else {
self.device().base_write_block(block_id, buf)
// }
let buffer_head = self.get_buffer_head_from_disk(block_id);
if buffer_head.has_cached() {
buffer_head.write_block(buf)
} else {
self.device().base_write_block(block_id, buf)
}
}

pub fn get_buffer_head_from_disk(&mut self, block_id: usize) -> Arc<BufferHead> {
Expand Down
6 changes: 0 additions & 6 deletions modules/vfs-core/src/dentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ impl dyn Dentry {
}

pub fn lookup(self: &Arc<Self>, name: &str) -> SysResult<Arc<dyn Dentry>> {
// let hash_key = HashKey::new(self, name)?;
// if let Some(child) = dcache().get(hash_key) {
// log::warn!("[Dentry::lookup] find child in hash");
// return Ok(child);
// }
if !self.inode()?.itype().is_dir() {
return Err(SysError::ENOTDIR);
}
Expand Down Expand Up @@ -252,7 +247,6 @@ impl dyn Dentry {
/// Create a negetive child dentry with `name`.
pub fn new_child(self: &Arc<Self>, name: &str) -> Arc<dyn Dentry> {
let child = self.clone().base_new_child(name);
// dcache().insert(child.clone());
child
}

Expand Down

0 comments on commit 5849e5e

Please sign in to comment.