mtd,ubi,ubifs: sync with v3.15
Subsystems (4)
cover mtd,ubi,ubifs: sync with v3.15
as Tom Rini suggested, I tried to update the mtd,ubi and ubifs subsystem with linux v3.15:
commit 1860e379875dfe7271c649058aeddffe5afd9d0d
Author: Linus Torvalds <[email protected]> Date: Sun Jun 8 11:19:54 2014 -0700
Linux 3.15
First patch in this patchserie is a patch, which contains some small changes based on the linux v3.14 patchserie [1]
Second patch is the real sync with linux v3.15 patch, based on [1], created in the following way:
1) checkout linux v3.14 in the linux tree
2) copy all files [2] from the linux tree to the u-boot tree
3) "git diff" shows a patch, which contains all u-boot specific changes -> save it for later use
4) checkout linux v3.15 in the linux tree
5) copy all files [2] from the linux tree to the u-boot tree
6) "git diff" shows all linux specific changes between v3.14 and v3.15
7) apply u-boot specific changes patch from step 3
8) fix warnings, errors
9) compile (MAKEALL compiles clean for arm, powerpc and mips)
10) test, test, test (done on the imx6 based aristainetos board)
11) commit it, make patch and send to ML
[1] linux v3.14 sync
[U-Boot] [PATCH v5 0/5] mtd, ubi, ubifs: resync with Linux-3.14
http://lists.denx.de/pipermail/u-boot/2014-June/182501.html
Patchwork [U-Boot,v5,1/5] lib, rbtree: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363332/
Patchwork [U-Boot,v5,2/5] lib, list_sort: add list_sort from linux 3.14
http://patchwork.ozlabs.org/patch/363335/
Patchwork [U-Boot,v5,3/5] linux include: add ERR_CAST
http://patchwork.ozlabs.org/patch/363334/
Patchwork [U-Boot,v5,4/5] lib, linux: move linux specific defines to linux/compat.h
http://patchwork.ozlabs.org/patch/363333/
Patchwork [U-Boot,v5,5/5] mtd, ubi, ubifs: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363343/
[2] linux files useddrivers/mtd/mtdconcat.cdrivers/mtd/mtdcore.cdrivers/mtd/mtdpart.cdrivers/mtd/mtdcore.hdrivers/mtd/nand/nand_base.cdrivers/mtd/nand/nand_bbt.cdrivers/mtd/nand/nand_ids.cdrivers/mtd/ubi/attach.cdrivers/mtd/ubi/build.cdrivers/mtd/ubi/debug.cdrivers/mtd/ubi/debug.hdrivers/mtd/ubi/eba.cdrivers/mtd/ubi/fastmap.cdrivers/mtd/ubi/io.cdrivers/mtd/ubi/kapi.cdrivers/mtd/ubi/misc.cdrivers/mtd/ubi/ubi-media.hdrivers/mtd/ubi/ubi.hdrivers/mtd/ubi/upd.cdrivers/mtd/ubi/vmt.cdrivers/mtd/ubi/vtbl.cdrivers/mtd/ubi/wl.cfs/ubifs/budget.cfs/ubifs/debug.cfs/ubifs/debug.hfs/ubifs/io.cfs/ubifs/key.hfs/ubifs/log.cfs/ubifs/lprops.cfs/ubifs/lpt.cfs/ubifs/lpt_commit.cfs/ubifs/master.cfs/ubifs/misc.hfs/ubifs/orphan.cfs/ubifs/recovery.cfs/ubifs/replay.cfs/ubifs/sb.cfs/ubifs/scan.cfs/ubifs/super.cfs/ubifs/tnc.cfs/ubifs/tnc_misc.cfs/ubifs/ubifs-media.hfs/ubifs/ubifs.hinclude/linux/mtd/bbm.hinclude/linux/mtd/flashchip.hinclude/linux/mtd/mtd.hinclude/linux/mtd/nand.hinclude/linux/mtd/partitions.hinclude/linux/mtd/ubi.hinclude/uapi/mtd/mtd-abi.hinclude/uapi/mtd/ubi-user.h
Heiko Schocher (2):
mtd,ubi,ubifs: update for the sync with linux v3.14 mtd,ubi,ubifs: sync with linux v3.15
drivers/mtd/mtdcore.c | 26 +++++-- drivers/mtd/mtdpart.c | 16 ++-- drivers/mtd/nand/nand_base.c | 174 +++++++++++++++++++++++++++++++++++-------- drivers/mtd/nand/nand_ids.c | 3 + drivers/mtd/ubi/build.c | 11 +++ drivers/mtd/ubi/ubi.h | 21 +++++- drivers/mtd/ubi/wl.c | 6 ++ fs/ubifs/super.c | 11 ++- include/linux/mtd/mtd.h | 17 +++-- include/linux/mtd/nand.h | 113 +++++++++++++++++++++++++--- include/mtd/ubi-user.h | 22 ++++++ 11 files changed, 352 insertions(+), 68 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 mtd, ubi, ubifs: update for the sync with linux v3.14
while playing with the new mtd/ubi/ubifs sync, found some small updates for it:
- add del_mtd_partition() to include/linux/mtd/mtd
- mtd: add a debug_printf
- remove some not used functions
---
This patch is based on the mtd/ubi/ubifs sync with linux v3.14 patches, see:
[U-Boot] [PATCH v5 0/5] mtd, ubi, ubifs: resync with Linux-3.14
http://lists.denx.de/pipermail/u-boot/2014-June/182501.html
Patchwork [U-Boot,v5,1/5] lib, rbtree: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363332/
Patchwork [U-Boot,v5,2/5] lib, list_sort: add list_sort from linux 3.14
http://patchwork.ozlabs.org/patch/363335/
Patchwork [U-Boot,v5,3/5] linux include: add ERR_CAST
http://patchwork.ozlabs.org/patch/363334/
Patchwork [U-Boot,v5,4/5] lib, linux: move linux specific defines to linux/compat.h
http://patchwork.ozlabs.org/patch/363333/
Patchwork [U-Boot,v5,5/5] mtd, ubi, ubifs: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363343/
--- drivers/mtd/mtdcore.c | 2 ++ drivers/mtd/mtdpart.c | 2 ++ fs/ubifs/super.c | 6 ++++++ include/linux/mtd/mtd.h | 1 + 4 files changed, 11 insertions(+)
drivers/mtd/mtdcore.c +2 -0
@@ -476,6 +476,8 @@ int add_mtd_device(struct mtd_info *mtd)the notifier, since we hold the mtd_table_mutex */ list_for_each_entry (not, &mtd_notifiers, list) not->add (mtd); +#else +pr_debug ("mtd: Giving out device %d to %s\n" , i, mtd->name);#endif mutex_unlock (&mtd_table_mutex);
drivers/mtd/mtdpart.c +2 -0
@@ -572,6 +572,7 @@ out_register:return slave; } +#ifndef __UBOOT__int mtd_add_partition (struct mtd_info *master,const char *name,long long offset,long long length) {
@@ -651,6 +652,7 @@ int mtd_del_partition(struct mtd_info *master, int partno) return ret; }EXPORT_SYMBOL_GPL (mtd_del_partition); +#endif /* * This function, given a master MTD object and a partition table, creates
fs/ubifs/super.c +6 -0
@@ -2241,8 +2241,14 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)int err; c->vfs_sb = sb; +#ifndef __UBOOT__/* Re-open the UBI device in read-write mode */ c->ubi =ubi_open_volume (c->vi.ubi_num, c->vi.vol_id,UBI_READWRITE ); +#else +/* U-Boot read only mode */ + c->ubi =ubi_open_volume (c->vi.ubi_num, c->vi.vol_id,UBI_READONLY ); +#endif +if (IS_ERR (c->ubi)) { err =PTR_ERR (c->ubi); goto out;
include/linux/mtd/mtd.h +1 -0
@@ -480,6 +480,7 @@ static inline int mtd_is_bitflip_or_eccerr(int err) {#ifdef __UBOOT__/* drivers/mtd/mtdcore.h */ int add_mtd_device (struct mtd_info *mtd); +int del_mtd_device (struct mtd_info *mtd);int add_mtd_partitions (struct mtd_info *,const struct mtd_partition *,int );int del_mtd_partitions (struct mtd_info *);
Signature · 1 line
1.8.3.1
PATCH 1/2 mtd, ubi, ubifs: update for the sync with linux v3.14
Quoted 10 lines · Heiko Schocher
while playing with the new mtd/ubi/ubifs sync, found some small updates for it:
- add
del_mtd_partition()toinclude/linux/mtd/mtd
- mtd: add adebug_printf
- remove some not used functionsSigned-off-by Heiko Schocher <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140828/79b8175a/attachment.pgp>
PATCH 2/2 mtd,ubi,ubifs: sync with linux v3.15
In reply to Heiko Schochersnyc with linux v3.15:
commit 1860e379875dfe7271c649058aeddffe5afd9d0d
Author: Linus Torvalds <[email protected]> Date: Sun Jun 8 11:19:54 2014 -0700
Linux 3.15
---
- how to create this patch
- copy all linux mtd files from the last linux commit
which with U-Boot mtd,ubi,ubifs code was synced
-> git diff will show you all U-Boot specific
changes
-> save this patch- now go in the linux tree and checkout the new commit you want to sync U-Boot with
- copy now all linux mtd files to the U-Boot tree
-> you see now all linux specific changes.
- commit this for documentation only
- apply the u-boot specific changes patch now
- fix errors
- test
- commit and send to ML
--- drivers/mtd/mtdcore.c | 24 ++++-- drivers/mtd/mtdpart.c | 14 ++-- drivers/mtd/nand/nand_base.c | 174 +++++++++++++++++++++++++++++++++++-------- drivers/mtd/nand/nand_ids.c | 3 + drivers/mtd/ubi/build.c | 11 +++ drivers/mtd/ubi/ubi.h | 21 +++++- drivers/mtd/ubi/wl.c | 6 ++ fs/ubifs/super.c | 5 +- include/linux/mtd/mtd.h | 16 ++-- include/linux/mtd/nand.h | 113 +++++++++++++++++++++++++--- include/mtd/ubi-user.h | 22 ++++++ 11 files changed, 341 insertions(+), 68 deletions(-)
drivers/mtd/mtdcore.c +17 -7
@@ -1011,14 +1011,14 @@ EXPORT_SYMBOL_GPL(mtd_read_oob);* devices. The user data is one time programmable but the factory data is read * only. */ -int mtd_get_fact_prot_info (struct mtd_info *mtd,struct otp_info *buf, -size_t len) +int mtd_get_fact_prot_info (struct mtd_info *mtd,size_t len,size_t *retlen, +struct otp_info *buf) {if (!mtd->_get_fact_prot_info)return -EOPNOTSUPP ;if (!len)return 0 ; -return mtd->_get_fact_prot_info (mtd, buf, len); +return mtd->_get_fact_prot_info (mtd, len, retlen, buf); }EXPORT_SYMBOL_GPL (mtd_get_fact_prot_info);
@@ -1034,14 +1034,14 @@ int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, }EXPORT_SYMBOL_GPL (mtd_read_fact_prot_reg); -int mtd_get_user_prot_info (struct mtd_info *mtd,struct otp_info *buf, -size_t len) +int mtd_get_user_prot_info (struct mtd_info *mtd,size_t len,size_t *retlen, +struct otp_info *buf) {if (!mtd->_get_user_prot_info)return -EOPNOTSUPP ;if (!len)return 0 ; -return mtd->_get_user_prot_info (mtd, buf, len); +return mtd->_get_user_prot_info (mtd, len, retlen, buf); }EXPORT_SYMBOL_GPL (mtd_get_user_prot_info);
@@ -1060,12 +1060,22 @@ EXPORT_SYMBOL_GPL(mtd_read_user_prot_reg);int mtd_write_user_prot_reg (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen,u_char *buf) { +int ret; + *retlen =0 ;if (!mtd->_write_user_prot_reg)return -EOPNOTSUPP ;if (!len)return 0 ; -return mtd->_write_user_prot_reg (mtd, to, len, retlen, buf); + ret = mtd->_write_user_prot_reg (mtd, to, len, retlen, buf); +if (ret) +return ret; + +/* +* If no data could be written at all, we are out of memory and +* must return -ENOSPC. +*/ +return (*retlen) ?0 : -ENOSPC ; }EXPORT_SYMBOL_GPL (mtd_write_user_prot_reg);
drivers/mtd/mtdpart.c +8 -6
@@ -178,11 +178,12 @@ static int part_read_user_prot_reg(struct mtd_info *mtd, loff_t from, retlen, buf); } -static int part_get_user_prot_info (struct mtd_info *mtd, -struct otp_info *buf,size_t len) +static int part_get_user_prot_info (struct mtd_info *mtd,size_t len, +size_t *retlen,struct otp_info *buf) {struct mtd_part *part =PART (mtd); -return part->master->_get_user_prot_info (part->master, buf, len); +return part->master->_get_user_prot_info (part->master, len, retlen, + buf); } static int part_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
@@ -193,11 +194,12 @@ static int part_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, retlen, buf); } -static int part_get_fact_prot_info (struct mtd_info *mtd,struct otp_info *buf, -size_t len) +static int part_get_fact_prot_info (struct mtd_info *mtd,size_t len, +size_t *retlen,struct otp_info *buf) {struct mtd_part *part =PART (mtd); -return part->master->_get_fact_prot_info (part->master, buf, len); +return part->master->_get_fact_prot_info (part->master, len, retlen, + buf); } static int part_write(struct mtd_info *mtd, loff_t to, size_t len,
drivers/mtd/nand/nand_base.c +141 -33
301 lines not on this page · raw message
drivers/mtd/nand/nand_ids.c +3 -0
@@ -59,6 +59,9 @@ struct nand_flash_dev nand_flash_ids[] = { {"TC58NVG6D2 64G 3.3V 8-bit" , { .id = {0x98, 0xde, 0x94, 0x82, 0x76, 0x56, 0x04, 0x20} }, SZ_8K, SZ_8K, SZ_2M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, + {"SDTNRGAMA 64G 3.3V 8-bit", + { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x50} }, + SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) },LEGACY_ID_NAND ("NAND 4MiB 5V 8-bit" ,0x6B ,4 ,SZ_8K ,SP_OPTIONS ), LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),
drivers/mtd/ubi/build.c +11 -0
@@ -1331,6 +1331,15 @@ int ubi_init(void) } } + err =ubiblock_init (); +if (err) { +ubi_err ("block: cannot initialize, error %d" , err); + +/* See comment above re-ubi_is_module(). */ +if (ubi_is_module ()) + goto out_detach; + } +return 0 ; out_detach:
@@ -1363,6 +1372,8 @@ void ubi_exit(void) {int i; +ubiblock_exit (); +for (i =0 ; i <UBI_MAX_DEVICES ; i++)if (ubi_devices[i]) {mutex_lock (&ubi_devices_mutex);
drivers/mtd/ubi/ubi.h +20 -1
@@ -12,7 +12,6 @@#define __UBOOT__#ifndef __UBOOT__ -#include <linux/init.h> #include <linux/types.h> #include <linux/list.h> #include <linux/rbtree.h>
@@ -884,6 +883,26 @@ int ubi_update_fastmap(struct ubi_device *ubi);int ubi_scan_fastmap (struct ubi_device *ubi,struct ubi_attach_info *ai,int fm_anchor); +/* block.c */ +#ifdef CONFIG_MTD_UBI_BLOCK +int ubiblock_init (void ); +void ubiblock_exit (void ); +int ubiblock_create (struct ubi_volume_info *vi); +int ubiblock_remove (struct ubi_volume_info *vi); +#else +static inline int ubiblock_init (void ) {return 0 ; } +static inline void ubiblock_exit (void ) {} +static inline int ubiblock_create (struct ubi_volume_info *vi) +{ +return -ENOSYS ; +} +static inline int ubiblock_remove (struct ubi_volume_info *vi) +{ +return -ENOSYS ; +} +#endif + +/* * ubi_rb_for_each_entry - walk an RB-tree. * @rb: a pointer to type 'struct rb_node' to use as a loop counter
drivers/mtd/ubi/wl.c +6 -0
@@ -672,6 +672,8 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) e =find_wl_entry (ubi, &ubi->free,WL_FREE_MAX_DIFF );self_check_in_wl_tree (ubi, e, &ubi->free); + ubi->free_count--; +ubi_assert (ubi->free_count >=0 );rb_erase (&e->u.rb, &ubi->free);return e;
@@ -685,6 +687,9 @@ int ubi_wl_get_peb(struct ubi_device *ubi) peb =__wl_get_peb (ubi);spin_unlock (&ubi->wl_lock); +if (peb <0 ) +return peb; + err =ubi_self_check_all_ff (ubi, peb, ubi->vid_hdr_aloffset, ubi->peb_size - ubi->vid_hdr_aloffset);if (err) {
@@ -1077,6 +1082,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,/* Give the unused PEB back */ wl_tree_add (e2, &ubi->free); + ubi->free_count++; goto out_cancel; }self_check_in_wl_tree (ubi, e1, &ubi->used);
fs/ubifs/super.c +3 -2
@@ -531,7 +531,7 @@ static void ubifs_evict_inode(struct inode *inode)dbg_gen ("inode %lu, mode %#x" , inode->i_ino, (int )inode->i_mode);ubifs_assert (!atomic_read (&inode->i_count)); -truncate_inode_pages (&inode->i_data,0 ); +truncate_inode_pages_final (&inode->i_data);if (inode->i_nlink) goto done;
@@ -1786,7 +1786,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)if (c->space_fixup) { err =ubifs_fixup_free_space (c);if (err) -return err; + goto out; } err =check_free_space (c);
@@ -2063,6 +2063,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)int err;struct ubifs_info *c = sb->s_fs_info; +sync_filesystem (sb);dbg_gen ("old flags %#lx, new flags %#x" , sb->s_flags, *flags); err =ubifs_parse_options (c, data,1 );
include/linux/mtd/mtd.h +8 -8
@@ -219,12 +219,12 @@ struct mtd_info { struct mtd_oob_ops *ops);int (*_write_oob) (struct mtd_info *mtd,loff_t to,struct mtd_oob_ops *ops); -int (*_get_fact_prot_info) (struct mtd_info *mtd,struct otp_info *buf, -size_t len); +int (*_get_fact_prot_info) (struct mtd_info *mtd,size_t len, +size_t *retlen,struct otp_info *buf);int (*_read_fact_prot_reg) (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf); -int (*_get_user_prot_info) (struct mtd_info *mtd,struct otp_info *buf, -size_t len); +int (*_get_user_prot_info) (struct mtd_info *mtd,size_t len, +size_t *retlen,struct otp_info *buf);int (*_read_user_prot_reg) (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf); int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
@@ -303,12 +303,12 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,return mtd->_write_oob (mtd, to, ops); } -int mtd_get_fact_prot_info (struct mtd_info *mtd,struct otp_info *buf, -size_t len); +int mtd_get_fact_prot_info (struct mtd_info *mtd,size_t len,size_t *retlen, +struct otp_info *buf);int mtd_read_fact_prot_reg (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf); -int mtd_get_user_prot_info (struct mtd_info *mtd,struct otp_info *buf, -size_t len); +int mtd_get_user_prot_info (struct mtd_info *mtd,size_t len,size_t *retlen, +struct otp_info *buf);int mtd_read_user_prot_reg (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf); int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
include/linux/mtd/nand.h +102 -11
171 lines not on this page · raw message
include/mtd/ubi-user.h +22 -0
@@ -122,6 +122,16 @@* used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be * passed. The object describes which property should be set, and to which value * it should be set. +* +* Block devices on UBI volumes +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* +* To create a R/O block device on top of an UBI volume the %UBI_IOCVOLCRBLK +* should be used. A pointer to a &struct ubi_blkcreate_req object is expected +* to be passed, which is not used and reserved for future usage. +* +* Conversely, to remove a block device the %UBI_IOCVOLRMBLK should be used, +* which takes no arguments. */ /*
@@ -179,6 +189,10 @@/* Set an UBI volume property */ #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ struct ubi_set_vol_prop_req) +/* Create a R/O block device on top of an UBI volume */ +#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req) +/* Remove the R/O block device */ +#define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)/* Maximum MTD device name length supported by UBI */ #define MAX_UBI_MTD_NAME_LEN 127
@@ -408,4 +422,12 @@ struct ubi_set_vol_prop_req { __u64 value; } __packed; +/** +* struct ubi_blkcreate_req - a data structure used in block creation requests. +* @padding: reserved for future, not used, has to be zeroed +*/ +struct ubi_blkcreate_req { +__s8 padding[128 ]; +} __packed; +#endif /* __UBI_USER_H__ */
Signature · 1 line
1.8.3.1
PATCH 2/2 mtd,ubi,ubifs: sync with linux v3.15
Quoted 11 lines · Heiko Schocher
snyc with linux v3.15:
commit
1860e379875dfe7271c649058aeddffe5afd9d0dAuthor: Linus Torvalds <[email protected]> Date: Sun Jun 8 11:19:54 2014 -0700Linux 3.15Signed-off-by Heiko Schocher <[email protected]>Cc Scott Wood <[email protected]>Cc Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140828/8cdc7a6a/attachment.pgp>