Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f3a29da authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6

* 'linux-next' of git://git.infradead.org/ubi-2.6:
  UBI: tighten the corrupted PEB criteria
  UBI: fix check_data_ff return code
  UBI: remember copy_flag while scanning
  UBI: preserve corrupted PEBs
  UBI: add truly corrupted PEBs to corrupted list
  UBI: introduce debugging helper function
  UBI: make check_pattern function non-static
  UBI: do not put eraseblocks to the corrupted list unnecessarily
  UBI: separate out corrupted list
  UBI: change cascade of ifs to switch statements
  UBI: rename a local variable
  UBI: handle bit-flips when no header found
  UBI: remove duplicate IO error codes
  UBI: rename IO error code
  UBI: fix small 80 characters limit style issue
  UBI: cleanup and simplify Kconfig
parents 06d36293 45aafd32
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
menu "UBI - Unsorted block images"
	depends on MTD

config MTD_UBI
	tristate "Enable UBI"
	depends on MTD
menuconfig MTD_UBI
	tristate "Enable UBI - Unsorted block images"
	select CRC32
	help
	  UBI is a software layer above MTD layer which admits of LVM-like
@@ -12,11 +8,12 @@ config MTD_UBI
	  capabilities. Please, consult the MTD web site for more details
	  (www.linux-mtd.infradead.org).

if MTD_UBI

config MTD_UBI_WL_THRESHOLD
	int "UBI wear-leveling threshold"
	default 4096
	range 2 65536
	depends on MTD_UBI
	help
	  This parameter defines the maximum difference between the highest
	  erase counter value and the lowest erase counter value of eraseblocks
@@ -34,7 +31,6 @@ config MTD_UBI_BEB_RESERVE
	int "Percentage of reserved eraseblocks for bad eraseblocks handling"
	default 1
	range 0 25
	depends on MTD_UBI
	help
	  If the MTD device admits of bad eraseblocks (e.g. NAND flash), UBI
	  reserves some amount of physical eraseblocks to handle new bad
@@ -48,8 +44,6 @@ config MTD_UBI_BEB_RESERVE

config MTD_UBI_GLUEBI
	tristate "MTD devices emulation driver (gluebi)"
	default n
	depends on MTD_UBI
	help
	   This option enables gluebi - an additional driver which emulates MTD
	   devices on top of UBI volumes: for each UBI volumes an MTD device is
@@ -59,4 +53,5 @@ config MTD_UBI_GLUEBI
	   software.

source "drivers/mtd/ubi/Kconfig.debug"
endmenu

endif # MTD_UBI
+4 −25
Original line number Diff line number Diff line
comment "UBI debugging options"
	depends on MTD_UBI

config MTD_UBI_DEBUG
	bool "UBI debugging"
	depends on SYSFS
	depends on MTD_UBI
	select DEBUG_FS
	select KALLSYMS_ALL if KALLSYMS && DEBUG_KERNEL
	help
	  This option enables UBI debugging.

if MTD_UBI_DEBUG

config MTD_UBI_DEBUG_MSG
	bool "UBI debugging messages"
	depends on MTD_UBI_DEBUG
	default n
	help
	  This option enables UBI debugging messages.

config MTD_UBI_DEBUG_PARANOID
	bool "Extra self-checks"
	default n
	depends on MTD_UBI_DEBUG
	help
	  This option enables extra checks in UBI code. Note this slows UBI down
	  significantly.

config MTD_UBI_DEBUG_DISABLE_BGT
	bool "Do not enable the UBI background thread"
	depends on MTD_UBI_DEBUG
	default n
	help
	  This option switches the background thread off by default. The thread
	  may be also be enabled/disabled via UBI sysfs.

config MTD_UBI_DEBUG_EMULATE_BITFLIPS
	bool "Emulate flash bit-flips"
	depends on MTD_UBI_DEBUG
	default n
	help
	  This option emulates bit-flips with probability 1/50, which in turn
	  causes scrubbing. Useful for debugging and stressing UBI.

config MTD_UBI_DEBUG_EMULATE_WRITE_FAILURES
	bool "Emulate flash write failures"
	depends on MTD_UBI_DEBUG
	default n
	help
	  This option emulates write failures with probability 1/100. Useful for
	  debugging and testing how UBI handlines errors.

config MTD_UBI_DEBUG_EMULATE_ERASE_FAILURES
	bool "Emulate flash erase failures"
	depends on MTD_UBI_DEBUG
	default n
	help
	  This option emulates erase failures with probability 1/100. Useful for
	  debugging and testing how UBI handlines errors.

menu "Additional UBI debugging messages"
	depends on MTD_UBI_DEBUG
comment "Additional UBI debugging messages"

config MTD_UBI_DEBUG_MSG_BLD
	bool "Additional UBI initialization and build messages"
	default n
	depends on MTD_UBI_DEBUG
	help
	  This option enables detailed UBI initialization and device build
	  debugging messages.

