diff options
-rw-r--r-- | fs/buffer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 3660dcb97591..71649ef9b658 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -470,13 +470,18 @@ out: | |||
470 | pass does the actual I/O. */ | 470 | pass does the actual I/O. */ |
471 | void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) | 471 | void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) |
472 | { | 472 | { |
473 | struct address_space *mapping = bdev->bd_inode->i_mapping; | ||
474 | |||
475 | if (mapping->nrpages == 0) | ||
476 | return; | ||
477 | |||
473 | invalidate_bh_lrus(); | 478 | invalidate_bh_lrus(); |
474 | /* | 479 | /* |
475 | * FIXME: what about destroy_dirty_buffers? | 480 | * FIXME: what about destroy_dirty_buffers? |
476 | * We really want to use invalidate_inode_pages2() for | 481 | * We really want to use invalidate_inode_pages2() for |
477 | * that, but not until that's cleaned up. | 482 | * that, but not until that's cleaned up. |
478 | */ | 483 | */ |
479 | invalidate_inode_pages(bdev->bd_inode->i_mapping); | 484 | invalidate_inode_pages(mapping); |
480 | } | 485 | } |
481 | 486 | ||
482 | /* | 487 | /* |