All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching
@ 2015-05-26 10:07 Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 1/6] UBI: Fastmap: Use max() to get the larger value Sheng Yong
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Hi, folks,

V2:
* change the commit message of PATCH 5. In normal cases, including unclean
  reboot and ECC scenario, there is no way to have two same vol_id saved in
  different slots in ubi->volumes[], so add_vol() in fastmap attach won't
  go wrong. Only if the on-flash fastmap is modified by hand, this issue
  may be triggered.
  Thanks Richard Weinberger for pointing this out.

* add two more cleanup.
  . add a helper function for updatting on-flash layout volumes. No
    semantic changes.

V1:
http://lists.infradead.org/pipermail/linux-mtd/2015-May/059355.html

Thanks,
Sheng

Sheng Yong (6):
  UBI: Fastmap: Use max() to get the larger value
  UBI: Fastmap: Remove unnecessary `\'
  UBI: Fastmap: Rename variables to make them meaningful
  UBI: Init vol->reserved_pebs by assignment
  UBI: Fastmap: Do not add vol if it already exists
  UBI: add a helper function for updatting on-flash layout volumes

 drivers/mtd/ubi/build.c   |  4 +--
 drivers/mtd/ubi/fastmap.c | 81 +++++++++++++++++++++++++----------------------
 drivers/mtd/ubi/vmt.c     |  4 +--
 drivers/mtd/ubi/vtbl.c    | 45 ++++++++++++++------------
 4 files changed, 72 insertions(+), 62 deletions(-)

-- 
1.8.3.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 1/6] UBI: Fastmap: Use max() to get the larger value
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 2/6] UBI: Fastmap: Remove unnecessary `\' Sheng Yong
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b7f824d..ddeccdf 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -947,8 +947,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
 	 */
 	ubi->fm_pool.max_size = min(((int)mtd_div_by_eb(ubi->mtd->size,
 		ubi->mtd) / 100) * 5, UBI_FM_MAX_POOL_SIZE);
-	if (ubi->fm_pool.max_size < UBI_FM_MIN_POOL_SIZE)
-		ubi->fm_pool.max_size = UBI_FM_MIN_POOL_SIZE;
+	ubi->fm_pool.max_size = max(ubi->fm_pool.max_size,
+		UBI_FM_MIN_POOL_SIZE);
 
 	ubi->fm_wl_pool.max_size = ubi->fm_pool.max_size / 2;
 	ubi->fm_disabled = !fm_autoconvert;
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 2/6] UBI: Fastmap: Remove unnecessary `\'
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 1/6] UBI: Fastmap: Use max() to get the larger value Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 3/6] UBI: Fastmap: Rename variables to make them meaningful Sheng Yong
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/fastmap.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 02a6de2..696a4f9 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -88,13 +88,13 @@ size_t ubi_calc_fm_size(struct ubi_device *ubi)
 {
 	size_t size;
 
-	size = sizeof(struct ubi_fm_sb) + \
-		sizeof(struct ubi_fm_hdr) + \
-		sizeof(struct ubi_fm_scan_pool) + \
-		sizeof(struct ubi_fm_scan_pool) + \
-		(ubi->peb_count * sizeof(struct ubi_fm_ec)) + \
-		(sizeof(struct ubi_fm_eba) + \
-		(ubi->peb_count * sizeof(__be32))) + \
+	size = sizeof(struct ubi_fm_sb) +
+		sizeof(struct ubi_fm_hdr) +
+		sizeof(struct ubi_fm_scan_pool) +
+		sizeof(struct ubi_fm_scan_pool) +
+		(ubi->peb_count * sizeof(struct ubi_fm_ec)) +
+		(sizeof(struct ubi_fm_eba) +
+		(ubi->peb_count * sizeof(__be32))) +
 		sizeof(struct ubi_fm_volhdr) * UBI_MAX_VOLUMES;
 	return roundup(size, ubi->leb_size);
 }
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 3/6] UBI: Fastmap: Rename variables to make them meaningful
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 1/6] UBI: Fastmap: Use max() to get the larger value Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 2/6] UBI: Fastmap: Remove unnecessary `\' Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 4/6] UBI: Init vol->reserved_pebs by assignment Sheng Yong
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

s/fmpl1/fmpl
s/fmpl2/fmpl_wl

Add "WL" to the error message when wrong WL pool magic number is detected.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/fastmap.c | 58 +++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 696a4f9..e3d8294 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -601,7 +601,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 	struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb;
 	struct ubi_fm_sb *fmsb;
 	struct ubi_fm_hdr *fmhdr;
