summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorArtem Bityutskiy2008-11-18 17:09:49 +0100
committerArtem Bityutskiy2008-11-21 17:59:16 +0100
commit39ce81ce7168aa7226fb9f182c3a2b57060d0905 (patch)
tree8b3c8ff8559c7d3243c0299cae6986aa21601c60 /fs/ubifs/super.c
parentUBIFS: allow for gaps when dirtying the LPT (diff)
downloadkernel-qcow2-linux-39ce81ce7168aa7226fb9f182c3a2b57060d0905.tar.gz
kernel-qcow2-linux-39ce81ce7168aa7226fb9f182c3a2b57060d0905.tar.xz
kernel-qcow2-linux-39ce81ce7168aa7226fb9f182c3a2b57060d0905.zip
UBIFS: do not print scary memory allocation warnings
Bulk-read allocates a lot of memory with 'kmalloc()', and when it is/gets fragmented 'kmalloc()' fails with a scarry warning. But because bulk-read is just an optimization, UBIFS keeps working fine. Supress the warning by passing __GFP_NOWARN option to 'kmalloc()'. This patch also introduces a macro for the magic 128KiB constant. This is just neater. Note, this is not really fixes the problem we had, but just hides the warnings. The further patches fix the problem. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 8780efbf40ac..ea493e6f2652 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -36,6 +36,12 @@
#include <linux/mount.h>
#include "ubifs.h"
+/*
+ * Maximum amount of memory we may 'kmalloc()' without worrying that we are
+ * allocating too much.
+ */
+#define UBIFS_KMALLOC_OK (128*1024)
+
/* Slab cache for UBIFS inodes */
struct kmem_cache *ubifs_inode_slab;
@@ -561,17 +567,18 @@ static int init_constants_early(struct ubifs_info *c)
* calculations when reporting free space.
*/
c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ;
+
/* Buffer size for bulk-reads */
c->bulk_read_buf_size = UBIFS_MAX_BULK_READ * UBIFS_MAX_DATA_NODE_SZ;
if (c->bulk_read_buf_size > c->leb_size)
c->bulk_read_buf_size = c->leb_size;
- if (c->bulk_read_buf_size > 128 * 1024) {
- /* Check if we can kmalloc more than 128KiB */
- void *try = kmalloc(c->bulk_read_buf_size, GFP_KERNEL);
-
+ if (c->bulk_read_buf_size > UBIFS_KMALLOC_OK) {
+ /* Check if we can kmalloc that much */
+ void *try = kmalloc(c->bulk_read_buf_size,
+ GFP_KERNEL | __GFP_NOWARN);
kfree(try);
if (!try)
- c->bulk_read_buf_size = 128 * 1024;
+ c->bulk_read_buf_size = UBIFS_KMALLOC_OK;
}
return 0;
}