diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 16:50:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 16:50:21 -0500 |
commit | 6bec0035286119eefc32a5b1102127e6a4032cb2 (patch) | |
tree | 440fab001b4c877b0b0c9fd62d8392e956e387e3 /include | |
parent | 5d8e7fb6916556e9b476de33404e8c9e2c9aee61 (diff) | |
parent | 15d0f5ea348b9c4e6d41df294dde38a56a39c7bf (diff) |
Merge branch 'for-3.20/bdi' of git://git.kernel.dk/linux-block
Pull backing device changes from Jens Axboe:
"This contains a cleanup of how the backing device is handled, in
preparation for a rework of the life time rules. In this part, the
most important change is to split the unrelated nommu mmap flags from
it, but also removing a backing_dev_info pointer from the
address_space (and inode), and a cleanup of other various minor bits.
Christoph did all the work here, I just fixed an oops with pages that
have a swap backing. Arnd fixed a missing export, and Oleg killed the
lustre backing_dev_info from staging. Last patch was from Al,
unexporting parts that are now no longer needed outside"
* 'for-3.20/bdi' of git://git.kernel.dk/linux-block:
Make super_blocks and sb_lock static
mtd: export new mtd_mmap_capabilities
fs: make inode_to_bdi() handle NULL inode
staging/lustre/llite: get rid of backing_dev_info
fs: remove default_backing_dev_info
fs: don't reassign dirty inodes to default_backing_dev_info
nfs: don't call bdi_unregister
ceph: remove call to bdi_unregister
fs: remove mapping->backing_dev_info
fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info
nilfs2: set up s_bdi like the generic mount_bdev code
block_dev: get bdev inode bdi directly from the block device
block_dev: only write bdev inode on close
fs: introduce f_op->mmap_capabilities for nommu mmap support
fs: kill BDI_CAP_SWAP_BACKED
fs: deduplicate noop_backing_dev_info
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/backing-dev.h | 53 | ||||
-rw-r--r-- | include/linux/cdev.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 28 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 2 | ||||
-rw-r--r-- | include/trace/events/writeback.h | 12 |
5 files changed, 39 insertions, 58 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 5da6012b7a14..d94077fea1f8 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -106,6 +106,8 @@ struct backing_dev_info { | |||
106 | #endif | 106 | #endif |
107 | }; | 107 | }; |
108 | 108 | ||
109 | struct backing_dev_info *inode_to_bdi(struct inode *inode); | ||
110 | |||
109 | int __must_check bdi_init(struct backing_dev_info *bdi); | 111 | int __must_check bdi_init(struct backing_dev_info *bdi); |
110 | void bdi_destroy(struct backing_dev_info *bdi); | 112 | void bdi_destroy(struct backing_dev_info *bdi); |
111 | 113 | ||
@@ -114,7 +116,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
114 | const char *fmt, ...); | 116 | const char *fmt, ...); |
115 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 117 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
116 | void bdi_unregister(struct backing_dev_info *bdi); | 118 | void bdi_unregister(struct backing_dev_info *bdi); |
117 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | 119 | 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, | 120 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
119 | enum wb_reason reason); | 121 | enum wb_reason reason); |
120 | void bdi_start_background_writeback(struct backing_dev_info *bdi); | 122 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
@@ -228,46 +230,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 | 230 | * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting |
229 | * BDI_CAP_NO_WRITEBACK: Don't write pages back | 231 | * BDI_CAP_NO_WRITEBACK: Don't write pages back |
230 | * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages | 232 | * 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. | 233 | * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold. |
244 | */ | 234 | */ |
245 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 | 235 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 |
246 | #define BDI_CAP_NO_WRITEBACK 0x00000002 | 236 | #define BDI_CAP_NO_WRITEBACK 0x00000002 |
247 | #define BDI_CAP_MAP_COPY 0x00000004 | 237 | #define BDI_CAP_NO_ACCT_WB 0x00000004 |
248 | #define BDI_CAP_MAP_DIRECT 0x00000008 | 238 | #define BDI_CAP_STABLE_WRITES 0x00000008 |
249 | #define BDI_CAP_READ_MAP 0x00000010 | 239 | #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 | 240 | ||
260 | #define BDI_CAP_NO_ACCT_AND_WRITEBACK \ | 241 | #define BDI_CAP_NO_ACCT_AND_WRITEBACK \ |
261 | (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) | 242 | (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) |
262 | 243 | ||
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; | 244 | extern struct backing_dev_info noop_backing_dev_info; |
272 | 245 | ||
273 | int writeback_in_progress(struct backing_dev_info *bdi); | 246 | int writeback_in_progress(struct backing_dev_info *bdi); |
@@ -329,24 +302,14 @@ static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi) | |||
329 | BDI_CAP_NO_WRITEBACK)); | 302 | BDI_CAP_NO_WRITEBACK)); |
330 | } | 303 | } |
331 | 304 | ||
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) | 305 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
338 | { | 306 | { |
339 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 307 | return bdi_cap_writeback_dirty(inode_to_bdi(mapping->host)); |
340 | } | 308 | } |
341 | 309 | ||
342 | static inline bool mapping_cap_account_dirty(struct address_space *mapping) | 310 | static inline bool mapping_cap_account_dirty(struct address_space *mapping) |
343 | { | 311 | { |
344 | return bdi_cap_account_dirty(mapping->backing_dev_info); | 312 | 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 | } | 313 | } |
351 | 314 | ||
352 | static inline int bdi_sched_wait(void *word) | 315 | static inline int bdi_sched_wait(void *word) |
diff --git a/include/linux/cdev.h b/include/linux/cdev.h index fb4591977b03..f8763615a5f2 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h | |||
@@ -30,6 +30,4 @@ void cdev_del(struct cdev *); | |||
30 | 30 | ||
31 | void cd_forget(struct inode *); | 31 | void cd_forget(struct inode *); |
32 | 32 | ||
33 | extern struct backing_dev_info directly_mappable_cdev_bdi; | ||
34 | |||
35 | #endif | 33 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index cdcb1e9d9613..ec0f1dc66b9b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/byteorder.h> | 34 | #include <asm/byteorder.h> |
35 | #include <uapi/linux/fs.h> | 35 | #include <uapi/linux/fs.h> |
36 | 36 | ||
37 | struct backing_dev_info; | ||
37 | struct export_operations; | 38 | struct export_operations; |
38 | struct hd_geometry; | 39 | struct hd_geometry; |
39 | struct iovec; | 40 | struct iovec; |
@@ -394,7 +395,6 @@ int pagecache_write_end(struct file *, struct address_space *mapping, | |||
394 | loff_t pos, unsigned len, unsigned copied, | 395 | loff_t pos, unsigned len, unsigned copied, |
395 | struct page *page, void *fsdata); | 396 | struct page *page, void *fsdata); |
396 | 397 | ||
397 | struct backing_dev_info; | ||
398 | struct address_space { | 398 | struct address_space { |
399 | struct inode *host; /* owner: inode, block_device */ | 399 | struct inode *host; /* owner: inode, block_device */ |
400 | struct radix_tree_root page_tree; /* radix tree of all pages */ | 400 | struct radix_tree_root page_tree; /* radix tree of all pages */ |
@@ -408,7 +408,6 @@ struct address_space { | |||
408 | pgoff_t writeback_index;/* writeback starts here */ | 408 | pgoff_t writeback_index;/* writeback starts here */ |
409 | const struct address_space_operations *a_ops; /* methods */ | 409 | const struct address_space_operations *a_ops; /* methods */ |
410 | unsigned long flags; /* error bits/gfp mask */ | 410 | unsigned long flags; /* error bits/gfp mask */ |
411 | struct backing_dev_info *backing_dev_info; /* device readahead, etc */ | ||
412 | spinlock_t private_lock; /* for use by the address_space */ | 411 | spinlock_t private_lock; /* for use by the address_space */ |
413 | struct list_head private_list; /* ditto */ | 412 | struct list_head private_list; /* ditto */ |
414 | void *private_data; /* ditto */ | 413 | void *private_data; /* ditto */ |
@@ -1201,8 +1200,6 @@ struct mm_struct; | |||
1201 | #define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ | 1200 | #define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ |
1202 | #define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ | 1201 | #define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ |
1203 | 1202 | ||
1204 | extern struct list_head super_blocks; | ||
1205 | extern spinlock_t sb_lock; | ||
1206 | 1203 | ||
1207 | /* Possible states of 'frozen' field */ | 1204 | /* Possible states of 'frozen' field */ |
1208 | enum { | 1205 | enum { |
@@ -1519,6 +1516,26 @@ struct block_device_operations; | |||
1519 | #define HAVE_COMPAT_IOCTL 1 | 1516 | #define HAVE_COMPAT_IOCTL 1 |
1520 | #define HAVE_UNLOCKED_IOCTL 1 | 1517 | #define HAVE_UNLOCKED_IOCTL 1 |
1521 | 1518 | ||
1519 | /* | ||
1520 | * These flags let !MMU mmap() govern direct device mapping vs immediate | ||
1521 | * copying more easily for MAP_PRIVATE, especially for ROM filesystems. | ||
1522 | * | ||
1523 | * NOMMU_MAP_COPY: Copy can be mapped (MAP_PRIVATE) | ||
1524 | * NOMMU_MAP_DIRECT: Can be mapped directly (MAP_SHARED) | ||
1525 | * NOMMU_MAP_READ: Can be mapped for reading | ||
1526 | * NOMMU_MAP_WRITE: Can be mapped for writing | ||
1527 | * NOMMU_MAP_EXEC: Can be mapped for execution | ||
1528 | */ | ||
1529 | #define NOMMU_MAP_COPY 0x00000001 | ||
1530 | #define NOMMU_MAP_DIRECT 0x00000008 | ||
1531 | #define NOMMU_MAP_READ VM_MAYREAD | ||
1532 | #define NOMMU_MAP_WRITE VM_MAYWRITE | ||
1533 | #define NOMMU_MAP_EXEC VM_MAYEXEC | ||
1534 | |||
1535 | #define NOMMU_VMFLAGS \ | ||
1536 | (NOMMU_MAP_READ | NOMMU_MAP_WRITE | NOMMU_MAP_EXEC) | ||
1537 | |||
1538 | |||
1522 | struct iov_iter; | 1539 | struct iov_iter; |
1523 | 1540 | ||
1524 | struct file_operations { | 1541 | struct file_operations { |
@@ -1553,6 +1570,9 @@ struct file_operations { | |||
1553 | long (*fallocate)(struct file *file, int mode, loff_t offset, | 1570 | long (*fallocate)(struct file *file, int mode, loff_t offset, |
1554 | loff_t len); | 1571 | loff_t len); |
1555 | void (*show_fdinfo)(struct seq_file *m, struct file *f); | 1572 | void (*show_fdinfo)(struct seq_file *m, struct file *f); |
1573 | #ifndef CONFIG_MMU | ||
1574 | unsigned (*mmap_capabilities)(struct file *); | ||
1575 | #endif | ||
1556 | }; | 1576 | }; |
1557 | 1577 | ||
1558 | struct inode_operations { | 1578 | struct inode_operations { |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 031ff3a9a0bd..3301c4c289d6 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -408,4 +408,6 @@ static inline int mtd_is_bitflip_or_eccerr(int err) { | |||
408 | return mtd_is_bitflip(err) || mtd_is_eccerr(err); | 408 | return mtd_is_bitflip(err) || mtd_is_eccerr(err); |
409 | } | 409 | } |
410 | 410 | ||
411 | unsigned mtd_mmap_capabilities(struct mtd_info *mtd); | ||
412 | |||
411 | #endif /* __MTD_MTD_H__ */ | 413 | #endif /* __MTD_MTD_H__ */ |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index cee02d65ab3f..0e9310905413 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -47,7 +47,7 @@ TRACE_EVENT(writeback_dirty_page, | |||
47 | 47 | ||
48 | TP_fast_assign( | 48 | TP_fast_assign( |
49 | strncpy(__entry->name, | 49 | strncpy(__entry->name, |
50 | mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32); | 50 | mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32); |
51 | __entry->ino = mapping ? mapping->host->i_ino : 0; | 51 | __entry->ino = mapping ? mapping->host->i_ino : 0; |
52 | __entry->index = page->index; | 52 | __entry->index = page->index; |
53 | ), | 53 | ), |
@@ -72,7 +72,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, | |||
72 | ), | 72 | ), |
73 | 73 | ||
74 | TP_fast_assign( | 74 | TP_fast_assign( |
75 | struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; | 75 | struct backing_dev_info *bdi = inode_to_bdi(inode); |
76 | 76 | ||
77 | /* may be called for files on pseudo FSes w/ unregistered bdi */ | 77 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
78 | strncpy(__entry->name, | 78 | strncpy(__entry->name, |
@@ -116,7 +116,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, | |||
116 | 116 | ||
117 | TP_fast_assign( | 117 | TP_fast_assign( |
118 | strncpy(__entry->name, | 118 | strncpy(__entry->name, |
119 | dev_name(inode->i_mapping->backing_dev_info->dev), 32); | 119 | dev_name(inode_to_bdi(inode)->dev), 32); |
120 | __entry->ino = inode->i_ino; | 120 | __entry->ino = inode->i_ino; |
121 | __entry->sync_mode = wbc->sync_mode; | 121 | __entry->sync_mode = wbc->sync_mode; |
122 | ), | 122 | ), |
@@ -156,10 +156,8 @@ DECLARE_EVENT_CLASS(writeback_work_class, | |||
156 | __field(int, reason) | 156 | __field(int, reason) |
157 | ), | 157 | ), |
158 | TP_fast_assign( | 158 | TP_fast_assign( |
159 | struct device *dev = bdi->dev; | 159 | strncpy(__entry->name, |
160 | if (!dev) | 160 | bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); |
161 | dev = default_backing_dev_info.dev; | ||
162 | strncpy(__entry->name, dev_name(dev), 32); | ||
163 | __entry->nr_pages = work->nr_pages; | 161 | __entry->nr_pages = work->nr_pages; |
164 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; | 162 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; |
165 | __entry->sync_mode = work->sync_mode; | 163 | __entry->sync_mode = work->sync_mode; |