参照元

説明

引数

返り値

参考

実装

/**
 * page_cache_async_readahead - file readahead for marked pages
 * @mapping: address_space which holds the pagecache and I/O vectors
 * @ra: file_ra_state which holds the readahead state
 * @filp: passed on to ->readpage() and ->readpages()
 * @page: the page at @offset which has the PG_readahead flag set
 * @offset: start offset into @mapping, in pagecache page-sized units
 * @req_size: hint: total size of the read which the caller is performing in
 *            pagecache pages
 *
 * page_cache_async_ondemand() should be called when a page is used which
 * has the PG_readahead flag; this is a marker to suggest that the application
 * has used up enough of the readahead window that we should start pulling in
 * more pages.
 */
void
page_cache_async_readahead(struct address_space *mapping,
			   struct file_ra_state *ra, struct file *filp,
			   struct page *page, pgoff_t offset,
			   unsigned long req_size)
{
	/* no read-ahead */
	if (!ra->ra_pages)
		return;

	/*
	 * Same bit is used for PG_readahead and PG_reclaim.
	 */
	if (PageWriteback(page))
		return;
	ClearPageReadahead(page);
	/*
	 * Defer asynchronous read-ahead on IO congestion.
	 */
	if (bdi_read_congested(mapping->backing_dev_info))
		return;
	/* do read-ahead */
	ondemand_readahead(mapping, ra, filp, true, offset, req_size);
#ifdef CONFIG_BLOCK
	/*
	 * Normally the current page is !uptodate and lock_page() will be
	 * immediately called to implicitly unplug the device. However this
	 * is not always true for RAID conifgurations, where data arrives
	 * not strictly in their submission order. In this case we need to
	 * explicitly kick off the IO.
	 */
	if (PageUptodate(page))
		blk_run_backing_dev(mapping->backing_dev_info, NULL);
#endif
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2014-09-13 (土) 08:26:42