The file extents.c (fs/ext4/extents.c) in linux kernel 4.7.2 deals with file allocation methods.
ar.goal is calculated by a function ext4_ext_find_goal
ar.goal = ext4_ext_find_goal(inode, path, map->m_lblk);
Can anyone please explain how this function works ?
ext4_ext_find_goal()
is called when we need to allocate new block.
In here , this function is called as you said.
ar.goal = ext4_ext_find_goal(inode, path, map->m_lblk);
In this context, path
is not NULL. So, ext4_ext_find_goal()
will find block number of that path
, and return this block number.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.