ext2: don't try freeing fastlink "blocks"
This commit is contained in:
parent
f1f7b753d8
commit
d8f035dc69
@ -1,6 +1,7 @@
|
||||
use core::cmp::Ordering;
|
||||
|
||||
use libk::error::Error;
|
||||
use yggdrasil_abi::io::FileType;
|
||||
|
||||
use crate::{
|
||||
data::{FsReadonlyFeatures, DIRECT_BLOCK_COUNT},
|
||||
@ -244,8 +245,23 @@ impl Inode {
|
||||
|
||||
// TODO check max inode size
|
||||
|
||||
let new_blocks = size.div_ceil(fs.block_size as u64);
|
||||
let old_blocks = self.size(fs).div_ceil(fs.block_size as u64);
|
||||
let is_symlink = self
|
||||
.mode
|
||||
.node_type()
|
||||
.map(|ty| ty == FileType::Symlink)
|
||||
.unwrap_or(false);
|
||||
|
||||
let new_blocks = if is_symlink && size < 60 {
|
||||
0
|
||||
} else {
|
||||
size.div_ceil(fs.block_size as u64)
|
||||
};
|
||||
// TODO check size_upper as well?
|
||||
let old_blocks = if is_symlink && self.size_lower < 60 {
|
||||
0
|
||||
} else {
|
||||
self.size(fs).div_ceil(fs.block_size as u64)
|
||||
};
|
||||
|
||||
if new_blocks as usize
|
||||
> DIRECT_BLOCK_COUNT
|
||||
|
Loading…
x
Reference in New Issue
Block a user