diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-11 12:17:05 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-11 12:17:05 -0400 |
| commit | a12e4d304ce701844c639541d90df86e165d03f9 (patch) | |
| tree | 6ad7314b63a3303d9aa36f1c7eeb68abf64d3592 /include/linux/backing-dev.h | |
| parent | 89af571ca633ada14d17746519a179553a732d31 (diff) | |
| parent | 500b067c5e6ceea49cf280a02597b1169320e08c (diff) | |
Merge branch 'writeback' of git://git.kernel.dk/linux-2.6-block
* 'writeback' of git://git.kernel.dk/linux-2.6-block:
writeback: check for registered bdi in flusher add and inode dirty
writeback: add name to backing_dev_info
writeback: add some debug inode list counters to bdi stats
writeback: get rid of pdflush completely
writeback: switch to per-bdi threads for flushing data
writeback: move dirty inodes from super_block to backing_dev_info
writeback: get rid of generic_sync_sb_inodes() export
Diffstat (limited to 'include/linux/backing-dev.h')
| -rw-r--r-- | include/linux/backing-dev.h | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 1d52425a6118..f169bcb90b58 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | #include <linux/proportions.h> | 13 | #include <linux/proportions.h> |
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
| 16 | #include <linux/sched.h> | ||
| 17 | #include <linux/writeback.h> | ||
| 16 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
| 17 | 19 | ||
| 18 | struct page; | 20 | struct page; |
| @@ -23,9 +25,11 @@ struct dentry; | |||
| 23 | * Bits in backing_dev_info.state | 25 | * Bits in backing_dev_info.state |
| 24 | */ | 26 | */ |
| 25 | enum bdi_state { | 27 | enum bdi_state { |
| 26 | BDI_pdflush, /* A pdflush thread is working this device */ | 28 | BDI_pending, /* On its way to being activated */ |
| 29 | BDI_wb_alloc, /* Default embedded wb allocated */ | ||
| 27 | BDI_async_congested, /* The async (write) queue is getting full */ | 30 | BDI_async_congested, /* The async (write) queue is getting full */ |
| 28 | BDI_sync_congested, /* The sync queue is getting full */ | 31 | BDI_sync_congested, /* The sync queue is getting full */ |
| 32 | BDI_registered, /* bdi_register() was done */ | ||
| 29 | BDI_unused, /* Available bits start here */ | 33 | BDI_unused, /* Available bits start here */ |
| 30 | }; | 34 | }; |
| 31 | 35 | ||
| @@ -39,7 +43,22 @@ enum bdi_stat_item { | |||
| 39 | 43 | ||
| 40 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) | 44 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) |
| 41 | 45 | ||
| 46 | struct bdi_writeback { | ||
| 47 | struct list_head list; /* hangs off the bdi */ | ||
| 48 | |||
| 49 | struct backing_dev_info *bdi; /* our parent bdi */ | ||
| 50 | unsigned int nr; | ||
| 51 | |||
| 52 | unsigned long last_old_flush; /* last old data flush */ | ||
| 53 | |||
| 54 | struct task_struct *task; /* writeback task */ | ||
| 55 | struct list_head b_dirty; /* dirty inodes */ | ||
| 56 | struct list_head b_io; /* parked for writeback */ | ||
| 57 | struct list_head b_more_io; /* parked for more writeback */ | ||
| 58 | }; | ||
| 59 | |||
| 42 | struct backing_dev_info { | 60 | struct backing_dev_info { |
| 61 | struct list_head bdi_list; | ||
| 43 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ | 62 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ |
| 44 | unsigned long state; /* Always use atomic bitops on this */ | 63 | unsigned long state; /* Always use atomic bitops on this */ |
| 45 | unsigned int capabilities; /* Device capabilities */ | 64 | unsigned int capabilities; /* Device capabilities */ |
| @@ -48,6 +67,8 @@ struct backing_dev_info { | |||
| 48 | void (*unplug_io_fn)(struct backing_dev_info *, struct page *); | 67 | void (*unplug_io_fn)(struct backing_dev_info *, struct page *); |
| 49 | void *unplug_io_data; | 68 | void *unplug_io_data; |
| 50 | 69 | ||
| 70 | char *name; | ||
| 71 | |||
| 51 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; | 72 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; |
| 52 | 73 | ||
| 53 | struct prop_local_percpu completions; | 74 | struct prop_local_percpu completions; |
| @@ -56,6 +77,14 @@ struct backing_dev_info { | |||
| 56 | unsigned int min_ratio; | 77 | unsigned int min_ratio; |
| 57 | unsigned int max_ratio, max_prop_frac; | 78 | unsigned int max_ratio, max_prop_frac; |
| 58 | 79 | ||
| 80 | struct bdi_writeback wb; /* default writeback info for this bdi */ | ||
| 81 | spinlock_t wb_lock; /* protects update side of wb_list */ | ||
| 82 | struct list_head wb_list; /* the flusher threads hanging off this bdi */ | ||
| 83 | unsigned long wb_mask; /* bitmask of registered tasks */ | ||
| 84 | unsigned int wb_cnt; /* number of registered tasks */ | ||
| 85 | |||
| 86 | struct list_head work_list; | ||
| 87 | |||
| 59 | struct device *dev; | 88 | struct device *dev; |
| 60 | 89 | ||
| 61 | #ifdef CONFIG_DEBUG_FS | 90 | #ifdef CONFIG_DEBUG_FS |
| @@ -71,6 +100,19 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
| 71 | const char *fmt, ...); | 100 | const char *fmt, ...); |
| 72 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 101 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 73 | void bdi_unregister(struct backing_dev_info *bdi); | 102 | void bdi_unregister(struct backing_dev_info *bdi); |
| 103 | void bdi_start_writeback(struct writeback_control *wbc); | ||
| 104 | int bdi_writeback_task(struct bdi_writeback *wb); | ||
| 105 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | ||
| 106 | |||
| 107 | extern spinlock_t bdi_lock; | ||
| 108 | extern struct list_head bdi_list; | ||
| 109 | |||
| 110 | static inline int wb_has_dirty_io(struct bdi_writeback *wb) | ||
| 111 | { | ||
| 112 | return !list_empty(&wb->b_dirty) || | ||
| 113 | !list_empty(&wb->b_io) || | ||
| 114 | !list_empty(&wb->b_more_io); | ||
| 115 | } | ||
| 74 | 116 | ||
| 75 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, | 117 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, |
| 76 | enum bdi_stat_item item, s64 amount) | 118 | enum bdi_stat_item item, s64 amount) |
| @@ -261,6 +303,11 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi) | |||
| 261 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; | 303 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; |
| 262 | } | 304 | } |
| 263 | 305 | ||
| 306 | static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi) | ||
| 307 | { | ||
| 308 | return bdi == &default_backing_dev_info; | ||
| 309 | } | ||
| 310 | |||
| 264 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) | 311 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
| 265 | { | 312 | { |
| 266 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 313 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); |
| @@ -276,4 +323,10 @@ static inline bool mapping_cap_swap_backed(struct address_space *mapping) | |||
| 276 | return bdi_cap_swap_backed(mapping->backing_dev_info); | 323 | return bdi_cap_swap_backed(mapping->backing_dev_info); |
| 277 | } | 324 | } |
| 278 | 325 | ||
| 326 | static inline int bdi_sched_wait(void *word) | ||
| 327 | { | ||
| 328 | schedule(); | ||
| 329 | return 0; | ||
| 330 | } | ||
| 331 | |||
| 279 | #endif /* _LINUX_BACKING_DEV_H */ | 332 | #endif /* _LINUX_BACKING_DEV_H */ |
