infra: clean buffer cache on opening block devices

This commit is contained in:
Thomas Schoebel-Theuer 2015-06-08 14:32:29 +02:00
parent 6aede1fc62
commit 6eb5cefc19
3 changed files with 3 additions and 2 deletions

View File

@ -48,7 +48,6 @@ DECLARE_RWSEM(mapfree_mutex);
static
LIST_HEAD(mapfree_list);
static
void mapfree_pages(struct mapfree_info *mf, int grace_keep)
{
struct address_space *mapping;

View File

@ -72,6 +72,8 @@ void mapfree_put(struct mapfree_info *mf);
void mapfree_set(struct mapfree_info *mf, loff_t min, loff_t max);
void mapfree_pages(struct mapfree_info *mf, int grace_keep);
////////////////// dirty IOs on the fly //////////////////
void mf_insert_dirty(struct mapfree_info *mf, struct dirty_info *di);

View File

@ -743,7 +743,7 @@ static int bio_switch(struct bio_brick *brick)
MARS_ERR("cannot open file '%s'\n", path);
goto done;
}
mapfree_pages(brick->mf, -1);
if (unlikely(!(mapping = brick->mf->mf_filp->f_mapping) ||
!(inode = mapping->host))) {
MARS_ERR("internal problem with '%s'\n", path);