diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-05-06 09:12:54 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-07-18 09:53:08 -0400 |
commit | 92ad8f37509a7d9d5dd6e0092211b092a7ca7fb1 (patch) | |
tree | 96c0f9c524b80e8d1d247e3f462c0c0d6fb782a5 /drivers/mtd/ubi/io.c | |
parent | 79b510c0f21174f4bd055d1aab156e548ae3a5f2 (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/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 438914d05151..7bb473e646e3 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -382,7 +382,7 @@ static int torture_peb(const struct ubi_device *ubi, int pnum) | |||
382 | void *buf; | 382 | void *buf; |
383 | int err, i, patt_count; | 383 | int err, i, patt_count; |
384 | 384 | ||
385 | buf = kmalloc(ubi->peb_size, GFP_KERNEL); | 385 | buf = vmalloc(ubi->peb_size); |
386 | if (!buf) | 386 | if (!buf) |
387 | return -ENOMEM; | 387 | return -ENOMEM; |
388 | 388 | ||
@@ -437,7 +437,7 @@ out: | |||
437 | * physical eraseblock which means something is wrong with it. | 437 | * physical eraseblock which means something is wrong with it. |
438 | */ | 438 | */ |
439 | err = -EIO; | 439 | err = -EIO; |
440 | kfree(buf); | 440 | vfree(buf); |
441 | return err; | 441 | return err; |
442 | } | 442 | } |
443 | 443 | ||
@@ -1224,9 +1224,10 @@ static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum, | |||
1224 | void *buf; | 1224 | void *buf; |
1225 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; | 1225 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; |
1226 | 1226 | ||
1227 | buf = kzalloc(len, GFP_KERNEL); | 1227 | buf = vmalloc(len); |
1228 | if (!buf) | 1228 | if (!buf) |
1229 | return -ENOMEM; | 1229 | return -ENOMEM; |
1230 | memset(buf, 0, len); | ||
1230 | 1231 | ||
1231 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); | 1232 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); |
1232 | if (err && err != -EUCLEAN) { | 1233 | if (err && err != -EUCLEAN) { |
@@ -1242,7 +1243,7 @@ static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum, | |||
1242 | goto fail; | 1243 | goto fail; |
1243 | } | 1244 | } |
1244 | 1245 | ||
1245 | kfree(buf); | 1246 | vfree(buf); |
1246 | return 0; | 1247 | return 0; |
1247 | 1248 | ||
1248 | fail: | 1249 | fail: |
@@ -1252,7 +1253,7 @@ fail: | |||
1252 | err = 1; | 1253 | err = 1; |
1253 | error: | 1254 | error: |
1254 | ubi_dbg_dump_stack(); | 1255 | ubi_dbg_dump_stack(); |
1255 | kfree(buf); | 1256 | vfree(buf); |
1256 | return err; | 1257 | return err; |
1257 | } | 1258 | } |
1258 | 1259 | ||