summaryrefslogtreecommitdiff
path: root/ayafs-core/src/disk
diff options
context:
space:
mode:
authorChuyan Zhang <me@zcy.moe>2023-12-02 17:37:57 -0800
committerChuyan Zhang <me@zcy.moe>2023-12-02 17:37:57 -0800
commitf5c92834f79dfdf8007daa019f401c5e51a7596f (patch)
tree19a069a86d9131fef9c271543743e50f6ae3c2eb /ayafs-core/src/disk
parent5ad6da0370cd33230922394817cdb4d0b1e19c93 (diff)
downloadmyfs-f5c92834f79dfdf8007daa019f401c5e51a7596f.tar.gz
myfs-f5c92834f79dfdf8007daa019f401c5e51a7596f.zip
Fix read/write permissions
Diffstat (limited to 'ayafs-core/src/disk')
-rw-r--r--ayafs-core/src/disk/allocation.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/ayafs-core/src/disk/allocation.rs b/ayafs-core/src/disk/allocation.rs
index 6b7167a..ede7055 100644
--- a/ayafs-core/src/disk/allocation.rs
+++ b/ayafs-core/src/disk/allocation.rs
@@ -5,7 +5,7 @@ use crate::disk::inode::{Inode, DIRECT_NUMBER, ENTRY_PER_BLOCK};
use crate::memory::cached_block::{convert, CachedBlock};
use crate::AyaFS;
use libc::c_int;
-use log::debug;
+use log::trace;
impl AyaFS {
/// 为 Inode 分配新 block, 返回 block 的编号和它在 inode 内的编号
@@ -408,19 +408,19 @@ impl AyaFS {
inode: &Inode,
mut block_index_within_inode: usize,
) -> Option<usize> {
- debug!(
+ trace!(
"get_block_index(block_index_within_inode: {})",
block_index_within_inode
);
// direct block
if block_index_within_inode < DIRECT_NUMBER {
let block_index = inode.direct[block_index_within_inode] as usize;
- debug!(" get_block_index -> direct");
+ trace!(" get_block_index -> direct");
return if self.data_bitmap.query(block_index) {
- debug!(" get_block_index -> direct -> ✓");
+ trace!(" get_block_index -> direct -> ✓");
Some(block_index)
} else {
- debug!(" get_block_index -> direct -> ×");
+ trace!(" get_block_index -> direct -> ×");
None
};
} else {
@@ -433,17 +433,17 @@ impl AyaFS {
return if let Some(indirect_block) =
self.get_block::<IndirectBlock>(inode.single_indirect as usize)
{
- debug!(" get_block_index -> indirect");
+ trace!(" get_block_index -> indirect");
let block_index = indirect_block.block.entries[block_index_within_inode] as usize;
if self.data_bitmap.query(block_index) {
- debug!(" get_block_index -> indirect -> ✓");
+ trace!(" get_block_index -> indirect -> ✓");
Some(block_index)
} else {
- debug!(" get_block_index -> indirect -> ×");
+ trace!(" get_block_index -> indirect -> ×");
None
}
} else {
- debug!(" get_block_index -> indirect -> ×");
+ trace!(" get_block_index -> indirect -> ×");
None
};
} else {
@@ -456,7 +456,7 @@ impl AyaFS {
if let Some(double_indirect_block) =
self.get_block::<DoubleIndirectBlock>(inode.double_indirect as usize)
{
- debug!(" get_block_index -> double_indirect");
+ trace!(" get_block_index -> double_indirect");
// 取出 double indirect block
let indirect_block_index = double_indirect_block.block.indirect
[block_index_within_inode / ENTRY_PER_BLOCK]
@@ -464,16 +464,16 @@ impl AyaFS {
// 要找的 entry 在 double indirect block 中的第几个 indirect block
if let Some(indirect_block) = self.get_block::<IndirectBlock>(indirect_block_index)
{
- debug!(" get_block_index -> double_indirect -> indirect");
+ trace!(" get_block_index -> double_indirect -> indirect");
let block_index = indirect_block.block.entries
[block_index_within_inode % ENTRY_PER_BLOCK]
as usize;
// 拿到 DirectoryBlock 的 index
return if self.data_bitmap.query(block_index) {
- debug!(" get_block_index -> double_indirect -> indirect -> ✓");
+ trace!(" get_block_index -> double_indirect -> indirect -> ✓");
Some(block_index)
} else {
- debug!(" get_block_index -> double_indirect -> indirect -> ×");
+ trace!(" get_block_index -> double_indirect -> indirect -> ×");
None
};
}
@@ -525,7 +525,7 @@ impl AyaFS {
) -> Option<&CachedBlock<T>> {
self.get_block_index(inode, block_index_within_inode)
.map(|block_index| {
- debug!(
+ trace!(
"access_block(index: {}) found with global index {}",
block_index_within_inode,
block_index,
@@ -541,7 +541,7 @@ impl AyaFS {
) -> Option<&mut CachedBlock<T>> {
self.get_block_index(inode, block_index_within_inode)
.map(|block_index| {
- debug!(
+ trace!(
"access_block_mut(index: {}) found with global index {}",
block_index_within_inode,
block_index,