yaffs2: update to 9d9b662

* update to 9d9b662
* sync 0001-add-powersafe.patch for specific use

refer to:
https://gitee.com/src-openeuler/yaffs2/issues/I7DD06?from=project-issue

Signed-off-by: fanglinxu <fanglinxu@huawei.com>
This commit is contained in:
fanglinxu 2023-06-21 17:19:43 +08:00
parent b1a42865ff
commit 692707be9d
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: luojects <luoyonglun@huawei.com>
Date: Thu, 15 Dec 2022 20:32:08 +0800
From 30f82ef48ed60def1ce9169d8b365b85384d2d83 Mon Sep 17 00:00:00 2001
From: fanglinxu <fanglinxu@huawei.com>
Date: Wed, 21 Jun 2023 16:42:01 +0800
Subject: [PATCH] add powersafe
Signed-off-by: fanglinxu <fanglinxu@huawei.com>
---
yaffs_guts.c | 39 ++++++++++
yaffs_guts.c | 40 +++++++++++
yaffs_guts.h | 46 ++++++++++++
yaffs_powersafe.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++
yaffs_trace.h | 1 +
yaffs_vfs_multi.c | 65 ++++++++++++++++-
yaffs_yaffs2.c | 12 ++++
6 files changed, 342 insertions(+), 1 deletion(-)
6 files changed, 343 insertions(+), 1 deletion(-)
create mode 100644 yaffs_powersafe.c
diff --git a/yaffs_guts.c b/yaffs_guts.c
index 40a5b46..46b6c16 100644
index b83fa63..be298b2 100644
--- a/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;
}
@ -46,43 +47,44 @@ index 40a5b46..46b6c16 100644
+{
+ dev->powersafe_block = yaffs_find_alloc_block(dev);
+}
+
+
+#endif
int yaffs_guts_initialise(struct yaffs_dev *dev)
{
@@ -4970,6 +4997,10 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
+
/*
* If the dev is mounted r/w then the cleanup will happen during
* 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))
init_failed = 1;
+#ifdef CONFIG_POWERSAFE
+ init_power_safe(dev);
+ init_power_safe(dev);
+#endif
+
if (!init_failed) {
/* Now scan the flash. */
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)
yaffs2_checkpt_invalidate(dev);
+#ifdef CONFIG_POWERSAFE
+ yaffs_sort_powersafe_block(dev);
+ yaffs_powersafe_read_buffer(dev);
+ yaffs_powersafe_invalied(dev);
+ yaffs_sort_powersafe_block(dev);
+ yaffs_powersafe_read_buffer(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
yaffs_trace(YAFFS_TRACE_TRACING,
"yaffs: yaffs_guts_initialise() done.");
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]++;
}
}
+
diff --git a/yaffs_guts.h b/yaffs_guts.h
index 5ebc378..f5d47af 100644
index 74ded0b..8b55133 100644
--- a/yaffs_guts.h
+++ b/yaffs_guts.h
@@ -28,6 +28,8 @@
@ -106,7 +108,7 @@ index 5ebc378..f5d47af 100644
#define YAFFS_MAX_SHORT_OP_CACHES 20
#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,
/* This block is assigned to holding checkpoint data. */
@ -117,7 +119,7 @@ index 5ebc378..f5d47af 100644
YAFFS_BLOCK_STATE_COLLECTING,
/* 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
* 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,
* 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
* current checkpoint set */
@ -145,7 +147,7 @@ index 5ebc378..f5d47af 100644
/* Block Info */
struct yaffs_block_info *block_info;
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;
};
@ -164,9 +166,9 @@ index 5ebc378..f5d47af 100644
/*----------------------- YAFFS Functions -----------------------*/
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]);
int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
struct yaffs_ext_tags *tags);
@@ -1081,6 +1118,15 @@ void yaffs_oh_ctime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
void yaffs_oh_mtime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
void yaffs_oh_atime_load(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh);
+#ifdef CONFIG_POWERSAFE
+/*modify by powersafe*/
@ -379,7 +381,7 @@ index 5a6aeed..4ee0357 100644
#define YAFFS_TRACE_SYNC 0x00100000
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
+++ b/yaffs_vfs_multi.c
@@ -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)
.splice_write = iter_file_splice_write,
#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.... */
@ -408,7 +410,7 @@ index a36d9bf..35d3e71 100644
param->n_caches = (options.no_cache) ? 0 : 10;
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);
#endif
@ -470,10 +472,10 @@ index a36d9bf..35d3e71 100644
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c
index 9eb42f7..6d66e70 100644
index 6be3d6a..8ee7819 100644
--- a/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)
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
Version:b4ce1bb
Version:9d9b662
Release:1
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
%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
* Tue Feb 9 2021 tangchenyang <tangchenyang2@huawei.com> - b4celbb-1
- init