!11 更新yaffs2到新版本

From: @fanglinxu 
Reviewed-by: @vonhust 
Signed-off-by: @vonhust
This commit is contained in:
openeuler-ci-bot 2023-06-25 01:52:29 +00:00 committed by Gitee
commit 17626d2107
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 37 additions and 33 deletions

View File

@ -1,23 +1,24 @@
From 9a1e3b523b552f52c90a2b451d311cefc378d29d Mon Sep 17 00:00:00 2001 From 30f82ef48ed60def1ce9169d8b365b85384d2d83 Mon Sep 17 00:00:00 2001
From: luojects <luoyonglun@huawei.com> From: fanglinxu <fanglinxu@huawei.com>
Date: Thu, 15 Dec 2022 20:32:08 +0800 Date: Wed, 21 Jun 2023 16:42:01 +0800
Subject: [PATCH] add powersafe Subject: [PATCH] add powersafe
Signed-off-by: fanglinxu <fanglinxu@huawei.com>
--- ---
yaffs_guts.c | 39 ++++++++++ yaffs_guts.c | 40 +++++++++++
yaffs_guts.h | 46 ++++++++++++ yaffs_guts.h | 46 ++++++++++++
yaffs_powersafe.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++ yaffs_powersafe.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++
yaffs_trace.h | 1 + yaffs_trace.h | 1 +
yaffs_vfs_multi.c | 65 ++++++++++++++++- yaffs_vfs_multi.c | 65 ++++++++++++++++-
yaffs_yaffs2.c | 12 ++++ yaffs_yaffs2.c | 12 ++++
6 files changed, 342 insertions(+), 1 deletion(-) 6 files changed, 343 insertions(+), 1 deletion(-)
create mode 100644 yaffs_powersafe.c create mode 100644 yaffs_powersafe.c
diff --git a/yaffs_guts.c b/yaffs_guts.c diff --git a/yaffs_guts.c b/yaffs_guts.c
index 40a5b46..46b6c16 100644 index b83fa63..be298b2 100644
--- a/yaffs_guts.c --- a/yaffs_guts.c
+++ b/yaffs_guts.c +++ b/yaffs_guts.c
@@ -4799,6 +4799,33 @@ int yaffs_guts_format_dev(struct yaffs_dev *dev) @@ -4579,6 +4579,34 @@ int yaffs_guts_format_dev(struct yaffs_dev *dev)
return YAFFS_OK; return YAFFS_OK;
} }
@ -46,43 +47,44 @@ index 40a5b46..46b6c16 100644
+{ +{
+ dev->powersafe_block = yaffs_find_alloc_block(dev); + dev->powersafe_block = yaffs_find_alloc_block(dev);
+} +}
+ +
+#endif +#endif
+
int yaffs_guts_initialise(struct yaffs_dev *dev) /*
{ * If the dev is mounted r/w then the cleanup will happen during
@@ -4970,6 +4997,10 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) * yaffs_guts_initialise. However if the dev is mounted ro then
@@ -4732,6 +4760,10 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
!yaffs_summary_init(dev)) !yaffs_summary_init(dev))
init_failed = 1; init_failed = 1;
+#ifdef CONFIG_POWERSAFE +#ifdef CONFIG_POWERSAFE
+ init_power_safe(dev); + init_power_safe(dev);
+#endif +#endif
+ +
if (!init_failed) { if (!init_failed) {
/* Now scan the flash. */ /* Now scan the flash. */
if (dev->param.is_yaffs2) { if (dev->param.is_yaffs2) {
@@ -5043,6 +5074,13 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) @@ -4802,6 +4834,13 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
if (!dev->is_checkpointed && dev->blocks_in_checkpt > 0) if (!dev->is_checkpointed && dev->blocks_in_checkpt > 0)
yaffs2_checkpt_invalidate(dev); yaffs2_checkpt_invalidate(dev);
+#ifdef CONFIG_POWERSAFE +#ifdef CONFIG_POWERSAFE
+ yaffs_sort_powersafe_block(dev); + yaffs_sort_powersafe_block(dev);
+ yaffs_powersafe_read_buffer(dev); + yaffs_powersafe_read_buffer(dev);
+ yaffs_powersafe_invalied(dev); + yaffs_powersafe_invalied(dev);
+ +
+ yaffs_trace(YAFFS_TRACE_POWER, "yaffs: dev->blocks_in_powersafe %d", dev->blocks_in_powersafe); + yaffs_trace(YAFFS_TRACE_POWER, "yaffs: dev->blocks_in_powersafe %d", dev->blocks_in_powersafe);
+#endif +#endif
yaffs_trace(YAFFS_TRACE_TRACING, yaffs_trace(YAFFS_TRACE_TRACING,
"yaffs: yaffs_guts_initialise() done."); "yaffs: yaffs_guts_initialise() done.");
return YAFFS_OK; return YAFFS_OK;
@@ -5210,3 +5248,4 @@ void yaffs_count_blocks_by_state(struct yaffs_dev *dev, int bs[10]) @@ -5033,3 +5072,4 @@ void yaffs_count_blocks_by_state(struct yaffs_dev *dev, int bs[10])
bs[s]++; bs[s]++;
} }
} }
+ +
diff --git a/yaffs_guts.h b/yaffs_guts.h diff --git a/yaffs_guts.h b/yaffs_guts.h
index 5ebc378..f5d47af 100644 index 74ded0b..8b55133 100644
--- a/yaffs_guts.h --- a/yaffs_guts.h
+++ b/yaffs_guts.h +++ b/yaffs_guts.h
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
@ -106,7 +108,7 @@ index 5ebc378..f5d47af 100644
#define YAFFS_MAX_SHORT_OP_CACHES 20 #define YAFFS_MAX_SHORT_OP_CACHES 20
#define YAFFS_N_TEMP_BUFFERS 6 #define YAFFS_N_TEMP_BUFFERS 6
@@ -281,6 +288,10 @@ enum yaffs_block_state { @@ -288,6 +295,10 @@ enum yaffs_block_state {
YAFFS_BLOCK_STATE_CHECKPOINT, YAFFS_BLOCK_STATE_CHECKPOINT,
/* This block is assigned to holding checkpoint data. */ /* This block is assigned to holding checkpoint data. */
@ -117,7 +119,7 @@ index 5ebc378..f5d47af 100644
YAFFS_BLOCK_STATE_COLLECTING, YAFFS_BLOCK_STATE_COLLECTING,
/* This block is being garbage collected */ /* This block is being garbage collected */
@@ -533,6 +544,9 @@ struct yaffs_param { @@ -548,6 +559,9 @@ struct yaffs_param {
u32 n_reserved_blocks; /* Tuneable so that we can reduce u32 n_reserved_blocks; /* Tuneable so that we can reduce
* reserved blocks on NOR and RAM. */ * reserved blocks on NOR and RAM. */
@ -127,7 +129,7 @@ index 5ebc378..f5d47af 100644
u32 n_caches; /* If == 0, then short op caching is disabled, u32 n_caches; /* If == 0, then short op caching is disabled,
* else the number of short op caches. * else the number of short op caches.
*/ */
@@ -692,6 +706,17 @@ struct yaffs_dev { @@ -707,6 +721,17 @@ struct yaffs_dev {
int checkpoint_blocks_required; /* Number of blocks needed to store int checkpoint_blocks_required; /* Number of blocks needed to store
* current checkpoint set */ * current checkpoint set */
@ -145,7 +147,7 @@ index 5ebc378..f5d47af 100644
/* Block Info */ /* Block Info */
struct yaffs_block_info *block_info; struct yaffs_block_info *block_info;
u8 *chunk_bits; /* bitmap of chunks in use */ u8 *chunk_bits; /* bitmap of chunks in use */
@@ -881,6 +906,18 @@ struct yaffs_xattr_mod { @@ -895,6 +920,18 @@ struct yaffs_xattr_mod {
int result; int result;
}; };
@ -164,9 +166,9 @@ index 5ebc378..f5d47af 100644
/*----------------------- YAFFS Functions -----------------------*/ /*----------------------- YAFFS Functions -----------------------*/
int yaffs_guts_initialise(struct yaffs_dev *dev); int yaffs_guts_initialise(struct yaffs_dev *dev);
@@ -1049,6 +1086,15 @@ void yaffs_count_blocks_by_state(struct yaffs_dev *dev, int bs[10]); @@ -1081,6 +1118,15 @@ void yaffs_oh_ctime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk, void yaffs_oh_mtime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
struct yaffs_ext_tags *tags); void yaffs_oh_atime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
+#ifdef CONFIG_POWERSAFE +#ifdef CONFIG_POWERSAFE
+/*modify by powersafe*/ +/*modify by powersafe*/
@ -379,7 +381,7 @@ index 5a6aeed..4ee0357 100644
#define YAFFS_TRACE_SYNC 0x00100000 #define YAFFS_TRACE_SYNC 0x00100000
diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c
index a36d9bf..35d3e71 100644 index a08e071..4b670e9 100644
--- a/yaffs_vfs_multi.c --- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c
@@ -828,6 +828,11 @@ static const struct file_operations yaffs_file_operations = { @@ -828,6 +828,11 @@ static const struct file_operations yaffs_file_operations = {
@ -394,7 +396,7 @@ index a36d9bf..35d3e71 100644
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
#else #else
@@ -3026,8 +3031,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, @@ -3035,8 +3040,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
/* Set up the memory size parameters.... */ /* Set up the memory size parameters.... */
@ -408,7 +410,7 @@ index a36d9bf..35d3e71 100644
param->n_caches = (options.no_cache) ? 0 : 10; param->n_caches = (options.no_cache) ? 0 : 10;
param->inband_tags = inband_tags; param->inband_tags = inband_tags;
@@ -3217,6 +3226,60 @@ static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, @@ -3226,6 +3235,60 @@ static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
FS_REQUIRES_DEV); FS_REQUIRES_DEV);
#endif #endif
@ -470,10 +472,10 @@ index a36d9bf..35d3e71 100644
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c
index 9eb42f7..6d66e70 100644 index 6be3d6a..8ee7819 100644
--- a/yaffs_yaffs2.c --- a/yaffs_yaffs2.c
+++ b/yaffs_yaffs2.c +++ b/yaffs_yaffs2.c
@@ -1582,6 +1582,18 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) @@ -1584,6 +1584,18 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
if (bi->seq_number == YAFFS_SEQUENCE_CHECKPOINT_DATA) if (bi->seq_number == YAFFS_SEQUENCE_CHECKPOINT_DATA)
bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT; bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT;

BIN
yaffs2-9d9b662.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
Name: yaffs2 Name: yaffs2
Version:b4ce1bb Version:9d9b662
Release:1 Release:1
Summary:an open-source file system for embedded use with NAND and Nor Flash. Summary:an open-source file system for embedded use with NAND and Nor Flash.
@ -19,6 +19,8 @@ devices, avionics, or on commercial terms from Aleph one.
%files %files
%changelog %changelog
* Wed Jun 21 2023 fanglinxu <fanglinxu@huawei.com> - 9d9b662-1
- update to 9d9b662
* Wed Nov 2 2022 beiling.xie <xiekunxun@huawei.com> - b4ce1bb-1 * Wed Nov 2 2022 beiling.xie <xiekunxun@huawei.com> - b4ce1bb-1
* Tue Feb 9 2021 tangchenyang <tangchenyang2@huawei.com> - b4celbb-1 * Tue Feb 9 2021 tangchenyang <tangchenyang2@huawei.com> - b4celbb-1
- init - init