From 9d491ae27cd906664e733d47d3606b702c75af65 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Thu, 17 Jan 2013 17:24:53 +0100 Subject: [PATCH] all: use mapping_set_gfp_mask() everywhere --- brick_say.c | 5 +++++ mars_bio.c | 5 ++++- mars_sio.c | 11 +++++------ sy_old/sy_generic.c | 5 +++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/brick_say.c b/brick_say.c index 02a42217..a580c0b6 100644 --- a/brick_say.c +++ b/brick_say.c @@ -12,6 +12,8 @@ // messaging #include +#include +#include #include #include #include @@ -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)); } } diff --git a/mars_bio.c b/mars_bio.c index 4f829a21..9fa5eaa1 100644 --- a/mars_bio.c +++ b/mars_bio.c @@ -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); diff --git a/mars_sio.c b/mars_sio.c index 730094b1..d1cd7855 100644 --- a/mars_sio.c +++ b/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; diff --git a/sy_old/sy_generic.c b/sy_old/sy_generic.c index 2e9a96bd..66fe2e9f 100644 --- a/sy_old/sy_generic.c +++ b/sy_old/sy_generic.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -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);