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

Commit 912f7983 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Revert "mtd: ubi: Read disturb infrastructure""

parents 6e7a0496 ac6bccae
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
/*
 * Copyright (c) International Business Machines Corp., 2006
 * Copyright (c) Nokia Corporation, 2007
 * Copyright (c) 2014 - 2015, Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2
 * license terms, and distributes only under these terms.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -146,12 +143,6 @@ static struct device_attribute dev_bgt_enabled =
	__ATTR(bgt_enabled, S_IRUGO, dev_attribute_show, NULL);
static struct device_attribute dev_mtd_num =
	__ATTR(mtd_num, S_IRUGO, dev_attribute_show, NULL);
static struct device_attribute dev_dt_threshold =
	__ATTR(dt_threshold, S_IRUGO | S_IWUGO, dev_attribute_show,
		   dev_attribute_store);
static struct device_attribute dev_rd_threshold =
	__ATTR(rd_threshold, S_IRUGO | S_IWUGO, dev_attribute_show,
		   dev_attribute_store);
static struct device_attribute dev_mtd_trigger_scrub =
	__ATTR(peb_scrub, S_IRUGO | S_IWUSR,
		dev_attribute_show, dev_attribute_store);
@@ -392,10 +383,6 @@ static ssize_t dev_attribute_show(struct device *dev,
		ret = sprintf(buf, "%d\n", ubi->thread_enabled);
	else if (attr == &dev_mtd_num)
		ret = sprintf(buf, "%d\n", ubi->mtd->index);
	else if (attr == &dev_dt_threshold)
		ret = sprintf(buf, "%d\n", ubi->dt_threshold);
	else if (attr == &dev_rd_threshold)
		ret = sprintf(buf, "%d\n", ubi->rd_threshold);
	else if (attr == &dev_mtd_trigger_scrub)
		ret = snprintf(buf, 3, "%d\n", ubi->scrub_in_progress);
	else
@@ -421,20 +408,6 @@ static ssize_t dev_attribute_store(struct device *dev,
	if (kstrtos32(buf, 10, &value)) {
		ret = -EINVAL;
		goto out;
	}
	/* Consider triggering full scan if threshods change */
	else if (attr == &dev_dt_threshold) {
		if (value < UBI_MAX_DT_THRESHOLD)
			ubi->dt_threshold = value;
		else
			pr_err("Max supported threshold value is %d",
				   UBI_MAX_DT_THRESHOLD);
	} else if (attr == &dev_rd_threshold) {
		if (value < UBI_MAX_READCOUNTER)
			ubi->rd_threshold = value;
		else
			pr_err("Max supported threshold value is %d",
				   UBI_MAX_READCOUNTER);
	} else if (attr == &dev_mtd_trigger_scrub) {
		if (value != 1) {
			pr_err("Invalid input. Echo 1 to start trigger");
@@ -514,12 +487,6 @@ static int ubi_sysfs_init(struct ubi_device *ubi, int *ref)
	if (err)
		return err;
	err = device_create_file(&ubi->dev, &dev_mtd_num);
	if (err)
		return err;
	err = device_create_file(&ubi->dev, &dev_dt_threshold);
	if (err)
		return err;
	err = device_create_file(&ubi->dev, &dev_rd_threshold);
	if (err)
		return err;
	err = device_create_file(&ubi->dev, &dev_mtd_trigger_scrub);
@@ -534,8 +501,6 @@ static void ubi_sysfs_close(struct ubi_device *ubi)
{
	device_remove_file(&ubi->dev, &dev_mtd_trigger_scrub);
	device_remove_file(&ubi->dev, &dev_mtd_num);
	device_remove_file(&ubi->dev, &dev_dt_threshold);
	device_remove_file(&ubi->dev, &dev_rd_threshold);
	device_remove_file(&ubi->dev, &dev_bgt_enabled);
	device_remove_file(&ubi->dev, &dev_min_io_size);
	device_remove_file(&ubi->dev, &dev_max_vol_count);
+5 −9
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012 Linutronix GmbH
 * Copyright (c) 2014, Linux Foundation. All rights reserved.
 *
 * Author: Richard Weinberger <richard@nod.at>
 *
 * This program is free software; you can redistribute it and/or modify
@@ -732,9 +730,9 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
		}

		for (j = 0; j < be32_to_cpu(fm_eba->reserved_pebs); j++) {
			int pnum = be32_to_cpu(fm_eba->peb_data[j].pnum);
			int pnum = be32_to_cpu(fm_eba->pnum[j]);

			if ((int)be32_to_cpu(fm_eba->peb_data[j].pnum) < 0)
			if ((int)be32_to_cpu(fm_eba->pnum[j]) < 0)
				continue;

			aeb = NULL;
@@ -762,8 +760,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
				}

				aeb->lnum = j;
				aeb->pnum =
					be32_to_cpu(fm_eba->peb_data[j].pnum);
				aeb->pnum = be32_to_cpu(fm_eba->pnum[j]);
				aeb->ec = -1;
				aeb->scrub = aeb->copy_flag = aeb->sqnum = 0;
				list_add_tail(&aeb->u.list, &eba_orphans);
@@ -1281,12 +1278,11 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
			vol->vol_type == UBI_STATIC_VOLUME);

		feba = (struct ubi_fm_eba *)(fm_raw + fm_pos);
		fm_pos += sizeof(*feba) +
			2 * (sizeof(__be32) * vol->reserved_pebs);
		fm_pos += sizeof(*feba) + (sizeof(__be32) * vol->reserved_pebs);
		ubi_assert(fm_pos <= ubi->fm_size);

		for (j = 0; j < vol->reserved_pebs; j++)
			feba->peb_data[j].pnum = cpu_to_be32(vol->eba_tbl[j]);
			feba->pnum[j] = cpu_to_be32(vol->eba_tbl[j]);

		feba->reserved_pebs = cpu_to_be32(j);
		feba->magic = cpu_to_be32(UBI_FM_EBA_MAGIC);
+3 −29
Original line number Diff line number Diff line
/*
 * Copyright (c) International Business Machines Corp., 2006
 * Copyright (c) 2014, Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2
 * license terms, and distributes only under these terms.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -41,15 +38,6 @@
/* The highest erase counter value supported by this implementation */
#define UBI_MAX_ERASECOUNTER 0x7FFFFFFF

/* The highest read counter value supported by this implementation */
#define UBI_MAX_READCOUNTER 0x7FFFFFFD /* (0x7FFFFFFF - 2)*/

/*
 * The highest data retention threshold value supported
 * by this implementation
 */
#define UBI_MAX_DT_THRESHOLD 0x7FFFFFFF

/* The initial CRC32 value used when calculating CRC checksums */
#define UBI_CRC32_INIT 0xFFFFFFFFU

@@ -142,7 +130,6 @@ enum {
 * @vid_hdr_offset: where the VID header starts
 * @data_offset: where the user data start
 * @image_seq: image sequence number
 * @last_erase_time: time stamp of the last erase operation
 * @padding2: reserved for future, zeroes
 * @hdr_crc: erase counter header CRC checksum
 *
@@ -175,8 +162,7 @@ struct ubi_ec_hdr {
	__be32  vid_hdr_offset;
	__be32  data_offset;
	__be32  image_seq;
	__be64  last_erase_time; /*curr time in sec == unsigned long time_t*/
	__u8    padding2[24];
	__u8    padding2[32];
	__be32  hdr_crc;
} __packed;

@@ -427,8 +413,6 @@ struct ubi_vtbl_record {
 * @used_blocks: number of PEBs used by this fastmap
 * @block_loc: an array containing the location of all PEBs of the fastmap
 * @block_ec: the erase counter of each used PEB
 * @block_rc: the read counter of each used PEB
 * @block_let: the last erase timestamp of each used PEB
 * @sqnum: highest sequence number value at the time while taking the fastmap
 *
 */
@@ -440,8 +424,6 @@ struct ubi_fm_sb {
	__be32 used_blocks;
	__be32 block_loc[UBI_FM_MAX_BLOCKS];
	__be32 block_ec[UBI_FM_MAX_BLOCKS];
	__be32 block_rc[UBI_FM_MAX_BLOCKS];
	__be64 block_let[UBI_FM_MAX_BLOCKS];
	__be64 sqnum;
	__u8 padding2[32];
} __packed;
@@ -487,17 +469,13 @@ struct ubi_fm_scan_pool {
/* ubi_fm_scan_pool is followed by nfree+nused struct ubi_fm_ec records */

/**
 * struct ubi_fm_ec - stores the erase/read counter of a PEB
 * struct ubi_fm_ec - stores the erase counter of a PEB
 * @pnum: PEB number
 * @ec: ec of this PEB
 * @rc: rc of this PEB
 * @last_erase_time: last erase time stamp of this PEB
 */
struct ubi_fm_ec {
	__be32 pnum;
	__be32 ec;
	__be32 rc;
	__be64 last_erase_time;
} __packed;

/**
@@ -528,14 +506,10 @@ struct ubi_fm_volhdr {
 * @magic: EBA table magic number
 * @reserved_pebs: number of table entries
 * @pnum: PEB number of LEB (LEB is the index)
 * @rc: Read counter of the LEBs PEB (LEB is the index)
 */
struct ubi_fm_eba {
	__be32 magic;
	__be32 reserved_pebs;
	struct {
		__be32 pnum;
		__be32 rc;
	} peb_data[0];
	__be32 pnum[0];
} __packed;
#endif /* !__UBI_MEDIA_H__ */
+0 −34
Original line number Diff line number Diff line
/*
 * Copyright (c) International Business Machines Corp., 2006
 * Copyright (c) Nokia Corporation, 2006, 2007
 * Copyright (c) 2014 - 2015, Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2
 * license terms, and distributes only under these terms.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -88,22 +85,6 @@
/* The volume ID/LEB number/erase counter is unknown */
#define UBI_UNKNOWN -1

/*
 * This parameter defines the maximum read counter of eraseblocks
 * of UBI devices. When this threshold is exceeded, UBI starts performing
 * wear leveling by means of moving data from eraseblock with low erase
 * counter to eraseblocks with high erase counter.
 */
#define UBI_RD_THRESHOLD 100000

/*
 * This parameter defines the maximun interval (in days) between two
 * erasures of an eraseblock. When this interval is reached, UBI starts
 * performing wear leveling by means of moving data from eraseblock with
 * low erase  counter to eraseblocks with high erase counter.
 */
#define UBI_DT_THRESHOLD 120

/*
 * The UBI debugfs directory name pattern and maximum name length (3 for "ubi"
 * + 2 for the number plus 1 for the trailing zero byte.
@@ -184,8 +165,6 @@ enum {
 * @u.rb: link in the corresponding (free/used) RB-tree
 * @u.list: link in the protection queue
 * @ec: erase counter
 * @last_erase_time: time stamp of the last erase opp
 * @rc: read counter
 * @pnum: physical eraseblock number
 *
 * This data structure is used in the WL sub-system. Each physical eraseblock
@@ -198,8 +177,6 @@ struct ubi_wl_entry {
		struct list_head list;
	} u;
	int ec;
	long last_erase_time;
	int rc;
	int pnum;
};

@@ -484,10 +461,6 @@ struct ubi_debug_info {
 * @bgt_thread: background thread description object
 * @thread_enabled: if the background thread is enabled
 * @bgt_name: background thread name
 * @rd_threshold: read counter threshold See UBI_RD_THRESHOLD
 *				for more info
 * @dt_threshold: data retention threshold. See UBI_DT_THRESHOLD
 *				for more info
 * @scrub_in_progress: true while scheduling all device PEBs for scrub/erase
 * is in progress
 *
@@ -592,11 +565,8 @@ struct ubi_device {
	struct task_struct *bgt_thread;
	int thread_enabled;
	char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2];
	int rd_threshold;
	int dt_threshold;
	bool scrub_in_progress;


	/* I/O sub-system's stuff */
	long long flash_size;
	int peb_count;
@@ -631,8 +601,6 @@ struct ubi_device {
/**
 * struct ubi_ainf_peb - attach information about a physical eraseblock.
 * @ec: erase counter (%UBI_UNKNOWN if it is unknown)
 * @rc: read counter (%UBI_UNKNOWN if it is unknown)
 * @last_erase_time: last erase time stamp (%UBI_UNKNOWN if it is unknown)
 * @pnum: physical eraseblock number
 * @vol_id: ID of the volume this LEB belongs to
 * @lnum: logical eraseblock number
@@ -649,8 +617,6 @@ struct ubi_device {
 */
struct ubi_ainf_peb {
	int ec;
	int rc;
	long last_erase_time;
	int pnum;
	int vol_id;
	int lnum;
+0 −3
Original line number Diff line number Diff line
@@ -2096,9 +2096,6 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
		INIT_LIST_HEAD(&ubi->pq[i]);
	ubi->pq_head = 0;

	ubi->rd_threshold = UBI_RD_THRESHOLD;
	ubi->dt_threshold = UBI_DT_THRESHOLD;

	list_for_each_entry_safe(aeb, tmp, &ai->erase, u.list) {
		cond_resched();