mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Make the file lookup faster
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
fb8f493b43
commit
b9ce3e64ad
@ -2,7 +2,10 @@
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::{
|
||||
fs::{file_table::FileDesc, utils::FallocMode},
|
||||
fs::{
|
||||
file_table::{get_file_fast, FileDesc},
|
||||
utils::FallocMode,
|
||||
},
|
||||
prelude::*,
|
||||
process::ResourceType,
|
||||
};
|
||||
@ -21,10 +24,8 @@ pub fn sys_fallocate(
|
||||
|
||||
check_offset_and_len(offset, len, ctx)?;
|
||||
|
||||
let file = {
|
||||
let file_table = ctx.posix_thread.file_table().lock();
|
||||
file_table.get_file(fd)?.clone()
|
||||
};
|
||||
let mut file_table = ctx.thread_local.file_table().borrow_mut();
|
||||
let file = get_file_fast!(&mut file_table, fd);
|
||||
|
||||
let falloc_mode = FallocMode::try_from(
|
||||
RawFallocMode::from_bits(mode as _)
|
||||
|
Reference in New Issue
Block a user