aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/cdev.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-05-06 09:12:54 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-18 09:53:08 -0400
commit92ad8f37509a7d9d5dd6e0092211b092a7ca7fb1 (patch)
tree96c0f9c524b80e8d1d247e3f462c0c0d6fb782a5 /drivers/mtd/ubi/cdev.c
parent79b510c0f21174f4bd055d1aab156e548ae3a5f2 (diff)
UBI: use vmalloc for large buffers
UBI allocates temporary buffers of PEB size, which may be 256KiB. Use vmalloc instead of kmalloc for such big temporary buffers. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r--drivers/mtd/ubi/cdev.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 959044a2ddbf..34375ee6d4a4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -153,7 +153,7 @@ static int vol_cdev_release(struct inode *inode, struct file *file)
153 ubi_warn("update of volume %d not finished, volume is damaged", 153 ubi_warn("update of volume %d not finished, volume is damaged",
154 vol->vol_id); 154 vol->vol_id);
155 vol->updating = 0; 155 vol->updating = 0;
156 kfree(vol->upd_buf); 156 vfree(vol->upd_buf);
157 } 157 }
158 158
159 ubi_close_volume(desc); 159 ubi_close_volume(desc);
@@ -232,7 +232,7 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
232 tbuf_size = vol->usable_leb_size; 232 tbuf_size = vol->usable_leb_size;
233 if (count < tbuf_size) 233 if (count < tbuf_size)
234 tbuf_size = ALIGN(count, ubi->min_io_size); 234 tbuf_size = ALIGN(count, ubi->min_io_size);
235 tbuf = kmalloc(tbuf_size, GFP_KERNEL); 235 tbuf = vmalloc(tbuf_size);
236 if (!tbuf) 236 if (!tbuf)
237 return -ENOMEM; 237 return -ENOMEM;
238 238
@@ -271,7 +271,7 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
271 len = count > tbuf_size ? tbuf_size : count; 271 len = count > tbuf_size ? tbuf_size : count;
272 } while (count); 272 } while (count);
273 273
274 kfree(tbuf); 274 vfree(tbuf);
275 return err ? err : count_save - count; 275 return err ? err : count_save - count;
276} 276}
277 277
@@ -320,7 +320,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
320 tbuf_size = vol->usable_leb_size; 320 tbuf_size = vol->usable_leb_size;
321 if (count < tbuf_size) 321 if (count < tbuf_size)
322 tbuf_size = ALIGN(count, ubi->min_io_size); 322 tbuf_size = ALIGN(count, ubi->min_io_size);
323 tbuf = kmalloc(tbuf_size, GFP_KERNEL); 323 tbuf = vmalloc(tbuf_size);
324 if (!tbuf) 324 if (!tbuf)
325 return -ENOMEM; 325 return -ENOMEM;
326 326
@@ -355,7 +355,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
355 len = count > tbuf_size ? tbuf_size : count; 355 len = count > tbuf_size ? tbuf_size : count;
356 } 356 }
357 357
358 kfree(tbuf); 358 vfree(tbuf);
359 return err ? err : count_save - count; 359 return err ? err : count_save - count;
360} 360}
361 361