Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1641565
  • 博文数量: 409
  • 博客积分: 6240
  • 博客等级: 准将
  • 技术积分: 4908
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-01 00:04
文章分类

全部博文(409)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(13)

2015年(22)

2013年(4)

2012年(240)

2011年(127)

分类:

2011-10-01 11:40:00

原文地址:看源码笔记 作者:todaygood

LIST_HEAD(name)  定义name 链表,并初始化。
HLIST_HEAD(name)  定义name 哈希链表,并初始化。


init_waitqueue_head
add_wait_queue
add_wait_queue_exclusive
remove_wait_queue
prepare_to_wait
prepare_to_wait_exclusive
finish_wait
autoremove_wake_function
wake_bit_function
__wait_on_bit
out_of_line_wait_on_bit
__wait_on_bit_lock
out_of_line_wait_on_bit_lock
__wake_up_bit
wake_up_bit
bit_waitqueue         a standard hashed waitqueue table for generic use

 int wait_on_bit(void *word, int bit,
int (*action)(void *), unsigned mode)   wait for a bit to be cleared
用法详见:
static void __wait_on_freeing_inode(struct inode *inode)
{
wait_queue_head_t *wq;
DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK);
wq = bit_waitqueue(&inode->i_state, __I_LOCK);
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
spin_unlock(&inode_lock);
schedule();
finish_wait(wq, &wait.wait);
spin_lock(&inode_lock);
}

static inline void wait_on_inode(struct inode *inode)
{
might_sleep();
wait_on_bit(&inode->i_state, __I_LOCK, inode_wait,
TASK_UNINTERRUPTIBLE);
}


inode的内存cache :inode_hashtable  全局哈希链表

/*
 * second extended-fs super-block data in memory
 */
struct ext2_sb_info 

计算方法:ext2_get_group_desc


/*
 * second extended file system inode data in memory
 */
struct ext2_inode_info {


new_inode->alloc_inode  ,给inode->i_mapping 赋值


更新超级块,使用struct writeback_control 样例:

int ext2_sync_inode(struct inode *inode)
{
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
.nr_to_write = 0, /* sys_fsync did this */
};
return sync_inode(inode, &wbc);
}

filemap_fdatawait - wait for all under-writeback pages to complete


/*
 * Track a single file's readahead state
 */
struct file_ra_state 

预读接口
default_backing_dev_info
file_ra_state_init
page_cache_sync_readahead
page_cache_async_readahead


Page_cache接口
filemap_fdatawrite
filemap_flush
sync_page_range
sync_page_range_nolock
filemap_fdatawait
filemap_write_and_wait
add_to_page_cache
__page_cache_alloc
wait_on_page_bit
unlock_page
end_page_writeback
__lock_page
find_get_page
find_lock_page
find_or_create_page
find_get_pages_contig
find_get_pages_tag
grab_cache_page_nowait
do_generic_mapping_read
generic_segment_checks
generic_file_aio_read
filemap_fault
generic_file_mmap
generic_file_readonly_mmap
read_cache_page_async
read_cache_page
should_remove_suid
remove_suid
iov_iter_copy_from_user_atomic
iov_iter_copy_from_user
iov_iter_advance
iov_iter_fault_in_readable
iov_iter_single_seg_count
generic_write_checks
pagecache_write_begin
pagecache_write_end
generic_file_direct_write
__grab_cache_page
generic_file_buffered_write
generic_file_aio_write_nolock
generic_file_aio_write
try_to_release_page

阅读(864) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~