Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119648
b: refs/heads/master
c: 39ce81c
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Nov 21, 2008
1 parent 2691603 commit ab37c6a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e2d9bfa4eabee3e1919a40f20d2ef8b569bd07e
refs/heads/master: 39ce81ce7168aa7226fb9f182c3a2b57060d0905
4 changes: 2 additions & 2 deletions trunk/fs/ubifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,12 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct page *page1)
int err, page_idx, page_cnt, ret = 0, n = 0;
loff_t isize;

bu = kmalloc(sizeof(struct bu_info), GFP_NOFS);
bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN);
if (!bu)
return 0;

bu->buf_len = c->bulk_read_buf_size;
bu->buf = kmalloc(bu->buf_len, GFP_NOFS);
bu->buf = kmalloc(bu->buf_len, GFP_NOFS | __GFP_NOWARN);
if (!bu->buf)
goto out_free;

Expand Down
17 changes: 12 additions & 5 deletions trunk/fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ubifs/ubifs.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ struct ubifs_znode {
};

/**
* struct bu_info - bulk-read information
* struct bu_info - bulk-read information.
* @key: first data node key
* @zbranch: zbranches of data nodes to bulk read
* @buf: buffer to read into
Expand Down

0 comments on commit ab37c6a

Please sign in to comment.