[source] kernel: don't switch allocate_partition to use mtd_roundup_to_eb

LEDE Commits lede-commits at lists.infradead.org
Fri Jun 23 02:55:56 PDT 2017


rmilecki pushed a commit to source.git, branch master:
https://git.lede-project.org/4052443a235433fb97af9711bf6429cd05820ba9

commit 4052443a235433fb97af9711bf6429cd05820ba9
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Fri Jun 23 08:59:46 2017 +0200

    kernel: don't switch allocate_partition to use mtd_roundup_to_eb
    
    This mtd_roundup_to_eb helper was introduced years ago in the commit
    daec7ad768841 ("kernel/3.10: add separate rootfs partition parser") and
    it was probably supposed to simplify code a bit.
    
    With the recent upstream commit 1eeef2d7483a7 ("mtd: handle partitioning
    on devices with 0 erasesize") the logic in allocate_partition got
    slightly more complex and we can't use this simple helper anymore as it
    doesn't support MTD_NO_ERASE properly.
    
    There also isn't any real gain from this helper, so it's probably easier
    to just don't use it *or* work on upstreaming it to avoid maintenance
    cost.
    
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../404-mtd-add-more-helper-functions.patch        | 22 ++--------------------
 .../411-mtd-partial_eraseblock_write.patch         |  2 +-
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/target/linux/generic/patches-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-4.9/404-mtd-add-more-helper-functions.patch
index c632912..6ecd6a1 100644
--- a/target/linux/generic/patches-4.9/404-mtd-add-more-helper-functions.patch
+++ b/target/linux/generic/patches-4.9/404-mtd-add-more-helper-functions.patch
@@ -1,24 +1,6 @@
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -493,14 +493,12 @@ static struct mtd_part *allocate_partiti
- 	if (slave->offset == MTDPART_OFS_APPEND)
- 		slave->offset = cur_offset;
- 	if (slave->offset == MTDPART_OFS_NXTBLK) {
--		slave->offset = cur_offset;
--		if (mtd_mod_by_eb(cur_offset, master) != 0) {
--			/* Round up to next erasesize */
--			slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize;
-+		/* Round up to next erasesize */
-+		slave->offset = mtd_roundup_to_eb(cur_offset, master);
-+		if (slave->offset != cur_offset)
- 			printk(KERN_NOTICE "Moving partition %d: "
- 			       "0x%012llx -> 0x%012llx\n", partno,
- 			       (unsigned long long)cur_offset, (unsigned long long)slave->offset);
--		}
- 	}
- 	if (slave->offset == MTDPART_OFS_RETAIN) {
- 		slave->offset = cur_offset;
-@@ -717,6 +715,17 @@ run_parsers_by_type(struct mtd_part *sla
+@@ -717,6 +717,17 @@ run_parsers_by_type(struct mtd_part *sla
  	return nr_parts;
  }
  
@@ -36,7 +18,7 @@
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -1055,6 +1064,24 @@ int mtd_is_partition(const struct mtd_in
+@@ -1055,6 +1066,24 @@ int mtd_is_partition(const struct mtd_in
  }
  EXPORT_SYMBOL_GPL(mtd_is_partition);
  
diff --git a/target/linux/generic/patches-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-4.9/411-mtd-partial_eraseblock_write.patch
index 6951973..ced1f61 100644
--- a/target/linux/generic/patches-4.9/411-mtd-partial_eraseblock_write.patch
+++ b/target/linux/generic/patches-4.9/411-mtd-partial_eraseblock_write.patch
@@ -97,7 +97,7 @@
  
  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  			instr->fail_addr -= part->offset;
-@@ -562,17 +631,20 @@ static struct mtd_part *allocate_partiti
+@@ -564,17 +633,20 @@ static struct mtd_part *allocate_partiti
  	if ((slave->mtd.flags & MTD_WRITEABLE) &&
  	    mtd_mod_by_eb(slave->offset, &slave->mtd)) {
  		/* Doesn't start on a boundary of major erase size */



More information about the lede-commits mailing list