config MTD_UBI_DEBUG_MSG_EBA
	bool "Eraseblock association unit messages"
	default n
	depends on MTD_UBI_DEBUG
	help
	  This option enables debugging messages from the UBI eraseblock
	  association unit.

config MTD_UBI_DEBUG_MSG_WL
	bool "Wear-leveling unit messages"
	default n
	depends on MTD_UBI_DEBUG
	help
	  This option enables debugging messages from the UBI wear-leveling
	  unit.

config MTD_UBI_DEBUG_MSG_IO
	bool "Input/output unit messages"
	default n
	depends on MTD_UBI_DEBUG
	help
	  This option enables debugging messages from the UBI input/output unit.

endmenu # UBI debugging messages
endif # MTD_UBI_DEBUG
+4 −2
Original line number Diff line number Diff line
@@ -95,8 +95,8 @@ DEFINE_MUTEX(ubi_devices_mutex);
static DEFINE_SPINLOCK(ubi_devices_lock);

/* "Show" method for files in '/<sysfs>/class/ubi/' */
static ssize_t ubi_version_show(struct class *class, struct class_attribute *attr,
				char *buf)
static ssize_t ubi_version_show(struct class *class,
				struct class_attribute *attr, char *buf)
{
	return sprintf(buf, "%d\n", UBI_VERSION);
}
@@ -591,6 +591,7 @@ static int attach_by_scanning(struct ubi_device *ubi)

	ubi->bad_peb_count = si->bad_peb_count;
	ubi->good_peb_count = ubi->peb_count - ubi->bad_peb_count;
	ubi->corr_peb_count = si->corr_peb_count;
	ubi->max_ec = si->max_ec;
	ubi->mean_ec = si->mean_ec;
	ubi_msg("max. sequence number:       %llu", si->max_sqnum);
@@ -972,6 +973,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
	ubi_msg("MTD device size:            %llu MiB", ubi->flash_size >> 20);
	ubi_msg("number of good PEBs:        %d", ubi->good_peb_count);
	ubi_msg("number of bad PEBs:         %d", ubi->bad_peb_count);
	ubi_msg("number of corrupted PEBs:   %d", ubi->corr_peb_count);
	ubi_msg("max. allowed volumes:       %d", ubi->vtbl_slots);
	ubi_msg("wear-leveling threshold:    %d", CONFIG_MTD_UBI_WL_THRESHOLD);
	ubi_msg("number of internal volumes: %d", UBI_INT_VOL_COUNT);
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);

#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a)  \
		print_hex_dump(l, ps, pt, r, g, b, len, a)

#ifdef CONFIG_MTD_UBI_DEBUG_MSG
/* General debugging messages */
#define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
@@ -172,6 +175,7 @@ static inline int ubi_dbg_is_erase_failure(void)
#define ubi_dbg_dump_seb(seb, type)      ({})
#define ubi_dbg_dump_mkvol_req(req)      ({})
#define ubi_dbg_dump_flash(ubi, pnum, offset, len) ({})
#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a)  ({})

#define UBI_IO_DEBUG               0
#define DBG_DISABLE_BGT            0
+8 −2
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ retry:
				 * may try to recover data. FIXME: but this is
				 * not implemented.
				 */
				if (err == UBI_IO_BAD_HDR_READ ||
				if (err == UBI_IO_BAD_HDR_EBADMSG ||
				    err == UBI_IO_BAD_HDR) {
					ubi_warn("corrupted VID header at PEB "
						 "%d, LEB %d:%d", pnum, vol_id,
@@ -963,7 +963,7 @@ write_error:
static int is_error_sane(int err)
{
	if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_HDR ||
	    err == UBI_IO_BAD_HDR_READ || err == -ETIMEDOUT)
	    err == UBI_IO_BAD_HDR_EBADMSG || err == -ETIMEDOUT)
		return 0;
	return 1;
}
@@ -1201,6 +1201,9 @@ static void print_rsvd_warning(struct ubi_device *ubi,

	ubi_warn("cannot reserve enough PEBs for bad PEB handling, reserved %d,"
		 " need %d", ubi->beb_rsvd_pebs, ubi->beb_rsvd_level);
	if (ubi->corr_peb_count)
		ubi_warn("%d PEBs are corrupted and not used",
			ubi->corr_peb_count);
}

/**
@@ -1263,6 +1266,9 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si)
	if (ubi->avail_pebs < EBA_RESERVED_PEBS) {
		ubi_err("no enough physical eraseblocks (%d, need %d)",
			ubi->avail_pebs, EBA_RESERVED_PEBS);
		if (ubi->corr_peb_count)
			ubi_err("%d PEBs are corrupted and not used",
				ubi->corr_peb_count);
		err = -ENOSPC;
		goto out_free;
	}
Loading