ubi, ubifs: sync with linux 4.2
Subsystems (6)
cover ubi, ubifs: sync with linux 4.2
sync ubi,ubifs code in U-Boot with linux 4.2
commit 64291f7db5bd8150a74ad2036f1037e6a0428df2
Author: Linus Torvalds <[email protected]> Date: Sun Aug 30 11:34:09 2015 -0700
Linux 4.2
This update is needed, as it turned out, that fastmap was in experimental/broken state in kernel v3.15, which was the last base for U-Boot
Tested this patchset on the aristainetos2 board on the NAND and SPI NOR flash.
Ezequiel tested it also.
Heiko Schocher (3):
linux, compat: add missing definitions for ubi ubi,ubifs: sync with linux v4.2
UBI: Fastmap: Fix PEB array type
README | 4 + common/cmd_ubi.c | 6 +- drivers/mtd/ubi/attach.c | 199 +++++------ drivers/mtd/ubi/build.c | 279 ++++++++-------- drivers/mtd/ubi/debug.c | 115 ++++++- drivers/mtd/ubi/debug.h | 12 + drivers/mtd/ubi/eba.c | 173 +++++++--- drivers/mtd/ubi/fastmap-wl.c | 372 +++++++++++++++++++++ drivers/mtd/ubi/fastmap.c | 617 +++++++++++++++++++---------------- drivers/mtd/ubi/io.c | 156 ++++----- drivers/mtd/ubi/kapi.c | 119 +++++-- drivers/mtd/ubi/misc.c | 6 +- drivers/mtd/ubi/ubi-media.h | 2 - drivers/mtd/ubi/ubi.h | 128 ++++++-- drivers/mtd/ubi/upd.c | 10 +- drivers/mtd/ubi/vmt.c | 173 ++++------ drivers/mtd/ubi/vtbl.c | 105 +++--- drivers/mtd/ubi/wl.c | 707 ++++++++++++---------------------------- drivers/mtd/ubi/wl.h | 34 ++ drivers/usb/dwc3/linux-compat.h | 5 - fs/ubifs/budget.c | 3 +- fs/ubifs/debug.c | 200 ++++++------ fs/ubifs/io.c | 68 ++-- fs/ubifs/log.c | 35 +- fs/ubifs/lprops.c | 94 +++--- fs/ubifs/lpt.c | 64 ++-- fs/ubifs/lpt_commit.c | 45 +-- fs/ubifs/master.c | 13 +- fs/ubifs/orphan.c | 27 +- fs/ubifs/recovery.c | 49 ++- fs/ubifs/replay.c | 51 +-- fs/ubifs/sb.c | 34 +- fs/ubifs/scan.c | 38 +-- fs/ubifs/super.c | 148 +++++---- fs/ubifs/tnc.c | 26 +- fs/ubifs/tnc_misc.c | 24 +- fs/ubifs/ubifs.c | 44 +-- fs/ubifs/ubifs.h | 71 ++-- include/linux/compat.h | 37 ++- include/linux/mtd/mtd.h | 3 + include/linux/mtd/ubi.h | 55 +++- 41 files changed, 2506 insertions(+), 1845 deletions(-) create mode 100644 drivers/mtd/ubi/fastmap-wl.c create mode 100644 drivers/mtd/ubi/wl.h
Signature · 1 line
2.1.0
PATCH 1/3 linux, compat: add missing definitions for ubi
add missing definitions for the ubi/ubifs sync with linux 4.2, also change "#define kfree ..." into a static inline, so prevent ubi compile error:
CC drivers/mtd/ubi/fastmap.odrivers/mtd/ubi/fastmap.c: In function 'scan_pool':drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function
---
drivers/usb/dwc3/linux-compat.h | 5 ----- include/linux/compat.h | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-)
drivers/usb/dwc3/linux-compat.h +0 -5
@@ -30,9 +30,4 @@ static inline void *devm_kzalloc(struct device *dev, unsigned int size, {return kzalloc (size, flags); } - -static inline void *kmalloc_array (size_t n,size_t size,gfp_t flags) -{ -return kzalloc (n * size, flags); -}#endif
include/linux/compat.h +33 -4
@@ -4,6 +4,7 @@#include <malloc.h> #include <linux/types.h> #include <linux/err.h> +#include <linux/kernel.h> struct unused {};typedef struct unused unused_t ;
@@ -49,22 +50,47 @@ static inline void *kzalloc(size_t size, gfp_t flags) {return kmalloc (size, flags | __GFP_ZERO); } + +static inline void *kmalloc_array (size_t n,size_t size,gfp_t flags) +{ +if (size !=0 && n >SIZE_MAX / size) +return NULL ; +return kmalloc (n * size, flags | __GFP_ZERO); +} + +static inline void *kcalloc (size_t n,size_t size,gfp_t flags) +{ +return kmalloc_array (n, size, flags | __GFP_ZERO); +} +#define vmalloc (size) kmalloc(size, 0)#define __vmalloc (size, flags, pgsz) kmalloc(size, flags)static inline void *vzalloc (unsigned long size) {return kzalloc (size,0 ); } -#define kfree (ptr) free(ptr) -#define vfree (ptr) free(ptr) +static inline void kfree (const void *block) +{ +free ((void *)block); +} +static inline void vfree (const void *addr) +{ +free ((void *)addr); +}struct kmem_cache {int sz; };struct kmem_cache *get_mem (int element_sz);#define kmem_cache_create (a, sz, c, d, e) get_mem(sz)void *kmem_cache_alloc (struct kmem_cache *obj,int flag); -#define kmem_cache_free (obj, size) free(size) -#define kmem_cache_destroy (obj) free(obj) +static inline void kmem_cache_free (struct kmem_cache *cachep,void *obj) +{ +free (obj); +} +static inline void kmem_cache_destroy (struct kmem_cache *cachep) +{ +free (cachep); +}#define DECLARE_WAITQUEUE (...) do { } while (0)#define add_wait_queue (...) do { } while (0)
@@ -159,6 +185,8 @@ typedef unsigned long blkcnt_t;#define class_create (...) __builtin_return_address(0)#define class_create_file (...) 0 +#define class_register (...) 0 +#define class_unregister (...)#define class_remove_file (...)#define class_destroy (...)#define misc_register (...) 0
@@ -171,6 +199,7 @@ typedef unsigned long blkcnt_t;#define dev_set_name (...) do { } while (0)#define device_register (...) 0 +#define device_unregister (...)#define volume_sysfs_init (...) 0#define volume_sysfs_close (...) do { } while (0)
Signature · 1 line
2.1.0
PATCH 2/3 ubi,ubifs: sync with linux v4.2
In reply to Heiko Schochersync with linux v4.2
commit 64291f7db5bd8150a74ad2036f1037e6a0428df2
Author: Linus Torvalds <[email protected]> Date: Sun Aug 30 11:34:09 2015 -0700
Linux 4.2
This update is needed, as it turned out, that fastmap was in experimental/broken state in kernel v3.15, which was the last base for U-Boot.
---
This patch is full of checkpatch errors, but as it is linux code, I do not change it.
README | 4 + common/cmd_ubi.c | 6 +- drivers/mtd/ubi/attach.c | 199 ++++++------ drivers/mtd/ubi/build.c | 279 ++++++++--------- drivers/mtd/ubi/debug.c | 115 ++++++- drivers/mtd/ubi/debug.h | 12 + drivers/mtd/ubi/eba.c | 173 ++++++++--- drivers/mtd/ubi/fastmap-wl.c | 372 +++++++++++++++++++++++ drivers/mtd/ubi/fastmap.c | 617 ++++++++++++++++++++----------------- drivers/mtd/ubi/io.c | 156 +++++----- drivers/mtd/ubi/kapi.c | 119 ++++++-- drivers/mtd/ubi/misc.c | 6 +- drivers/mtd/ubi/ubi-media.h | 2 - drivers/mtd/ubi/ubi.h | 128 ++++++-- drivers/mtd/ubi/upd.c | 10 +- drivers/mtd/ubi/vmt.c | 173 ++++------- drivers/mtd/ubi/vtbl.c | 105 ++++--- drivers/mtd/ubi/wl.c | 707 +++++++++++++------------------------------ drivers/mtd/ubi/wl.h | 34 +++ fs/ubifs/budget.c | 3 +- fs/ubifs/debug.c | 200 ++++++------ fs/ubifs/io.c | 68 +++-- fs/ubifs/log.c | 35 ++- fs/ubifs/lprops.c | 94 +++--- fs/ubifs/lpt.c | 64 ++-- fs/ubifs/lpt_commit.c | 45 +-- fs/ubifs/master.c | 13 +- fs/ubifs/orphan.c | 27 +- fs/ubifs/recovery.c | 49 ++- fs/ubifs/replay.c | 51 ++-- fs/ubifs/sb.c | 34 ++- fs/ubifs/scan.c | 38 +-- fs/ubifs/super.c | 148 ++++----- fs/ubifs/tnc.c | 26 +- fs/ubifs/tnc_misc.c | 24 +- fs/ubifs/ubifs.c | 44 +-- fs/ubifs/ubifs.h | 71 +++-- include/linux/mtd/mtd.h | 3 + include/linux/mtd/ubi.h | 55 +++- 39 files changed, 2473 insertions(+), 1836 deletions(-) create mode 100644 drivers/mtd/ubi/fastmap-wl.c create mode 100644 drivers/mtd/ubi/wl.h
README +4 -0
@@ -3502,6 +3502,10 @@ FIT uImage format: without a fastmap. default: 0 + CONFIG_MTD_UBI_FM_DEBUG + Enable UBI fastmap debug + default: 0 + - UBIFS support CONFIG_CMD_UBIFS
common/cmd_ubi.c +3 -3
@@ -255,7 +255,7 @@ static int ubi_remove_vol(char *volume)return 0 ; out_err: -ubi_err ("cannot remove volume %s, error %d" , volume, err); +ubi_err (ubi,"cannot remove volume %s, error %d" , volume, err);if (err <0 ) err = -err;return err;
@@ -284,8 +284,8 @@ static int ubi_volume_continue_write(char *volume, void *buf, size_t size)return -err;if (err) { -ubi_warn ("volume %d on UBI device %d is corrupted" , - vol->vol_id, ubi->ubi_num); +ubi_warn (ubi,"volume %d on UBI device %d is corrupt" , + vol->vol_id, ubi->ubi_num); vol->corrupted =1 ; }
drivers/mtd/ubi/attach.c +105 -94
579 lines not on this page · raw message
drivers/mtd/ubi/build.c +140 -139
632 lines not on this page · raw message
drivers/mtd/ubi/debug.c +108 -7
195 lines not on this page · raw message
drivers/mtd/ubi/debug.h +12 -0
@@ -117,4 +117,16 @@ static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi) {return ubi->dbg.chk_gen; } + +static inline int ubi_dbg_chk_fastmap (const struct ubi_device *ubi) +{ +return ubi->dbg.chk_fastmap; +} + +static inline void ubi_enable_dbg_chk_fastmap (struct ubi_device *ubi) +{ + ubi->dbg.chk_fastmap =1 ; +} + +int ubi_dbg_power_cut (struct ubi_device *ubi,int caller);#endif /* !__UBI_DEBUG_H__ */
drivers/mtd/ubi/eba.c +123 -50
427 lines not on this page · raw message
drivers/mtd/ubi/fastmap-wl.c new file +372 -0
372 lines not on this page · raw message
drivers/mtd/ubi/fastmap.c +344 -273
751 lines not on this page · raw message
drivers/mtd/ubi/io.c +83 -73
156 lines not on this page · raw message
drivers/mtd/ubi/kapi.c +98 -21
119 lines not on this page · raw message
drivers/mtd/ubi/ubi.h +107 -21
128 lines not on this page · raw message
drivers/mtd/ubi/vmt.c +62 -111
173 lines not on this page · raw message
drivers/mtd/ubi/vtbl.c +52 -53
105 lines not on this page · raw message
drivers/mtd/ubi/wl.c +210 -497
707 lines not on this page · raw message
fs/ubifs/debug.c +103 -97
200 lines not on this page · raw message
fs/ubifs/io.c +39 -29
68 lines not on this page · raw message
fs/ubifs/lprops.c +47 -47
94 lines not on this page · raw message
fs/ubifs/lpt.c +32 -32
64 lines not on this page · raw message
fs/ubifs/lpt_commit.c +24 -21
45 lines not on this page · raw message
fs/ubifs/recovery.c +21 -28
49 lines not on this page · raw message
fs/ubifs/replay.c +32 -19
51 lines not on this page · raw message
fs/ubifs/super.c +78 -70
148 lines not on this page · raw message
fs/ubifs/ubifs.c +23 -21
44 lines not on this page · raw message
fs/ubifs/ubifs.h +46 -25
71 lines not on this page · raw message
include/linux/mtd/ubi.h +54 -1
55 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0
Part of the diff is not shown here. View the raw message.
PATCH 3/3 UBI: Fastmap: Fix PEB array type
In reply to Heiko SchocherThe PEB array is an array of __be32, so let's fix the scan_pool() prototype accordingly.
---
only repost this patch, as it belongs into this serie
drivers/mtd/ubi/fastmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/ubi/fastmap.c +2 -2
@@ -453,11 +453,11 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)*/ #ifndef __UBOOT__static int scan_pool (struct ubi_device *ubi,struct ubi_attach_info *ai, -int *pebs,int pool_size,unsigned long long *max_sqnum, +__be32 *pebs,int pool_size,unsigned long long *max_sqnum, struct list_head *free)#else static int scan_pool (struct ubi_device *ubi,struct ubi_attach_info *ai, -int *pebs,int pool_size,unsigned long long *max_sqnum, +__be32 *pebs,int pool_size,unsigned long long *max_sqnum, struct list_head *free)#endif {
Signature · 1 line
2.1.0