-	struct ubi_fm_scan_pool *fmpl1, *fmpl2;
+	struct ubi_fm_scan_pool *fmpl, *fmpl_wl;
 	struct ubi_fm_ec *fmec;
 	struct ubi_fm_volhdr *fmvhdr;
 	struct ubi_fm_eba *fm_eba;
@@ -631,30 +631,30 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 		goto fail_bad;
 	}
 
-	fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
-	fm_pos += sizeof(*fmpl1);
+	fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
+	fm_pos += sizeof(*fmpl);
 	if (fm_pos >= fm_size)
 		goto fail_bad;
-	if (be32_to_cpu(fmpl1->magic) != UBI_FM_POOL_MAGIC) {
+	if (be32_to_cpu(fmpl->magic) != UBI_FM_POOL_MAGIC) {
 		ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
-			be32_to_cpu(fmpl1->magic), UBI_FM_POOL_MAGIC);
+			be32_to_cpu(fmpl->magic), UBI_FM_POOL_MAGIC);
 		goto fail_bad;
 	}
 
-	fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
-	fm_pos += sizeof(*fmpl2);
+	fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
+	fm_pos += sizeof(*fmpl_wl);
 	if (fm_pos >= fm_size)
 		goto fail_bad;
-	if (be32_to_cpu(fmpl2->magic) != UBI_FM_POOL_MAGIC) {
-		ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
-			be32_to_cpu(fmpl2->magic), UBI_FM_POOL_MAGIC);
+	if (be32_to_cpu(fmpl_wl->magic) != UBI_FM_POOL_MAGIC) {
+		ubi_err(ubi, "bad fastmap WL pool magic: 0x%x, expected: 0x%x",
+			be32_to_cpu(fmpl_wl->magic), UBI_FM_POOL_MAGIC);
 		goto fail_bad;
 	}
 
-	pool_size = be16_to_cpu(fmpl1->size);
-	wl_pool_size = be16_to_cpu(fmpl2->size);
-	fm->max_pool_size = be16_to_cpu(fmpl1->max_size);
-	fm->max_wl_pool_size = be16_to_cpu(fmpl2->max_size);
+	pool_size = be16_to_cpu(fmpl->size);
+	wl_pool_size = be16_to_cpu(fmpl_wl->size);
+	fm->max_pool_size = be16_to_cpu(fmpl->max_size);
+	fm->max_wl_pool_size = be16_to_cpu(fmpl_wl->max_size);
 
 	if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) {
 		ubi_err(ubi, "bad pool size: %i", pool_size);
@@ -796,11 +796,11 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 		}
 	}
 
-	ret = scan_pool(ubi, ai, fmpl1->pebs, pool_size, &max_sqnum, &free);
+	ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, &max_sqnum, &free);
 	if (ret)
 		goto fail;
 
-	ret = scan_pool(ubi, ai, fmpl2->pebs, wl_pool_size, &max_sqnum, &free);
+	ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, &max_sqnum, &free);
 	if (ret)
 		goto fail;
 
@@ -1083,7 +1083,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
 	void *fm_raw;
 	struct ubi_fm_sb *fmsb;
 	struct ubi_fm_hdr *fmh;
-	struct ubi_fm_scan_pool *fmpl1, *fmpl2;
+	struct ubi_fm_scan_pool *fmpl, *fmpl_wl;
 	struct ubi_fm_ec *fec;
 	struct ubi_fm_volhdr *fvh;
 	struct ubi_fm_eba *feba;
@@ -1141,25 +1141,25 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
 	erase_peb_count = 0;
 	vol_count = 0;
 
-	fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
-	fm_pos += sizeof(*fmpl1);
-	fmpl1->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
-	fmpl1->size = cpu_to_be16(ubi->fm_pool.size);
-	fmpl1->max_size = cpu_to_be16(ubi->fm_pool.max_size);
+	fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
+	fm_pos += sizeof(*fmpl);
+	fmpl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
+	fmpl->size = cpu_to_be16(ubi->fm_pool.size);
+	fmpl->max_size = cpu_to_be16(ubi->fm_pool.max_size);
 
 	for (i = 0; i < ubi->fm_pool.size; i++) {
-		fmpl1->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]);
+		fmpl->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]);
 		set_seen(ubi, ubi->fm_pool.pebs[i], seen_pebs);
 	}
 
