mirror of
https://github.com/schoebel/mars
synced 2024-12-25 08:02:26 +00:00
all: use mapping_set_gfp_mask() everywhere
This commit is contained in:
parent
f5ad5c4698
commit
9d491ae27c
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
11
mars_sio.c
11
mars_sio.c
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user