Linux Kernel
3.7.1
|
#include <linux/sched.h>
#include <linux/fs.h>
Go to the source code of this file.
Data Structures | |
struct | writeback_control |
Macros | |
#define | DIRTY_SCOPE 8 |
#define | DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) |
Typedefs | |
typedef int(* | writepage_t )(struct page *page, struct writeback_control *wbc, void *data) |
Variables | |
const char * | wb_reason_name [] |
unsigned long | global_dirty_limit |
int | dirty_background_ratio |
unsigned long | dirty_background_bytes |
int | vm_dirty_ratio |
unsigned long | vm_dirty_bytes |
unsigned int | dirty_writeback_interval |
unsigned int | dirty_expire_interval |
int | vm_highmem_is_dirtyable |
int | block_dump |
int | laptop_mode |
#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) |
Definition at line 26 of file writeback.h.
#define DIRTY_SCOPE 8 |
Definition at line 25 of file writeback.h.
Definition at line 173 of file writeback.h.
enum wb_reason |
WB_REASON_BACKGROUND | |
WB_REASON_TRY_TO_FREE_PAGES | |
WB_REASON_SYNC | |
WB_REASON_PERIODIC | |
WB_REASON_LAPTOP_TIMER | |
WB_REASON_FREE_MORE_MEM | |
WB_REASON_FS_FREE_SPACE | |
WB_REASON_FORKER_THREAD | |
WB_REASON_MAX |
Definition at line 41 of file writeback.h.
enum writeback_sync_modes |
Definition at line 33 of file writeback.h.
void __bdi_update_bandwidth | ( | struct backing_dev_info * | bdi, |
unsigned long | thresh, | ||
unsigned long | bg_thresh, | ||
unsigned long | dirty, | ||
unsigned long | bdi_thresh, | ||
unsigned long | bdi_dirty, | ||
unsigned long | start_time | ||
) |
Definition at line 1012 of file page-writeback.c.
Definition at line 2045 of file page-writeback.c.
void balance_dirty_pages_ratelimited_nr | ( | struct address_space * | mapping, |
unsigned long | nr_pages_dirtied | ||
) |
balance_dirty_pages_ratelimited_nr - balance dirty memory state : address_space which was dirtied : number of pages which the caller has just dirtied
Processes which are dirtying memory should call in here once for each page which was newly dirtied. The function will periodically check the system's dirty state and will initiate writeback if needed.
On really big machines, get_writeback_state is expensive, so try to avoid calling it too often (ratelimiting). But once we're over the dirty memory limit we decrease the ratelimiting by a lot, to prevent individual processes from overshooting the limit by (ratelimit_pages) each.
Definition at line 1452 of file page-writeback.c.
unsigned long bdi_dirty_limit | ( | struct backing_dev_info * | bdi, |
unsigned long | dirty | ||
) |
bdi_dirty_limit - 's share of dirty throttling threshold : the backing_dev_info to query : global dirty limit in pages
Returns 's dirty limit in pages. The term "dirty" in the context of dirty balancing includes all PG_dirty, PG_writeback and NFS unstable pages.
Note that balance_dirty_pages() will only seriously take it as a hard limit when sleeping max_pause per page is not enough to keep the dirty pages under control. For example, when the device is completely stalled due to some error conditions, or when there are 1000 dd tasks writing to a slow 10MB/s USB key. In the other normal situations, it acts more gently by throttling the tasks more (rather than completely block them) when the bdi dirty pages go high.
It allocates high/low dirty limits to fast/slow devices, in order to prevent
The bdi's share of dirty limit will be adapting to its throughput and bounded by the bdi->min_ratio and/or bdi->max_ratio parameters, if set.
Definition at line 547 of file page-writeback.c.
DECLARE_PER_CPU | ( | int | , |
dirty_throttle_leaks | |||
) |
int dirty_background_bytes_handler | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
Definition at line 351 of file page-writeback.c.
int dirty_background_ratio_handler | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
Definition at line 339 of file page-writeback.c.
int dirty_bytes_handler | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
Definition at line 378 of file page-writeback.c.
int dirty_ratio_handler | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
Definition at line 363 of file page-writeback.c.
int dirty_writeback_centisecs_handler | ( | struct ctl_table * | , |
int | , | ||
void __user * | , | ||
size_t * | , | ||
loff_t * | |||
) |
Definition at line 1531 of file page-writeback.c.
int do_writepages | ( | struct address_space * | mapping, |
struct writeback_control * | wbc | ||
) |
Definition at line 1903 of file page-writeback.c.
int generic_writepages | ( | struct address_space * | mapping, |
struct writeback_control * | wbc | ||
) |
generic_writepages - walk the list of dirty pages of the given address space and writepage() all of them. : address space structure to write : subtract the number of written pages from *->nr_to_write
This is a library function, which implements the writepages() address_space_operation.
Definition at line 1885 of file page-writeback.c.
Definition at line 243 of file page-writeback.c.
Definition at line 348 of file fs-writeback.c.
Definition at line 1642 of file page-writeback.c.
Definition at line 1410 of file page-writeback.c.
void sync_inodes_sb | ( | struct super_block * | sb | ) |
sync_inodes_sb - sync sb inode pages : the superblock
This function writes and waits on any dirty inode belonging to this super_block.
Definition at line 1384 of file fs-writeback.c.
void tag_pages_for_writeback | ( | struct address_space * | mapping, |
pgoff_t | start, | ||
pgoff_t | end | ||
) |
tag_pages_for_writeback - tag pages to be written by write_cache_pages : address space structure to write : starting page index : ending page index (inclusive)
This function scans the page range from to (inclusive) and tags all pages that have DIRTY tag set with a special TOWRITE tag. The idea is that write_cache_pages (or whoever calls this function) will then use TOWRITE tag to identify pages eligible for writeback. This mechanism is used to avoid livelocking of writeback by a process steadily creating new dirty pages in the file (thus it is important for this function to be quick so that it can tag pages faster than a dirtying process can create them).
Definition at line 1667 of file page-writeback.c.
Definition at line 1498 of file page-writeback.c.
Definition at line 1079 of file fs-writeback.c.
long wb_do_writeback | ( | struct bdi_writeback * | wb, |
int | force_wait | ||
) |
Definition at line 974 of file fs-writeback.c.
int write_cache_pages | ( | struct address_space * | mapping, |
struct writeback_control * | wbc, | ||
writepage_t | writepage, | ||
void * | data | ||
) |
write_cache_pages - walk the list of dirty pages of the given address space and write all of them. : address space structure to write : subtract the number of written pages from *->nr_to_write : function called for each page : data passed to writepage function
If a page is already under I/O, write_cache_pages() skips it, even if it's dirty. This is desirable behaviour for memory-cleaning writeback, but it is INCORRECT for data-integrity system calls such as fsync(). fsync() and msync() need to guarantee that all the data which was dirty at the time the call was made get new I/O started against them. If wbc->sync_mode is WB_SYNC_ALL then we were called for data integrity and we must wait for existing IO to complete.
To avoid livelocks (when other process dirties new pages), we first tag pages which should be written back with TOWRITE tag and only then start writing them. For data-integrity sync we have to be careful so that we do not miss some pages (e.g., because some other process has cleared TOWRITE tag we set). The rule we follow is that TOWRITE tag can be cleared only by the process clearing the DIRTY tag (and submitting the page for IO).
Definition at line 1708 of file page-writeback.c.
void writeback_inodes_sb | ( | struct super_block * | sb, |
enum wb_reason | reason | ||
) |
writeback_inodes_sb - writeback dirty inodes from given super_block : the superblock : reason why some writeback work was initiated
Start writeback on some inodes on this super_block. No guarantees are made on how many (if any) will be written, and this function does not wait for IO completion of submitted IO.
Definition at line 1328 of file fs-writeback.c.
int writeback_inodes_sb_if_idle | ( | struct super_block * | sb, |
enum wb_reason | reason | ||
) |
writeback_inodes_sb_if_idle - start writeback if none underway : the superblock : reason why some writeback work was initiated
Invoke writeback_inodes_sb if no writeback is currently underway. Returns 1 if writeback was started, 0 if not.
Definition at line 1342 of file fs-writeback.c.
void writeback_inodes_sb_nr | ( | struct super_block * | sb, |
unsigned long | nr, | ||
enum wb_reason | reason | ||
) |
writeback_inodes_sb_nr - writeback dirty inodes from given super_block : the superblock : the number of pages to write : reason why some writeback work initiated
Start writeback on some inodes on this super_block. No guarantees are made on how many (if any) will be written, and this function does not wait for IO completion of submitted IO.
Definition at line 1297 of file fs-writeback.c.
int writeback_inodes_sb_nr_if_idle | ( | struct super_block * | sb, |
unsigned long | nr, | ||
enum wb_reason | reason | ||
) |
writeback_inodes_sb_nr_if_idle - start writeback if none underway : the superblock : the number of pages to write : reason why some writeback work was initiated
Invoke writeback_inodes_sb if no writeback is currently underway. Returns 1 if writeback was started, 0 if not.
Definition at line 1363 of file fs-writeback.c.
long writeback_inodes_wb | ( | struct bdi_writeback * | wb, |
long | nr_pages, | ||
enum wb_reason | reason | ||
) |
Definition at line 734 of file fs-writeback.c.
Definition at line 1593 of file page-writeback.c.
int block_dump |
Definition at line 109 of file page-writeback.c.
unsigned long dirty_background_bytes |
Definition at line 75 of file page-writeback.c.
int dirty_background_ratio |
Definition at line 69 of file page-writeback.c.
unsigned int dirty_expire_interval |
Definition at line 104 of file page-writeback.c.
unsigned int dirty_writeback_interval |
Definition at line 97 of file page-writeback.c.
unsigned long global_dirty_limit |
Definition at line 121 of file page-writeback.c.
int laptop_mode |
Definition at line 115 of file page-writeback.c.
unsigned long vm_dirty_bytes |
Definition at line 92 of file page-writeback.c.
int vm_dirty_ratio |
Definition at line 86 of file page-writeback.c.
int vm_highmem_is_dirtyable |
Definition at line 81 of file page-writeback.c.