diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/jffs2/dir.c | 4 | ||||
| -rw-r--r-- | fs/jffs2/scan.c | 19 |
2 files changed, 11 insertions, 12 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 05f73328b28b..9a1e86fc1362 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
| @@ -75,7 +75,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
| 75 | struct nameidata *nd) | 75 | struct nameidata *nd) |
| 76 | { | 76 | { |
| 77 | struct jffs2_inode_info *dir_f; | 77 | struct jffs2_inode_info *dir_f; |
| 78 | struct jffs2_sb_info *c; | ||
| 79 | struct jffs2_full_dirent *fd = NULL, *fd_list; | 78 | struct jffs2_full_dirent *fd = NULL, *fd_list; |
| 80 | uint32_t ino = 0; | 79 | uint32_t ino = 0; |
| 81 | struct inode *inode = NULL; | 80 | struct inode *inode = NULL; |
| @@ -86,7 +85,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
| 86 | return ERR_PTR(-ENAMETOOLONG); | 85 | return ERR_PTR(-ENAMETOOLONG); |
| 87 | 86 | ||
| 88 | dir_f = JFFS2_INODE_INFO(dir_i); | 87 | dir_f = JFFS2_INODE_INFO(dir_i); |
| 89 | c = JFFS2_SB_INFO(dir_i->i_sb); | ||
| 90 | 88 | ||
| 91 | mutex_lock(&dir_f->sem); | 89 | mutex_lock(&dir_f->sem); |
| 92 | 90 | ||
| @@ -119,7 +117,6 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
| 119 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | 117 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) |
| 120 | { | 118 | { |
| 121 | struct jffs2_inode_info *f; | 119 | struct jffs2_inode_info *f; |
| 122 | struct jffs2_sb_info *c; | ||
| 123 | struct inode *inode = filp->f_path.dentry->d_inode; | 120 | struct inode *inode = filp->f_path.dentry->d_inode; |
| 124 | struct jffs2_full_dirent *fd; | 121 | struct jffs2_full_dirent *fd; |
| 125 | unsigned long offset, curofs; | 122 | unsigned long offset, curofs; |
| @@ -127,7 +124,6 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 127 | D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_path.dentry->d_inode->i_ino)); | 124 | D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_path.dentry->d_inode->i_ino)); |
| 128 | 125 | ||
| 129 | f = JFFS2_INODE_INFO(inode); | 126 | f = JFFS2_INODE_INFO(inode); |
| 130 | c = JFFS2_SB_INFO(inode->i_sb); | ||
| 131 | 127 | ||
| 132 | offset = filp->f_pos; | 128 | offset = filp->f_pos; |
| 133 | 129 | ||
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index b632dddcb482..8d8cd3419d02 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
| @@ -94,7 +94,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
| 94 | uint32_t buf_size = 0; | 94 | uint32_t buf_size = 0; |
| 95 | struct jffs2_summary *s = NULL; /* summary info collected by the scan process */ | 95 | struct jffs2_summary *s = NULL; /* summary info collected by the scan process */ |
| 96 | #ifndef __ECOS | 96 | #ifndef __ECOS |
| 97 | size_t pointlen; | 97 | size_t pointlen, try_size; |
| 98 | 98 | ||
| 99 | if (c->mtd->point) { | 99 | if (c->mtd->point) { |
| 100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, | 100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, |
| @@ -113,18 +113,21 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
| 113 | /* For NAND it's quicker to read a whole eraseblock at a time, | 113 | /* For NAND it's quicker to read a whole eraseblock at a time, |
| 114 | apparently */ | 114 | apparently */ |
| 115 | if (jffs2_cleanmarker_oob(c)) | 115 | if (jffs2_cleanmarker_oob(c)) |
| 116 | buf_size = c->sector_size; | 116 | try_size = c->sector_size; |
| 117 | else | 117 | else |
| 118 | buf_size = PAGE_SIZE; | 118 | try_size = PAGE_SIZE; |
| 119 | 119 | ||
| 120 | /* Respect kmalloc limitations */ | 120 | D1(printk(KERN_DEBUG "Trying to allocate readbuf of %zu " |
| 121 | if (buf_size > 128*1024) | 121 | "bytes\n", try_size)); |
| 122 | buf_size = 128*1024; | ||
| 123 | 122 | ||
| 124 | D1(printk(KERN_DEBUG "Allocating readbuf of %d bytes\n", buf_size)); | 123 | flashbuf = mtd_kmalloc_up_to(c->mtd, &try_size); |
| 125 | flashbuf = kmalloc(buf_size, GFP_KERNEL); | ||
| 126 | if (!flashbuf) | 124 | if (!flashbuf) |
| 127 | return -ENOMEM; | 125 | return -ENOMEM; |
| 126 | |||
| 127 | D1(printk(KERN_DEBUG "Allocated readbuf of %zu bytes\n", | ||
| 128 | try_size)); | ||
| 129 | |||
| 130 | buf_size = (uint32_t)try_size; | ||
| 128 | } | 131 | } |
| 129 | 132 | ||
| 130 | if (jffs2_sum_active()) { | 133 | if (jffs2_sum_active()) { |
