aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/scan.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-08-29 07:51:52 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:21 -0400
commite88d6e10e5c848fd5be8f89e09e3bce2570886b7 (patch)
tree27b5547a0e24add89deafedaed784328bc3c173e /drivers/mtd/ubi/scan.c
parent33818bbb84cd371b63ed8849cc5264d24c8b3aa2 (diff)
UBI: do not use vmalloc on I/O path
Similar reason as in case of the previous patch: it causes deadlocks if a filesystem with writeback support works on top of UBI. So pre-allocate needed buffers when attaching MTD device. We also need mutexes to protect the buffers, but they do not cause much contantion because they are used in recovery, torture, and WL copy routines, which are called seldom. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/scan.c')
-rw-r--r--drivers/mtd/ubi/scan.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 1c1401d6958b..44d87e8158c6 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -45,8 +45,7 @@
45#include "ubi.h" 45#include "ubi.h"
46 46
47#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID 47#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
48static int paranoid_check_si(const struct ubi_device *ubi, 48static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si);
49 struct ubi_scan_info *si);
50#else 49#else
51#define paranoid_check_si(ubi, si) 0 50#define paranoid_check_si(ubi, si) 0
52#endif 51#endif
@@ -259,9 +258,8 @@ static struct ubi_scan_volume *add_volume(struct ubi_scan_info *si, int vol_id,
259 * o bit 2 is cleared: the older LEB is not corrupted; 258 * o bit 2 is cleared: the older LEB is not corrupted;
260 * o bit 2 is set: the older LEB is corrupted. 259 * o bit 2 is set: the older LEB is corrupted.
261 */ 260 */
262static int compare_lebs(const struct ubi_device *ubi, 261static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb,
263 const struct ubi_scan_leb *seb, int pnum, 262 int pnum, const struct ubi_vid_hdr *vid_hdr)
264 const struct ubi_vid_hdr *vid_hdr)
265{ 263{
266 void *buf; 264 void *buf;
267 int len, err, second_is_newer, bitflips = 0, corrupted = 0; 265 int len, err, second_is_newer, bitflips = 0, corrupted = 0;
@@ -413,7 +411,7 @@ out_free_vidh:
413 * to be picked, while the older one has to be dropped. This function returns 411 * to be picked, while the older one has to be dropped. This function returns
414 * zero in case of success and a negative error code in case of failure. 412 * zero in case of success and a negative error code in case of failure.
415 */ 413 */
416int ubi_scan_add_used(const struct ubi_device *ubi, struct ubi_scan_info *si, 414int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
417 int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, 415 int pnum, int ec, const struct ubi_vid_hdr *vid_hdr,
418 int bitflips) 416 int bitflips)
419{ 417{
@@ -667,8 +665,8 @@ void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv)
667 * function returns zero in case of success and a negative error code in case 665 * function returns zero in case of success and a negative error code in case
668 * of failure. 666 * of failure.
669 */ 667 */
670int ubi_scan_erase_peb(const struct ubi_device *ubi, 668int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si,
671 const struct ubi_scan_info *si, int pnum, int ec) 669 int pnum, int ec)
672{ 670{
673 int err; 671 int err;
674 struct ubi_ec_hdr *ec_hdr; 672 struct ubi_ec_hdr *ec_hdr;
@@ -712,7 +710,7 @@ out_free:
712 * This function returns scanning physical eraseblock information in case of 710 * This function returns scanning physical eraseblock information in case of
713 * success and an error code in case of failure. 711 * success and an error code in case of failure.
714 */ 712 */
715struct ubi_scan_leb *ubi_scan_get_free_peb(const struct ubi_device *ubi, 713struct ubi_scan_leb *ubi_scan_get_free_peb(struct ubi_device *ubi,
716 struct ubi_scan_info *si) 714 struct ubi_scan_info *si)
717{ 715{
718 int err = 0, i; 716 int err = 0, i;
@@ -1110,8 +1108,7 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si)
1110 * This function returns zero if the scanning information is all right, %1 if 1108 * This function returns zero if the scanning information is all right, %1 if
1111 * not and a negative error code if an error occurred. 1109 * not and a negative error code if an error occurred.
1112 */ 1110 */
1113static int paranoid_check_si(const struct ubi_device *ubi, 1111static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
1114 struct ubi_scan_info *si)
1115{ 1112{
1116 int pnum, err, vols_found = 0; 1113 int pnum, err, vols_found = 0;
1117 struct rb_node *rb1, *rb2; 1114 struct rb_node *rb1, *rb2;