Linux Kernel
3.7.1
|
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/writeback.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/tracepoint.h>
#include "internal.h"
#include <trace/events/writeback.h>
Go to the source code of this file.
Data Structures | |
struct | wb_writeback_work |
Macros | |
#define | MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10)) |
#define | CREATE_TRACE_POINTS |
#define CREATE_TRACE_POINTS |
Definition at line 88 of file fs-writeback.c.
#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10)) |
Definition at line 35 of file fs-writeback.c.
__mark_inode_dirty - internal function : inode to mark : what kind of dirty (i.e. I_DIRTY_SYNC) Mark an inode as dirty. Callers should use mark_inode_dirty or mark_inode_dirty_sync.
Put the inode on the super block's dirty list.
CAREFUL! We mark it dirty unconditionally, but move it onto the dirty list only if it is hashed or if it refers to a blockdev. If it was not hashed, it will never be added to the dirty list even if it is later hashed, as it will have been marked dirty already.
In short, make sure you hash any inodes before you start marking them dirty.
Note that for blockdevs, inode->dirtied_when represents the dirtying time of the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of the kernel-internal blockdev inode represents the dirtying time of the blockdev's pages. This is why for I_DIRTY_PAGES we always use page->mapping->host, so the page-dirtying time is recorded in the internal blockdev inode.
Definition at line 1143 of file fs-writeback.c.
void bdi_start_background_writeback | ( | struct backing_dev_info * | bdi | ) |
bdi_start_background_writeback - start background writeback : the backing device to write from
Description: This makes sure WB_SYNC_NONE background writeback happens. When this function returns, it is only guaranteed that for given BDI some IO is happening if we are over background dirty threshold. Caller need not hold sb s_umount semaphore.
Definition at line 173 of file fs-writeback.c.
void bdi_start_writeback | ( | struct backing_dev_info * | bdi, |
long | nr_pages, | ||
enum wb_reason | reason | ||
) |
bdi_start_writeback - start writeback : the backing device to write from : the number of pages to write : reason why some writeback work was initiated
Description: This does WB_SYNC_NONE opportunistic writeback. The IO is only started when this function returns, we make no guarantees on completion. Caller need not hold sb s_umount semaphore.
Definition at line 157 of file fs-writeback.c.
Definition at line 1017 of file fs-writeback.c.
EXPORT_SYMBOL | ( | writeback_in_progress | ) |
EXPORT_SYMBOL | ( | __mark_inode_dirty | ) |
EXPORT_SYMBOL | ( | writeback_inodes_sb_nr | ) |
EXPORT_SYMBOL | ( | writeback_inodes_sb | ) |
EXPORT_SYMBOL | ( | writeback_inodes_sb_if_idle | ) |
EXPORT_SYMBOL | ( | writeback_inodes_sb_nr_if_idle | ) |
EXPORT_SYMBOL | ( | sync_inodes_sb | ) |
EXPORT_SYMBOL | ( | write_inode_now | ) |
EXPORT_SYMBOL | ( | sync_inode | ) |
EXPORT_SYMBOL | ( | sync_inode_metadata | ) |
Definition at line 348 of file fs-writeback.c.
Definition at line 188 of file fs-writeback.c.
int sync_inode | ( | struct inode * | inode, |
struct writeback_control * | wbc | ||
) |
sync_inode - write an inode and its pages to disk. : the inode to sync : controls the writeback mode
sync_inode() will write an inode and its pages to disk. It will also correctly update the inode on its superblock's dirty inode lists and will update inode->i_state.
The caller must have a ref on the inode.
Definition at line 1447 of file fs-writeback.c.
sync_inode_metadata - write an inode to disk : the inode to sync : wait for I/O to complete.
Write an inode to disk and adjust its dirty state after completion.
Note: only writes the actual inode, no associated data or other metadata.
Definition at line 1462 of file fs-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.
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.
write_inode_now - write an inode to disk : inode to write to disk : whether the write should be synchronous or not
This function commits an inode to disk immediately if it is dirty. This is primarily needed by knfsd.
The caller must either have a ref on the inode or must have set I_WILL_FREE.
Definition at line 1418 of file fs-writeback.c.
int writeback_in_progress | ( | struct backing_dev_info * | bdi | ) |
writeback_in_progress - determine whether there is writeback in progress : the device's backing_dev_info structure.
Determine whether there is writeback waiting to be handled against a backing device.
Definition at line 62 of file fs-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.