Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
backing-dev.h File Reference
#include <linux/percpu_counter.h>
#include <linux/log2.h>
#include <linux/flex_proportions.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/writeback.h>
#include <linux/atomic.h>
#include <linux/sysctl.h>

Go to the source code of this file.

Data Structures

struct  bdi_writeback
struct  backing_dev_info


#define BDI_STAT_BATCH   (8*(1+ilog2(nr_cpu_ids)))
#define BDI_CAP_NO_ACCT_DIRTY   0x00000001
#define BDI_CAP_NO_WRITEBACK   0x00000002
#define BDI_CAP_MAP_COPY   0x00000004
#define BDI_CAP_MAP_DIRECT   0x00000008
#define BDI_CAP_READ_MAP   0x00000010
#define BDI_CAP_WRITE_MAP   0x00000020
#define BDI_CAP_EXEC_MAP   0x00000040
#define BDI_CAP_NO_ACCT_WB   0x00000080
#define BDI_CAP_SWAP_BACKED   0x00000100


typedef intcongested_fn )(void *, int)


enum  bdi_state {
  BDI_pending, BDI_wb_alloc, BDI_async_congested, BDI_sync_congested,
  BDI_registered, BDI_writeback_running, BDI_unused
enum  bdi_stat_item {
enum  { BLK_RW_ASYNC = 0, BLK_RW_SYNC = 1 }


int bdi_init (struct backing_dev_info *bdi)
void bdi_destroy (struct backing_dev_info *bdi)
int bdi_register (struct backing_dev_info *bdi, struct device *parent, const char *fmt,...)
int bdi_register_dev (struct backing_dev_info *bdi, dev_t dev)
void bdi_unregister (struct backing_dev_info *bdi)
int bdi_setup_and_register (struct backing_dev_info *, char *, unsigned int)
void bdi_start_writeback (struct backing_dev_info *bdi, long nr_pages, enum wb_reason reason)
void bdi_start_background_writeback (struct backing_dev_info *bdi)
int bdi_writeback_thread (void *data)
int bdi_has_dirty_io (struct backing_dev_info *bdi)
void bdi_wakeup_thread_delayed (struct backing_dev_info *bdi)
void bdi_lock_two (struct bdi_writeback *wb1, struct bdi_writeback *wb2)
void bdi_writeout_inc (struct backing_dev_info *bdi)
int bdi_set_min_ratio (struct backing_dev_info *bdi, unsigned int min_ratio)
int bdi_set_max_ratio (struct backing_dev_info *bdi, unsigned int max_ratio)
int writeback_in_progress (struct backing_dev_info *bdi)
void clear_bdi_congested (struct backing_dev_info *bdi, int sync)
void set_bdi_congested (struct backing_dev_info *bdi, int sync)
long congestion_wait (int sync, long timeout)
long wait_iff_congested (struct zone *zone, int sync, long timeout)
int pdflush_proc_obsolete (struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos)


spinlock_t bdi_lock
struct list_head bdi_list
struct list_head bdi_pending_list
struct backing_dev_info default_backing_dev_info
struct backing_dev_info noop_backing_dev_info

Macro Definition Documentation

#define BDI_CAP_EXEC_MAP   0x00000040

Definition at line 253 of file backing-dev.h.

#define BDI_CAP_MAP_COPY   0x00000004

Definition at line 249 of file backing-dev.h.

#define BDI_CAP_MAP_DIRECT   0x00000008

Definition at line 250 of file backing-dev.h.


Definition at line 260 of file backing-dev.h.

#define BDI_CAP_NO_ACCT_DIRTY   0x00000001

Definition at line 247 of file backing-dev.h.

#define BDI_CAP_NO_ACCT_WB   0x00000080

Definition at line 254 of file backing-dev.h.

#define BDI_CAP_NO_WRITEBACK   0x00000002

Definition at line 248 of file backing-dev.h.

#define BDI_CAP_READ_MAP   0x00000010

Definition at line 251 of file backing-dev.h.

#define BDI_CAP_SWAP_BACKED   0x00000100

Definition at line 255 of file backing-dev.h.


Definition at line 257 of file backing-dev.h.

#define BDI_CAP_WRITE_MAP   0x00000020

Definition at line 252 of file backing-dev.h.

#define BDI_STAT_BATCH   (8*(1+ilog2(nr_cpu_ids)))

Definition at line 49 of file backing-dev.h.

Typedef Documentation

typedef int( congested_fn)(void *, int)

Definition at line 39 of file backing-dev.h.

Enumeration Type Documentation

anonymous enum

Definition at line 298 of file backing-dev.h.


Definition at line 41 of file backing-dev.h.

enum bdi_state

Definition at line 29 of file backing-dev.h.

Function Documentation

void bdi_destroy ( struct backing_dev_info bdi)

Definition at line 665 of file backing-dev.c.

int bdi_has_dirty_io ( struct backing_dev_info bdi)

Definition at line 258 of file backing-dev.c.

int bdi_init ( struct backing_dev_info bdi)

Definition at line 622 of file backing-dev.c.

void bdi_lock_two ( struct bdi_writeback wb1,
struct bdi_writeback wb2 

Definition at line 42 of file backing-dev.c.

int bdi_register ( struct backing_dev_info bdi,
struct device parent,
const char fmt,

Definition at line 483 of file backing-dev.c.

int bdi_register_dev ( struct backing_dev_info bdi,
dev_t  dev 

Definition at line 526 of file backing-dev.c.

int bdi_set_max_ratio ( struct backing_dev_info bdi,
unsigned int  max_ratio 
int bdi_set_min_ratio ( struct backing_dev_info bdi,
unsigned int  min_ratio 

Definition at line 473 of file page-writeback.c.

int bdi_setup_and_register ( struct backing_dev_info ,
char ,
unsigned  int 

Definition at line 705 of file backing-dev.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.

void bdi_unregister ( struct backing_dev_info bdi)

Definition at line 581 of file backing-dev.c.

void bdi_wakeup_thread_delayed ( struct backing_dev_info bdi)

Definition at line 294 of file backing-dev.c.

int bdi_writeback_thread ( void data)

Definition at line 1017 of file fs-writeback.c.

void bdi_writeout_inc ( struct backing_dev_info bdi)

Definition at line 424 of file page-writeback.c.

void clear_bdi_congested ( struct backing_dev_info bdi,
int  sync 

Definition at line 734 of file backing-dev.c.

long congestion_wait ( int  sync,
long  timeout 

congestion_wait - wait for a backing_dev to become uncongested : SYNC or ASYNC IO : timeout in jiffies

Waits for up to jiffies for a backing_dev (any backing_dev) to exit write congestion. If no backing_devs are congested then just wait for the next write to be completed.

Definition at line 767 of file backing-dev.c.

int pdflush_proc_obsolete ( struct ctl_table table,
int  write,
void __user buffer,
size_t lenp,
loff_t *  ppos 

Definition at line 840 of file backing-dev.c.

void set_bdi_congested ( struct backing_dev_info bdi,
int  sync 

Definition at line 748 of file backing-dev.c.

long wait_iff_congested ( struct zone zone,
int  sync,
long  timeout 

wait_iff_congested - Conditionally wait for a backing_dev to become uncongested or a zone to complete writes : A zone to check if it is heavily congested : SYNC or ASYNC IO : timeout in jiffies

In the event of a congested backing_dev (any backing_dev) and the given has experienced recent congestion, this waits for up to jiffies for either a BDI to exit congestion of the given queue or a write to complete.

In the absence of zone congestion, cond_resched() is called to yield the processor if necessary but otherwise does not sleep.

The return value is 0 if the sleep is for the full timeout. Otherwise, it is the number of jiffies that were still remaining when the function returned. return_value == timeout implies the function did not sleep.

Definition at line 803 of file backing-dev.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.

Variable Documentation

struct list_head bdi_list
spinlock_t bdi_lock
struct list_head bdi_pending_list
struct backing_dev_info default_backing_dev_info

Definition at line 17 of file backing-dev.c.

struct backing_dev_info noop_backing_dev_info

Definition at line 25 of file backing-dev.c.