[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231019073838.17586-2-mmkurbanov@salutedevices.com>
Date: Thu, 19 Oct 2023 10:38:37 +0300
From: Martin Kurbanov <mmkurbanov@...utedevices.com>
To: David Woodhouse <dwmw2@...radead.org>,
Richard Weinberger <richard@....at>,
Christian Brauner <brauner@...nel.org>,
Dave Chinner <dchinner@...hat.com>, Yu Zhe <yuzhe@...china.com>
CC: <linux-kernel@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
<kernel@...rdevices.ru>,
Martin Kurbanov <mmkurbanov@...utedevices.com>
Subject: [PATCH v1 1/2] jffs2: introduce jffs2_nandflash()
Introduce jffs2_nandflash() instead of jffs2_cleanmarker_oob().
The jffs2_nandflash() is used to determine the type of flash.
And the jffs2_cleanmarker_oob() determines whether cleanmarkers
are needed.
The function name is chosen by analogy with jffs2_dataflash() and
jffs2_ubivol().
This is a preparation patch making further changes a bit cleaner
(no functional change).
Signed-off-by: Martin Kurbanov <mmkurbanov@...utedevices.com>
---
fs/jffs2/erase.c | 2 +-
fs/jffs2/fs.c | 4 ++--
fs/jffs2/os-linux.h | 3 +++
fs/jffs2/scan.c | 2 +-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index acd32f05b519..4475de5206c0 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -173,7 +173,7 @@ static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock
{
/* For NAND, if the failure did not occur at the device level for a
specific physical page, don't bother updating the bad block table. */
- if (jffs2_cleanmarker_oob(c) && (bad_offset != (uint32_t)MTD_FAIL_ADDR_UNKNOWN)) {
+ if (jffs2_nandflash(c) && (bad_offset != (uint32_t)MTD_FAIL_ADDR_UNKNOWN)) {
/* We had a device-level failure to erase. Let's see if we've
failed too many times. */
if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) {
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 038516bee1ab..6de91c00eb73 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -687,7 +687,7 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
static int jffs2_flash_setup(struct jffs2_sb_info *c) {
int ret = 0;
- if (jffs2_cleanmarker_oob(c)) {
+ if (jffs2_nandflash(c)) {
/* NAND flash... do setup accordingly */
ret = jffs2_nand_flash_setup(c);
if (ret)
@@ -720,7 +720,7 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) {
void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
- if (jffs2_cleanmarker_oob(c)) {
+ if (jffs2_nandflash(c)) {
jffs2_nand_flash_cleanup(c);
}
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 8da19766c101..c604f639a00f 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -81,6 +81,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
#define jffs2_flush_wbuf_pad(c) ({ do{} while(0); (void)(c), 0; })
#define jffs2_flush_wbuf_gc(c, i) ({ do{} while(0); (void)(c), (void) i, 0; })
#define jffs2_write_nand_badblock(c,jeb,bad_offset) (1)
+#define jffs2_nandflash(c) (0)
#define jffs2_nand_flash_setup(c) (0)
#define jffs2_nand_flash_cleanup(c) do {} while(0)
#define jffs2_wbuf_dirty(c) (0)
@@ -124,6 +125,8 @@ void jffs2_wbuf_timeout(unsigned long data);
void jffs2_wbuf_process(void *data);
int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino);
int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c);
+
+#define jffs2_nandflash(c) ((c)->mtd->type == MTD_NANDFLASH)
int jffs2_nand_flash_setup(struct jffs2_sb_info *c);
void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 29671e33a171..005d0af950ea 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -113,7 +113,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
if (!flashbuf) {
/* For NAND it's quicker to read a whole eraseblock at a time,
apparently */
- if (jffs2_cleanmarker_oob(c))
+ if (jffs2_nandflash(c))
try_size = c->sector_size;
else
try_size = PAGE_SIZE;
--
2.40.0
Powered by blists - more mailing lists