aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 16:50:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 16:50:21 -0500
commit6bec0035286119eefc32a5b1102127e6a4032cb2 (patch)
tree440fab001b4c877b0b0c9fd62d8392e956e387e3 /include
parent5d8e7fb6916556e9b476de33404e8c9e2c9aee61 (diff)
parent15d0f5ea348b9c4e6d41df294dde38a56a39c7bf (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.h53
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/fs.h28
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/trace/events/writeback.h12
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
109struct backing_dev_info *inode_to_bdi(struct inode *inode);
110
109int __must_check bdi_init(struct backing_dev_info *bdi); 111int __must_check bdi_init(struct backing_dev_info *bdi);
110void bdi_destroy(struct backing_dev_info *bdi); 112void 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, ...);
115int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 117int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
116void bdi_unregister(struct backing_dev_info *bdi); 118void bdi_unregister(struct backing_dev_info *bdi);
117int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 119int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);
118void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, 120void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
119 enum wb_reason reason); 121 enum wb_reason reason);
120void bdi_start_background_writeback(struct backing_dev_info *bdi); 122void 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
270extern struct backing_dev_info default_backing_dev_info;
271extern struct backing_dev_info noop_backing_dev_info; 244extern struct backing_dev_info noop_backing_dev_info;
272 245
273int writeback_in_progress(struct backing_dev_info *bdi); 246int 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
332static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi)
333{
334 return bdi->capabilities & BDI_CAP_SWAP_BACKED;
335}
336
337static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) 305static 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
342static inline bool mapping_cap_account_dirty(struct address_space *mapping) 310static 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
347static 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
352static inline int bdi_sched_wait(void *word) 315static 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
31void cd_forget(struct inode *); 31void cd_forget(struct inode *);
32 32
33extern 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
37struct backing_dev_info;
37struct export_operations; 38struct export_operations;
38struct hd_geometry; 39struct hd_geometry;
39struct iovec; 40struct 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
397struct backing_dev_info;
398struct address_space { 398struct 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
1204extern struct list_head super_blocks;
1205extern spinlock_t sb_lock;
1206 1203
1207/* Possible states of 'frozen' field */ 1204/* Possible states of 'frozen' field */
1208enum { 1205enum {
@@ -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
1522struct iov_iter; 1539struct iov_iter;
1523 1540
1524struct file_operations { 1541struct 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
1558struct inode_operations { 1578struct 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
411unsigned 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;