all: use mapping_set_gfp_mask() everywhere

This commit is contained in:
Thomas Schoebel-Theuer 2013-01-17 17:24:53 +01:00
parent f5ad5c4698
commit 9d491ae27c
4 changed files with 19 additions and 7 deletions

View File

@ -12,6 +12,8 @@
// messaging
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/file.h>
#include <linux/sched.h>
#include <linux/preempt.h>
#include <linux/hardirq.h>
@ -518,6 +520,7 @@ EXPORT_SYMBOL_GPL(brick_say_to);
static
void try_open_file(struct file **file, char *filename, bool creat)
{
struct address_space *mapping;
int flags = O_APPEND | O_WRONLY | O_LARGEFILE;
int prot = 0600;
@ -527,6 +530,8 @@ void try_open_file(struct file **file, char *filename, bool creat)
*file = filp_open(filename, flags, prot);
if (unlikely(IS_ERR(*file))) {
*file = NULL;
} else if ((mapping = (*file)->f_mapping)) {
mapping_set_gfp_mask(mapping, mapping_gfp_mask(mapping) & ~(__GFP_IO | __GFP_FS));
}
}

View File

@ -653,6 +653,7 @@ static int bio_switch(struct bio_brick *brick)
const char *path = brick->brick_path;
int flags = O_RDWR | O_EXCL | O_LARGEFILE;
int prot = 0600;
struct address_space *mapping;
struct inode *inode;
struct request_queue *q;
mm_segment_t oldfs;
@ -668,7 +669,7 @@ static int bio_switch(struct bio_brick *brick)
goto done;
}
if (unlikely(!brick->filp->f_mapping ||
if (unlikely(!(mapping = brick->filp->f_mapping) ||
!(inode = brick->filp->f_mapping->host))) {
MARS_ERR("internal problem with '%s'\n", path);
status = -EINVAL;
@ -680,6 +681,8 @@ static int bio_switch(struct bio_brick *brick)
goto done;
}
mapping_set_gfp_mask(mapping, mapping_gfp_mask(mapping) & ~(__GFP_IO | __GFP_FS));
q = bdev_get_queue(inode->i_bdev);
if (unlikely(!q)) {
MARS_ERR("internal queue '%s' does not exist\n", path);

View File

@ -572,6 +572,7 @@ static int sio_switch(struct sio_brick *brick)
MARS_INF("using O_DIRECT on %s\n", path);
}
if (brick->power.button) {
struct address_space *mapping;
int index;
mars_power_led_off((void*)brick, false);
@ -589,13 +590,11 @@ static int sio_switch(struct sio_brick *brick)
output->filp = NULL;
return err;
}
#if 0
{
struct address_space *mapping = output->filp->f_mapping;
int old_gfp_mask = mapping_gfp_mask(mapping);
mapping_set_gfp_mask(mapping, old_gfp_mask & ~(__GFP_IO|__GFP_FS));
if ((mapping = output->filp->f_mapping)) {
mapping_set_gfp_mask(mapping, mapping_gfp_mask(mapping) & ~(__GFP_IO | __GFP_FS));
}
#endif
MARS_INF("opened file '%s' as %p\n", path, output->filp);
output->index = 0;

View File

@ -9,6 +9,7 @@
#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/file.h>
#include <linux/blkdev.h>
#include <linux/fs.h>
#include <linux/utsname.h>
@ -614,6 +615,7 @@ err_mem0:
static int _mars_readdir(struct mars_cookie *cookie)
{
struct file *f;
struct address_space *mapping;
mm_segment_t oldfs;
int status = 0;
@ -624,6 +626,9 @@ static int _mars_readdir(struct mars_cookie *cookie)
if (unlikely(IS_ERR(f))) {
return PTR_ERR(f);
}
if ((mapping = f->f_mapping)) {
mapping_set_gfp_mask(mapping, mapping_gfp_mask(mapping) & ~(__GFP_IO | __GFP_FS));
}
for (;;) {
status = vfs_readdir(f, mars_filler, cookie);