-	fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
-	fm_pos += sizeof(*fmpl2);
-	fmpl2->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
-	fmpl2->size = cpu_to_be16(ubi->fm_wl_pool.size);
-	fmpl2->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size);
+	fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
+	fm_pos += sizeof(*fmpl_wl);
+	fmpl_wl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
+	fmpl_wl->size = cpu_to_be16(ubi->fm_wl_pool.size);
+	fmpl_wl->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size);
 
 	for (i = 0; i < ubi->fm_wl_pool.size; i++) {
-		fmpl2->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]);
+		fmpl_wl->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]);
 		set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs);
 	}
 
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 4/6] UBI: Init vol->reserved_pebs by assignment
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
                   ` (2 preceding siblings ...)
  2015-05-26 10:07 ` [RFC PATCH v2 3/6] UBI: Fastmap: Rename variables to make them meaningful Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 5/6] UBI: Fastmap: Do not add vol if it already exists Sheng Yong
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

`vol' is a newly allocated value by kzalloc. Initialize it by assignment
instead of `+='.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/vmt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index ff4d978..da2264b 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -253,8 +253,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 
 	/* Calculate how many eraseblocks are requested */
 	vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment;
-	vol->reserved_pebs += div_u64(req->bytes + vol->usable_leb_size - 1,
-				      vol->usable_leb_size);
+	vol->reserved_pebs = div_u64(req->bytes + vol->usable_leb_size - 1,
+				     vol->usable_leb_size);
 
 	/* Reserve physical eraseblocks */
 	if (vol->reserved_pebs > ubi->avail_pebs) {
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 5/6] UBI: Fastmap: Do not add vol if it already exists
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
                   ` (3 preceding siblings ...)
  2015-05-26 10:07 ` [RFC PATCH v2 4/6] UBI: Init vol->reserved_pebs by assignment Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-05-26 10:07 ` [RFC PATCH v2 6/6] UBI: add a helper function for updatting on-flash layout volumes Sheng Yong
  2015-06-02  0:38 ` [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

During fastmap attaching, check if a volume already exists when adding
the volume to volume tree. NOTE that the issue cannot happen, only if
the on-flash fastmap data is modified.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/fastmap.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index e3d8294..9eee904 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -192,8 +192,10 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id,
 
 		if (vol_id > av->vol_id)
 			p = &(*p)->rb_left;
-		else
+		else if (vol_id < av->vol_id)
 			p = &(*p)->rb_right;
+		else
+			return ERR_PTR(-EINVAL);
 	}
 
 	av = kmalloc(sizeof(struct ubi_ainf_volume), GFP_KERNEL);
@@ -748,6 +750,11 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 
 		if (!av)
 			goto fail_bad;
+		if (PTR_ERR(av) == -EINVAL) {
+			ubi_err(ubi, "volume (ID %i) already exists",
+				fmvhdr->vol_id);
+			goto fail_bad;
+		}
 
 		ai->vols_found++;
 		if (ai->highest_vol_id < be32_to_cpu(fmvhdr->vol_id))
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC PATCH v2 6/6] UBI: add a helper function for updatting on-flash layout volumes
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
                   ` (4 preceding siblings ...)
  2015-05-26 10:07 ` [RFC PATCH v2 5/6] UBI: Fastmap: Do not add vol if it already exists Sheng Yong
