diff options
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 8ebbfdf708c2..ac7031f12ea5 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1234,6 +1234,20 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
1234 | return blkdev_ioctl(bdev, mode, cmd, arg); | 1234 | return blkdev_ioctl(bdev, mode, cmd, arg); |
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | /* | ||
1238 | * Try to release a page associated with block device when the system | ||
1239 | * is under memory pressure. | ||
1240 | */ | ||
1241 | static int blkdev_releasepage(struct page *page, gfp_t wait) | ||
1242 | { | ||
1243 | struct super_block *super = BDEV_I(page->mapping->host)->bdev.bd_super; | ||
1244 | |||
1245 | if (super && super->s_op->bdev_try_to_free_page) | ||
1246 | return super->s_op->bdev_try_to_free_page(super, page, wait); | ||
1247 | |||
1248 | return try_to_free_buffers(page); | ||
1249 | } | ||
1250 | |||
1237 | static const struct address_space_operations def_blk_aops = { | 1251 | static const struct address_space_operations def_blk_aops = { |
1238 | .readpage = blkdev_readpage, | 1252 | .readpage = blkdev_readpage, |
1239 | .writepage = blkdev_writepage, | 1253 | .writepage = blkdev_writepage, |
@@ -1241,6 +1255,7 @@ static const struct address_space_operations def_blk_aops = { | |||
1241 | .write_begin = blkdev_write_begin, | 1255 | .write_begin = blkdev_write_begin, |
1242 | .write_end = blkdev_write_end, | 1256 | .write_end = blkdev_write_end, |
1243 | .writepages = generic_writepages, | 1257 | .writepages = generic_writepages, |
1258 | .releasepage = blkdev_releasepage, | ||
1244 | .direct_IO = blkdev_direct_IO, | 1259 | .direct_IO = blkdev_direct_IO, |
1245 | }; | 1260 | }; |
1246 | 1261 | ||