aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-09-16 02:31:11 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:54:07 -0500
commitff01bb4832651c6d25ac509a06a10fcbd75c461c (patch)
treebbfdebd317db97d346df78293566f36e883b1be9
parent94ea4158f1733e3b10cef067d535f504866e0c41 (diff)
fs: move code out of buffer.c
Move invalidate_bdev, block_sync_page into fs/block_dev.c. Export kill_bdev as well, so brd doesn't have to open code it. Reduce buffer_head.h requirement accordingly. Removed a rather large comment from invalidate_bdev, as it looked a bit obsolete to bother moving. The small comment replacing it says enough. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/powerpc/sysdev/axonram.c1
-rw-r--r--block/genhd.c1
-rw-r--r--block/ioctl.c2
-rw-r--r--drivers/block/amiflop.c2
-rw-r--r--drivers/block/brd.c9
-rw-r--r--drivers/block/floppy.c1
-rw-r--r--drivers/block/loop.c1
-rw-r--r--drivers/cdrom/cdrom.c1
-rw-r--r--drivers/md/dm.c1
-rw-r--r--drivers/md/md.c3
-rw-r--r--drivers/mtd/devices/block2mtd.c1
-rw-r--r--drivers/s390/block/dasd.c1
-rw-r--r--drivers/scsi/scsicam.c1
-rw-r--r--drivers/tty/sysrq.c2
-rw-r--r--fs/block_dev.c30
-rw-r--r--fs/buffer.c50
-rw-r--r--fs/cachefiles/interface.c1
-rw-r--r--fs/cramfs/inode.c1
-rw-r--r--fs/fs-writeback.c1
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/quota/dquot.c1
-rw-r--r--fs/quota/quota.c1
-rw-r--r--fs/splice.c1
-rw-r--r--fs/sync.c1
-rw-r--r--include/linux/fs.h3
-rw-r--r--kernel/power/swap.c1
-rw-r--r--mm/page-writeback.c2
-rw-r--r--mm/swap_state.c1
28 files changed, 40 insertions, 83 deletions
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index ba4271919062..1c16141c031c 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/bio.h> 26#include <linux/bio.h>
27#include <linux/blkdev.h> 27#include <linux/blkdev.h>
28#include <linux/buffer_head.h>
29#include <linux/device.h> 28#include <linux/device.h>
30#include <linux/errno.h> 29#include <linux/errno.h>
31#include <linux/fs.h> 30#include <linux/fs.h>
diff --git a/block/genhd.c b/block/genhd.c
index bf443a71b93e..b7d1a0e42686 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -15,7 +15,6 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/kmod.h> 16#include <linux/kmod.h>
17#include <linux/kobj_map.h> 17#include <linux/kobj_map.h>
18#include <linux/buffer_head.h>
19#include <linux/mutex.h> 18#include <linux/mutex.h>
20#include <linux/idr.h> 19#include <linux/idr.h>
21#include <linux/log2.h> 20#include <linux/log2.h>
diff --git a/block/ioctl.c b/block/ioctl.c
index ca939fc1030f..91e7b19c86f4 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -5,7 +5,7 @@
5#include <linux/blkpg.h> 5#include <linux/blkpg.h>
6#include <linux/hdreg.h> 6#include <linux/hdreg.h>
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/buffer_head.h> 8#include <linux/fs.h>
9#include <linux/blktrace_api.h> 9#include <linux/blktrace_api.h>
10#include <asm/uaccess.h> 10#include <asm/uaccess.h>
11 11
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 8eba86bba599..386146d792d1 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -63,7 +63,7 @@
63#include <linux/mutex.h> 63#include <linux/mutex.h>
64#include <linux/amifdreg.h> 64#include <linux/amifdreg.h>
65#include <linux/amifd.h> 65#include <linux/amifd.h>
66#include <linux/buffer_head.h> 66#include <linux/fs.h>
67#include <linux/blkdev.h> 67#include <linux/blkdev.h>
68#include <linux/elevator.h> 68#include <linux/elevator.h>
69#include <linux/interrupt.h> 69#include <linux/interrupt.h>
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index d22119d49e53..ec246437f5a4 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -17,7 +17,7 @@
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/radix-tree.h> 19#include <linux/radix-tree.h>
20#include <linux/buffer_head.h> /* invalidate_bh_lrus() */ 20#include <linux/fs.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22 22
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
@@ -402,14 +402,13 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
402 error = -EBUSY; 402 error = -EBUSY;
403 if (bdev->bd_openers <= 1) { 403 if (bdev->bd_openers <= 1) {
404 /* 404 /*
405 * Invalidate the cache first, so it isn't written 405 * Kill the cache first, so it isn't written back to the
406 * back to the device. 406 * device.
407 * 407 *
408 * Another thread might instantiate more buffercache here, 408 * Another thread might instantiate more buffercache here,
409 * but there is not much we can do to close that race. 409 * but there is not much we can do to close that race.
410 */ 410 */
411 invalidate_bh_lrus(); 411 kill_bdev(bdev);
412 truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
413 brd_free_pages(brd); 412 brd_free_pages(brd);
414 error = 0; 413 error = 0;
415 } 414 }
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 9955a53733b2..510fb10ec45a 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -188,7 +188,6 @@ static int print_unex = 1;
188#include <linux/init.h> 188#include <linux/init.h>
189#include <linux/platform_device.h> 189#include <linux/platform_device.h>
190#include <linux/mod_devicetable.h> 190#include <linux/mod_devicetable.h>
191#include <linux/buffer_head.h> /* for invalidate_buffers() */
192#include <linux/mutex.h> 191#include <linux/mutex.h>
193#include <linux/io.h> 192#include <linux/io.h>
194#include <linux/uaccess.h> 193#include <linux/uaccess.h>
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 1e888c9e85b3..f00257782fcc 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -69,7 +69,6 @@
69#include <linux/freezer.h> 69#include <linux/freezer.h>
70#include <linux/mutex.h> 70#include <linux/mutex.h>
71#include <linux/writeback.h> 71#include <linux/writeback.h>
72#include <linux/buffer_head.h> /* for invalidate_bdev() */
73#include <linux/completion.h> 72#include <linux/completion.h>
74#include <linux/highmem.h> 73#include <linux/highmem.h>
75#include <linux/kthread.h> 74#include <linux/kthread.h>
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index f997c27d79e2..2118211aff99 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -267,7 +267,6 @@
267 267
268#include <linux/module.h> 268#include <linux/module.h>
269#include <linux/fs.h> 269#include <linux/fs.h>
270#include <linux/buffer_head.h>
271#include <linux/major.h> 270#include <linux/major.h>
272#include <linux/types.h> 271#include <linux/types.h>
273#include <linux/errno.h> 272#include <linux/errno.h>
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 4720f68f817e..b89c548ec3f8 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -14,7 +14,6 @@
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/blkpg.h> 15#include <linux/blkpg.h>
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/buffer_head.h>
18#include <linux/mempool.h> 17#include <linux/mempool.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <linux/idr.h> 19#include <linux/idr.h>
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f47f1f8ac44b..5d1b6762f108 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -36,8 +36,7 @@
36#include <linux/blkdev.h> 36#include <linux/blkdev.h>
37#include <linux/sysctl.h> 37#include <linux/sysctl.h>
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/mutex.h> 39#include <linux/fs.h>
40#include <linux/buffer_head.h> /* for invalidate_bdev */
41#include <linux/poll.h> 40#include <linux/poll.h>
42#include <linux/ctype.h> 41#include <linux/ctype.h>
43#include <linux/string.h> 42#include <linux/string.h>
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index b78f23169d4e..ebeabc727f70 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -14,7 +14,6 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include <linux/buffer_head.h>
18#include <linux/mutex.h> 17#include <linux/mutex.h>
19#include <linux/mount.h> 18#include <linux/mount.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 65894f05a801..2de5b60ee8c8 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -17,7 +17,6 @@
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/buffer_head.h>
21#include <linux/hdreg.h> 20#include <linux/hdreg.h>
22#include <linux/async.h> 21#include <linux/async.h>
23#include <linux/mutex.h> 22#include <linux/mutex.h>
diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c
index 6803b1e26ecc..92d24d6dcb39 100644
--- a/drivers/scsi/scsicam.c
+++ b/drivers/scsi/scsicam.c
@@ -16,7 +16,6 @@
16#include <linux/genhd.h> 16#include <linux/genhd.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/buffer_head.h>
20#include <asm/unaligned.h> 19#include <asm/unaligned.h>
21 20
22#include <scsi/scsicam.h> 21#include <scsi/scsicam.h>
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 43db715f1502..7867b7c4538e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -32,7 +32,6 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/suspend.h> 33#include <linux/suspend.h>
34#include <linux/writeback.h> 34#include <linux/writeback.h>
35#include <linux/buffer_head.h> /* for fsync_bdev() */
36#include <linux/swap.h> 35#include <linux/swap.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/vt_kern.h> 37#include <linux/vt_kern.h>
@@ -41,6 +40,7 @@
41#include <linux/oom.h> 40#include <linux/oom.h>
42#include <linux/slab.h> 41#include <linux/slab.h>
43#include <linux/input.h> 42#include <linux/input.h>
43#include <linux/uaccess.h>
44 44
45#include <asm/ptrace.h> 45#include <asm/ptrace.h>
46#include <asm/irq_regs.h> 46#include <asm/irq_regs.h>
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7866cdd9fe70..69a5b6fbee2b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/blkpg.h> 18#include <linux/blkpg.h>
19#include <linux/buffer_head.h> 19#include <linux/buffer_head.h>
20#include <linux/swap.h>
20#include <linux/pagevec.h> 21#include <linux/pagevec.h>
21#include <linux/writeback.h> 22#include <linux/writeback.h>
22#include <linux/mpage.h> 23#include <linux/mpage.h>
@@ -25,6 +26,7 @@
25#include <linux/namei.h> 26#include <linux/namei.h>
26#include <linux/log2.h> 27#include <linux/log2.h>
27#include <linux/kmemleak.h> 28#include <linux/kmemleak.h>
29#include <linux/cleancache.h>
28#include <asm/uaccess.h> 30#include <asm/uaccess.h>
29#include "internal.h" 31#include "internal.h"
30 32
@@ -82,13 +84,35 @@ static sector_t max_block(struct block_device *bdev)
82} 84}
83 85
84/* Kill _all_ buffers and pagecache , dirty or not.. */ 86/* Kill _all_ buffers and pagecache , dirty or not.. */
85static void kill_bdev(struct block_device *bdev) 87void kill_bdev(struct block_device *bdev)
86{ 88{
87 if (bdev->bd_inode->i_mapping->nrpages == 0) 89 struct address_space *mapping = bdev->bd_inode->i_mapping;
90
91 if (mapping->nrpages == 0)
88 return; 92 return;
93
89 invalidate_bh_lrus(); 94 invalidate_bh_lrus();
90 truncate_inode_pages(bdev->bd_inode->i_mapping, 0); 95 truncate_inode_pages(mapping, 0);
91} 96}
97EXPORT_SYMBOL(kill_bdev);
98
99/* Invalidate clean unused buffers and pagecache. */
100void invalidate_bdev(struct block_device *bdev)
101{
102 struct address_space *mapping = bdev->bd_inode->i_mapping;
103
104 if (mapping->nrpages == 0)
105 return;
106
107 invalidate_bh_lrus();
108 lru_add_drain_all(); /* make sure all lru add caches are flushed */
109 invalidate_mapping_pages(mapping, 0, -1);
110 /* 99% of the time, we don't need to flush the cleancache on the bdev.
111 * But, for the strange corners, lets be cautious
112 */
113 cleancache_flush_inode(mapping);
114}
115EXPORT_SYMBOL(invalidate_bdev);
92 116
93int set_blocksize(struct block_device *bdev, int size) 117int set_blocksize(struct block_device *bdev, int size)
94{ 118{
diff --git a/fs/buffer.c b/fs/buffer.c
index 19d8eb7fdc81..1a30db77af32 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -41,7 +41,6 @@
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42#include <linux/mpage.h> 42#include <linux/mpage.h>
43#include <linux/bit_spinlock.h> 43#include <linux/bit_spinlock.h>
44#include <linux/cleancache.h>
45 44
46static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); 45static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
47 46
@@ -231,55 +230,6 @@ out:
231 return ret; 230 return ret;
232} 231}
233 232
234/* If invalidate_buffers() will trash dirty buffers, it means some kind
235 of fs corruption is going on. Trashing dirty data always imply losing
236 information that was supposed to be just stored on the physical layer
237 by the user.
238
239 Thus invalidate_buffers in general usage is not allwowed to trash
240 dirty buffers. For example ioctl(FLSBLKBUF) expects dirty data to
241 be preserved. These buffers are simply skipped.
242
243 We also skip buffers which are still in use. For example this can
244 happen if a userspace program is reading the block device.
245
246 NOTE: In the case where the user removed a removable-media-disk even if
247 there's still dirty data not synced on disk (due a bug in the device driver
248 or due an error of the user), by not destroying the dirty buffers we could
249 generate corruption also on the next media inserted, thus a parameter is
250 necessary to handle this case in the most safe way possible (trying
251 to not corrupt also the new disk inserted with the data belonging to
252 the old now corrupted disk). Also for the ramdisk the natural thing
253 to do in order to release the ramdisk memory is to destroy dirty buffers.
254
255 These are two special cases. Normal usage imply the device driver
256 to issue a sync on the device (without waiting I/O completion) and
257 then an invalidate_buffers call that doesn't trash dirty buffers.
258
259 For handling cache coherency with the blkdev pagecache the 'update' case
260 is been introduced. It is needed to re-read from disk any pinned
261 buffer. NOTE: re-reading from disk is destructive so we can do it only
262 when we assume nobody is changing the buffercache under our I/O and when
263 we think the disk contains more recent information than the buffercache.
264 The update == 1 pass marks the buffers we need to update, the update == 2
265 pass does the actual I/O. */
266void invalidate_bdev(struct block_device *bdev)
267{
268 struct address_space *mapping = bdev->bd_inode->i_mapping;
269
270 if (mapping->nrpages == 0)
271 return;
272
273 invalidate_bh_lrus();
274 lru_add_drain_all(); /* make sure all lru add caches are flushed */
275 invalidate_mapping_pages(mapping, 0, -1);
276 /* 99% of the time, we don't need to flush the cleancache on the bdev.
277 * But, for the strange corners, lets be cautious
278 */
279 cleancache_flush_inode(mapping);
280}
281EXPORT_SYMBOL(invalidate_bdev);
282
283/* 233/*
284 * Kick the writeback threads then try to free up some ZONE_NORMAL memory. 234 * Kick the writeback threads then try to free up some ZONE_NORMAL memory.
285 */ 235 */
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 1064805e653b..67bef6d01484 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/mount.h> 13#include <linux/mount.h>
14#include <linux/buffer_head.h>
15#include "internal.h" 14#include "internal.h"
16 15
17#define list_to_page(head) (list_entry((head)->prev, struct page, lru)) 16#define list_to_page(head) (list_entry((head)->prev, struct page, lru))
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 739fb59bcdc2..c37adb222113 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -20,7 +20,6 @@
20#include <linux/cramfs_fs.h> 20#include <linux/cramfs_fs.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/cramfs_fs_sb.h> 22#include <linux/cramfs_fs_sb.h>
23#include <linux/buffer_head.h>
24#include <linux/vfs.h> 23#include <linux/vfs.h>
25#include <linux/mutex.h> 24#include <linux/mutex.h>
26 25
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 517f211a3bd4..80a4574028f1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -25,7 +25,6 @@
25#include <linux/writeback.h> 25#include <linux/writeback.h>
26#include <linux/blkdev.h> 26#include <linux/blkdev.h>
27#include <linux/backing-dev.h> 27#include <linux/backing-dev.h>
28#include <linux/buffer_head.h>
29#include <linux/tracepoint.h> 28#include <linux/tracepoint.h>
30#include "internal.h" 29#include "internal.h"
31 30
diff --git a/fs/libfs.c b/fs/libfs.c
index f6d411eef1e7..5b2dbb3ba4fc 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -12,7 +12,7 @@
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <linux/exportfs.h> 13#include <linux/exportfs.h>
14#include <linux/writeback.h> 14#include <linux/writeback.h>
15#include <linux/buffer_head.h> 15#include <linux/buffer_head.h> /* sync_mapping_buffers */
16 16
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 5b572c89e6c4..5d81e92daf83 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -73,7 +73,6 @@
73#include <linux/security.h> 73#include <linux/security.h>
74#include <linux/kmod.h> 74#include <linux/kmod.h>
75#include <linux/namei.h> 75#include <linux/namei.h>
76#include <linux/buffer_head.h>
77#include <linux/capability.h> 76#include <linux/capability.h>
78#include <linux/quotaops.h> 77#include <linux/quotaops.h>
79#include "../internal.h" /* ugh */ 78#include "../internal.h" /* ugh */
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 35f4b0ecdeb3..7898cd688a00 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/security.h> 14#include <linux/security.h>
15#include <linux/syscalls.h> 15#include <linux/syscalls.h>
16#include <linux/buffer_head.h>
17#include <linux/capability.h> 16#include <linux/capability.h>
18#include <linux/quotaops.h> 17#include <linux/quotaops.h>
19#include <linux/types.h> 18#include <linux/types.h>
diff --git a/fs/splice.c b/fs/splice.c
index fa2defa8afcf..1ec0493266b3 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -25,7 +25,6 @@
25#include <linux/mm_inline.h> 25#include <linux/mm_inline.h>
26#include <linux/swap.h> 26#include <linux/swap.h>
27#include <linux/writeback.h> 27#include <linux/writeback.h>
28#include <linux/buffer_head.h>
29#include <linux/module.h> 28#include <linux/module.h>
30#include <linux/syscalls.h> 29#include <linux/syscalls.h>
31#include <linux/uio.h> 30#include <linux/uio.h>
diff --git a/fs/sync.c b/fs/sync.c
index 101b8ef901d7..f3501ef39235 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -14,7 +14,6 @@
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/quotaops.h> 16#include <linux/quotaops.h>
17#include <linux/buffer_head.h>
18#include <linux/backing-dev.h> 17#include <linux/backing-dev.h>
19#include "internal.h" 18#include "internal.h"
20 19
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cec429d76ab0..e853ba5eddd4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2092,6 +2092,7 @@ extern void bd_forget(struct inode *inode);
2092extern void bdput(struct block_device *); 2092extern void bdput(struct block_device *);
2093extern void invalidate_bdev(struct block_device *); 2093extern void invalidate_bdev(struct block_device *);
2094extern int sync_blockdev(struct block_device *bdev); 2094extern int sync_blockdev(struct block_device *bdev);
2095extern void kill_bdev(struct block_device *);
2095extern struct super_block *freeze_bdev(struct block_device *); 2096extern struct super_block *freeze_bdev(struct block_device *);
2096extern void emergency_thaw_all(void); 2097extern void emergency_thaw_all(void);
2097extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2098extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
@@ -2099,6 +2100,7 @@ extern int fsync_bdev(struct block_device *);
2099#else 2100#else
2100static inline void bd_forget(struct inode *inode) {} 2101static inline void bd_forget(struct inode *inode) {}
2101static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2102static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2103static inline void kill_bdev(struct block_device *bdev) {}
2102static inline void invalidate_bdev(struct block_device *bdev) {} 2104static inline void invalidate_bdev(struct block_device *bdev) {}
2103 2105
2104static inline struct super_block *freeze_bdev(struct block_device *sb) 2106static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2415,6 +2417,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2415 unsigned long nr_segs, loff_t pos); 2417 unsigned long nr_segs, loff_t pos);
2416extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2418extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2417 int datasync); 2419 int datasync);
2420extern void block_sync_page(struct page *page);
2418 2421
2419/* fs/splice.c */ 2422/* fs/splice.c */
2420extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2423extern ssize_t generic_file_splice_read(struct file *, loff_t *,
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 11a594c4ba25..3739ecced085 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -18,7 +18,6 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/genhd.h> 19#include <linux/genhd.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/buffer_head.h>
22#include <linux/bio.h> 21#include <linux/bio.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/swap.h> 23#include <linux/swap.h>
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 50f08241f981..8616ef3025a4 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -32,7 +32,7 @@
32#include <linux/sysctl.h> 32#include <linux/sysctl.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34#include <linux/syscalls.h> 34#include <linux/syscalls.h>
35#include <linux/buffer_head.h> 35#include <linux/buffer_head.h> /* __set_page_dirty_buffers */
36#include <linux/pagevec.h> 36#include <linux/pagevec.h>
37#include <trace/events/writeback.h> 37#include <trace/events/writeback.h>
38 38
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 78cc4d1f6cce..ea6b32d61873 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -13,7 +13,6 @@
13#include <linux/swapops.h> 13#include <linux/swapops.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/buffer_head.h>
17#include <linux/backing-dev.h> 16#include <linux/backing-dev.h>
18#include <linux/pagevec.h> 17#include <linux/pagevec.h>
19#include <linux/migrate.h> 18#include <linux/migrate.h>