@ 2015-05-26 10:07 ` Sheng Yong
  2015-06-02  0:38 ` [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
  6 siblings, 0 replies; 11+ messages in thread
From: Sheng Yong @ 2015-05-26 10:07 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/vtbl.c | 45 ++++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 68c9c5ea..80bdd5b 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -70,6 +70,26 @@ static void self_vtbl_check(const struct ubi_device *ubi);
 static struct ubi_vtbl_record empty_vtbl_record;
 
 /**
+ * ubi_update_layout_vol - helper for updatting layout volumes on flash
+ * @ubi: UBI device description object
+ */
+static int ubi_update_layout_vol(struct ubi_device *ubi)
+{
+	struct ubi_volume *layout_vol;
+	int i, err;
+
+	layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)];
+	for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
+		err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl,
+						ubi->vtbl_size);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+/**
  * ubi_change_vtbl_record - change volume table record.
  * @ubi: UBI device description object
  * @idx: table index to change
@@ -83,12 +103,10 @@ static struct ubi_vtbl_record empty_vtbl_record;
 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
 			   struct ubi_vtbl_record *vtbl_rec)
 {
-	int i, err;
+	int err;
 	uint32_t crc;
-	struct ubi_volume *layout_vol;
 
 	ubi_assert(idx >= 0 && idx < ubi->vtbl_slots);
-	layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)];
 
 	if (!vtbl_rec)
 		vtbl_rec = &empty_vtbl_record;
@@ -98,15 +116,10 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
 	}
 
 	memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record));
-	for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
-		err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl,
-						ubi->vtbl_size);
-		if (err)
-			return err;
-	}
+	err = ubi_update_layout_vol(ubi);
 
 	self_vtbl_check(ubi);
-	return 0;
+	return err ? err : 0;
 }
 
 /**
@@ -121,9 +134,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
 int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
 			    struct list_head *rename_list)
 {
-	int i, err;
 	struct ubi_rename_entry *re;
-	struct ubi_volume *layout_vol;
 
 	list_for_each_entry(re, rename_list, list) {
 		uint32_t crc;
@@ -145,15 +156,7 @@ int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
 		vtbl_rec->crc = cpu_to_be32(crc);
 	}
 
-	layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)];
-	for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
-		err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl,
-						ubi->vtbl_size);
-		if (err)
-			return err;
-	}
-
-	return 0;
+	return ubi_update_layout_vol(ubi);
 }
 
 /**
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching
  2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
                   ` (5 preceding siblings ...)
  2015-05-26 10:07 ` [RFC PATCH v2 6/6] UBI: add a helper function for updatting on-flash layout volumes Sheng Yong
@ 2015-06-02  0:38 ` Sheng Yong
  2015-06-02 10:01   ` Richard Weinberger
  6 siblings, 1 reply; 11+ messages in thread
From: Sheng Yong @ 2015-06-02  0:38 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Ping.

On 5/26/2015 6:07 PM, Sheng Yong wrote:
> Hi, folks,
> 
> V2:
> * change the commit message of PATCH 5. In normal cases, including unclean
>   reboot and ECC scenario, there is no way to have two same vol_id saved in
>   different slots in ubi->volumes[], so add_vol() in fastmap attach won't
>   go wrong. Only if the on-flash fastmap is modified by hand, this issue
>   may be triggered.
>   Thanks Richard Weinberger for pointing this out.
> 
> * add two more cleanup.
>   . add a helper function for updatting on-flash layout volumes. No
>     semantic changes.
> 
> V1:
> http://lists.infradead.org/pipermail/linux-mtd/2015-May/059355.html
> 
> Thanks,
> Sheng
> 
> Sheng Yong (6):
>   UBI: Fastmap: Use max() to get the larger value
>   UBI: Fastmap: Remove unnecessary `\'
>   UBI: Fastmap: Rename variables to make them meaningful
>   UBI: Init vol->reserved_pebs by assignment
>   UBI: Fastmap: Do not add vol if it already exists
>   UBI: add a helper function for updatting on-flash layout volumes
> 
>  drivers/mtd/ubi/build.c   |  4 +--
>  drivers/mtd/ubi/fastmap.c | 81 +++++++++++++++++++++++++----------------------
>  drivers/mtd/ubi/vmt.c     |  4 +--
>  drivers/mtd/ubi/vtbl.c    | 45 ++++++++++++++------------
>  4 files changed, 72 insertions(+), 62 deletions(-)
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching
  2015-06-02  0:38 ` [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
@ 2015-06-02 10:01   ` Richard Weinberger
  2015-06-03  1:37     ` [PATCH] UBI: Remove unnecessary `\' Sheng Yong
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Weinberger @ 2015-06-02 10:01 UTC (permalink / raw)
  To: Sheng Yong; +Cc: linux-mtd

Am 02.06.2015 um 02:38 schrieb Sheng Yong:
> Ping.
> 
> On 5/26/2015 6:07 PM, Sheng Yong wrote:
>> Hi, folks,
>>
>> V2:
>> * change the commit message of PATCH 5. In normal cases, including unclean
>>   reboot and ECC scenario, there is no way to have two same vol_id saved in
>>   different slots in ubi->volumes[], so add_vol() in fastmap attach won't
>>   go wrong. Only if the on-flash fastmap is modified by hand, this issue
>>   may be triggered.
>>   Thanks Richard Weinberger for pointing this out.
>>
>> * add two more cleanup.
>>   . add a helper function for updatting on-flash layout volumes. No
>>     semantic changes.
>>
>> V1:
>> http://lists.infradead.org/pipermail/linux-mtd/2015-May/059355.html
>>
>> Thanks,
>> Sheng
>>
>> Sheng Yong (6):
>>   UBI: Fastmap: Use max() to get the larger value
>>   UBI: Fastmap: Remove unnecessary `\'
>>   UBI: Fastmap: Rename variables to make them meaningful
>>   UBI: Init vol->reserved_pebs by assignment
>>   UBI: Fastmap: Do not add vol if it already exists
>>   UBI: add a helper function for updatting on-flash layout volumes
>>
>>  drivers/mtd/ubi/build.c   |  4 +--
>>  drivers/mtd/ubi/fastmap.c | 81 +++++++++++++++++++++++++----------------------
>>  drivers/mtd/ubi/vmt.c     |  4 +--
>>  drivers/mtd/ubi/vtbl.c    | 45 ++++++++++++++------------
>>  4 files changed, 72 insertions(+), 62 deletions(-)

Thanks you Sheng, all 6 patches are applied now!
BTW: You could also remove `\' from other places in UBI.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] UBI: Remove unnecessary `\'
  2015-06-02 10:01   ` Richard Weinberger
@ 2015-06-03  1:37     ` Sheng Yong
  2015-06-03  7:42       ` Richard Weinberger
  0 siblings, 1 reply; 11+ messages in thread
From: Sheng Yong @ 2015-06-03  1:37 UTC (permalink / raw)
  To: richard; +Cc: linux-mtd

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 drivers/mtd/ubi/fastmap.c | 2 +-
 drivers/mtd/ubi/wl.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 9eee904..4aa2fd8 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -316,7 +316,7 @@ static int update_vol(struct ubi_device *ubi, struct ubi_attach_info *ai,
 			list_add_tail(&victim->u.list, &ai->erase);
 
 			if (av->highest_lnum == be32_to_cpu(new_vh->lnum))
-				av->last_data_size = \
+				av->last_data_size =
 					be32_to_cpu(new_vh->data_size);
 
 			dbg_bld("vol %i: AEB %i's PEB %i is the newer",
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 16214d3..275d9fb 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1581,7 +1581,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
 	dbg_wl("found %i PEBs", found_pebs);
 
 	if (ubi->fm) {
-		ubi_assert(ubi->good_peb_count == \
+		ubi_assert(ubi->good_peb_count ==
 			   found_pebs + ubi->fm->used_blocks);
 
 		for (i = 0; i < ubi->fm->used_blocks; i++) {
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] UBI: Remove unnecessary `\'
  2015-06-03  1:37     ` [PATCH] UBI: Remove unnecessary `\' Sheng Yong
@ 2015-06-03  7:42       ` Richard Weinberger
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Weinberger @ 2015-06-03  7:42 UTC (permalink / raw)
  To: Sheng Yong; +Cc: linux-mtd

Am 03.06.2015 um 03:37 schrieb Sheng Yong:
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>
> ---
>  drivers/mtd/ubi/fastmap.c | 2 +-
>  drivers/mtd/ubi/wl.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> index 9eee904..4aa2fd8 100644
> --- a/drivers/mtd/ubi/fastmap.c
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -316,7 +316,7 @@ static int update_vol(struct ubi_device *ubi, struct ubi_attach_info *ai,
>  			list_add_tail(&victim->u.list, &ai->erase);
>  
>  			if (av->highest_lnum == be32_to_cpu(new_vh->lnum))
> -				av->last_data_size = \
> +				av->last_data_size =
>  					be32_to_cpu(new_vh->data_size);
>  
>  			dbg_bld("vol %i: AEB %i's PEB %i is the newer",
> diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
> index 16214d3..275d9fb 100644
> --- a/drivers/mtd/ubi/wl.c
> +++ b/drivers/mtd/ubi/wl.c
> @@ -1581,7 +1581,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
>  	dbg_wl("found %i PEBs", found_pebs);
>  
>  	if (ubi->fm) {
> -		ubi_assert(ubi->good_peb_count == \
> +		ubi_assert(ubi->good_peb_count ==
>  			   found_pebs + ubi->fm->used_blocks);
>  
>  		for (i = 0; i < ubi->fm->used_blocks; i++) {

Applied.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-06-03  7:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 10:07 [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 1/6] UBI: Fastmap: Use max() to get the larger value Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 2/6] UBI: Fastmap: Remove unnecessary `\' Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 3/6] UBI: Fastmap: Rename variables to make them meaningful Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 4/6] UBI: Init vol->reserved_pebs by assignment Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 5/6] UBI: Fastmap: Do not add vol if it already exists Sheng Yong
2015-05-26 10:07 ` [RFC PATCH v2 6/6] UBI: add a helper function for updatting on-flash layout volumes Sheng Yong
2015-06-02  0:38 ` [RFC PATCH v2 0/6] UBI: Some cleanup and check if a vol exists when fastmap attaching Sheng Yong
2015-06-02 10:01   ` Richard Weinberger
2015-06-03  1:37     ` [PATCH] UBI: Remove unnecessary `\' Sheng Yong
2015-06-03  7:42       ` Richard Weinberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.