diff options
Diffstat (limited to 'include/linux/backing-dev.h')
| -rw-r--r-- | include/linux/backing-dev.h | 54 |
1 files changed, 9 insertions, 45 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 5da6012b7a14..aff923ae8c4b 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -55,6 +55,7 @@ struct bdi_writeback { | |||
| 55 | struct list_head b_dirty; /* dirty inodes */ | 55 | struct list_head b_dirty; /* dirty inodes */ |
| 56 | struct list_head b_io; /* parked for writeback */ | 56 | struct list_head b_io; /* parked for writeback */ |
| 57 | struct list_head b_more_io; /* parked for more writeback */ | 57 | struct list_head b_more_io; /* parked for more writeback */ |
| 58 | struct list_head b_dirty_time; /* time stamps are dirty */ | ||
| 58 | spinlock_t list_lock; /* protects the b_* lists */ | 59 | spinlock_t list_lock; /* protects the b_* lists */ |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| @@ -106,6 +107,8 @@ struct backing_dev_info { | |||
| 106 | #endif | 107 | #endif |
| 107 | }; | 108 | }; |
| 108 | 109 | ||
| 110 | struct backing_dev_info *inode_to_bdi(struct inode *inode); | ||
| 111 | |||
| 109 | int __must_check bdi_init(struct backing_dev_info *bdi); | 112 | int __must_check bdi_init(struct backing_dev_info *bdi); |
| 110 | void bdi_destroy(struct backing_dev_info *bdi); | 113 | void bdi_destroy(struct backing_dev_info *bdi); |
| 111 | 114 | ||
| @@ -114,7 +117,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
| 114 | const char *fmt, ...); | 117 | const char *fmt, ...); |
| 115 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 116 | void bdi_unregister(struct backing_dev_info *bdi); | 119 | void bdi_unregister(struct backing_dev_info *bdi); |
| 117 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | 120 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 118 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
| 119 | enum wb_reason reason); | 122 | enum wb_reason reason); |
| 120 | void bdi_start_background_writeback(struct backing_dev_info *bdi); | 123 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
| @@ -228,46 +231,17 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
| 228 | * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting | 231 | * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting |
| 229 | * BDI_CAP_NO_WRITEBACK: Don't write pages back | 232 | * BDI_CAP_NO_WRITEBACK: Don't write pages back |
| 230 | * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages | 233 | * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages |
| 231 | * | ||
| 232 | * These flags let !MMU mmap() govern direct device mapping vs immediate | ||
| 233 | * copying more easily for MAP_PRIVATE, especially for ROM filesystems. | ||
| 234 | * | ||
| 235 | * BDI_CAP_MAP_COPY: Copy can be mapped (MAP_PRIVATE) | ||
| 236 | * BDI_CAP_MAP_DIRECT: Can be mapped directly (MAP_SHARED) | ||
| 237 | * BDI_CAP_READ_MAP: Can be mapped for reading | ||
| 238 | * BDI_CAP_WRITE_MAP: Can be mapped for writing | ||
| 239 | * BDI_CAP_EXEC_MAP: Can be mapped for execution | ||
| 240 | * | ||
| 241 | * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed. | ||
| 242 | * | ||
| 243 | * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold. | 234 | * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold. |
| 244 | */ | 235 | */ |
| 245 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 | 236 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 |
| 246 | #define BDI_CAP_NO_WRITEBACK 0x00000002 | 237 | #define BDI_CAP_NO_WRITEBACK 0x00000002 |
| 247 | #define BDI_CAP_MAP_COPY 0x00000004 | 238 | #define BDI_CAP_NO_ACCT_WB 0x00000004 |
| 248 | #define BDI_CAP_MAP_DIRECT 0x00000008 | 239 | #define BDI_CAP_STABLE_WRITES 0x00000008 |
| 249 | #define BDI_CAP_READ_MAP 0x00000010 | 240 | #define BDI_CAP_STRICTLIMIT 0x00000010 |
| 250 | #define BDI_CAP_WRITE_MAP 0x00000020 | ||
| 251 | #define BDI_CAP_EXEC_MAP 0x00000040 | ||
| 252 | #define BDI_CAP_NO_ACCT_WB 0x00000080 | ||
| 253 | #define BDI_CAP_SWAP_BACKED 0x00000100 | ||
| 254 | #define BDI_CAP_STABLE_WRITES 0x00000200 | ||
| 255 | #define BDI_CAP_STRICTLIMIT 0x00000400 | ||
| 256 | |||
| 257 | #define BDI_CAP_VMFLAGS \ | ||
| 258 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) | ||
| 259 | 241 | ||
| 260 | #define BDI_CAP_NO_ACCT_AND_WRITEBACK \ | 242 | #define BDI_CAP_NO_ACCT_AND_WRITEBACK \ |
| 261 | (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) | 243 | (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) |
| 262 | 244 | ||
| 263 | #if defined(VM_MAYREAD) && \ | ||
| 264 | (BDI_CAP_READ_MAP != VM_MAYREAD || \ | ||
| 265 | BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ | ||
| 266 | BDI_CAP_EXEC_MAP != VM_MAYEXEC) | ||
| 267 | #error please change backing_dev_info::capabilities flags | ||
| 268 | #endif | ||
| 269 | |||
| 270 | extern struct backing_dev_info default_backing_dev_info; | ||
| 271 | extern struct backing_dev_info noop_backing_dev_info; | 245 | extern struct backing_dev_info noop_backing_dev_info; |
| 272 | 246 | ||
| 273 | int writeback_in_progress(struct backing_dev_info *bdi); | 247 | int writeback_in_progress(struct backing_dev_info *bdi); |
| @@ -329,24 +303,14 @@ static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi) | |||
| 329 | BDI_CAP_NO_WRITEBACK)); | 303 | BDI_CAP_NO_WRITEBACK)); |
| 330 | } | 304 | } |
| 331 | 305 | ||
| 332 | static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi) | ||
| 333 | { | ||
| 334 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; | ||
| 335 | } | ||
| 336 | |||
| 337 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) | 306 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
| 338 | { | 307 | { |
| 339 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 308 | return bdi_cap_writeback_dirty(inode_to_bdi(mapping->host)); |
| 340 | } | 309 | } |
| 341 | 310 | ||
| 342 | static inline bool mapping_cap_account_dirty(struct address_space *mapping) | 311 | static inline bool mapping_cap_account_dirty(struct address_space *mapping) |
| 343 | { | 312 | { |
| 344 | return bdi_cap_account_dirty(mapping->backing_dev_info); | 313 | return bdi_cap_account_dirty(inode_to_bdi(mapping->host)); |
| 345 | } | ||
| 346 | |||
| 347 | static inline bool mapping_cap_swap_backed(struct address_space *mapping) | ||
| 348 | { | ||
| 349 | return bdi_cap_swap_backed(mapping->backing_dev_info); | ||
| 350 | } | 314 | } |
| 351 | 315 | ||
| 352 | static inline int bdi_sched_wait(void *word) | 316 | static inline int bdi_sched_wait(void *word) |
