From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 4/4] f2fs: introduce FAULT_NO_SEGMENT
Date: Thu, 22 Feb 2024 20:18:51 +0800 [thread overview]
Message-ID: <20240222121851.883141-4-chao@kernel.org> (raw)
In-Reply-To: <20240222121851.883141-1-chao@kernel.org>
Use it to simulate no free segment case during block allocation.
Signed-off-by: Chao Yu <chao@kernel.org>
---
Documentation/ABI/testing/sysfs-fs-f2fs | 1 +
Documentation/filesystems/f2fs.rst | 1 +
fs/f2fs/f2fs.h | 1 +
fs/f2fs/segment.c | 5 +++++
fs/f2fs/super.c | 1 +
5 files changed, 9 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 15044d7d4977..96b54259a02a 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -718,6 +718,7 @@ Description: Support configuring fault injection type, should be
FAULT_LOCK_OP 0x000020000
FAULT_BLKADDR_VALIDITY 0x000040000
FAULT_BLKADDR_CONSISTENCE 0x000080000
+ FAULT_NO_SEGMENT 0x000100000
=========================== ===========
What: /sys/fs/f2fs/<disk>/discard_io_aware_gran
diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
index 1b3b73aa3ab9..bc074b8eedbb 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -205,6 +205,7 @@ fault_type=%d Support configuring fault injection type, should be
FAULT_LOCK_OP 0x000020000
FAULT_BLKADDR_VALIDITY 0x000040000
FAULT_BLKADDR_CONSISTENCE 0x000080000
+ FAULT_NO_SEGMENT 0x000100000
=========================== ===========
mode=%s Control block allocation mode which supports "adaptive"
and "lfs". In "lfs" mode, there should be no random
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 6390c3d551cb..fdc9a4dc981d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -62,6 +62,7 @@ enum {
FAULT_LOCK_OP,
FAULT_BLKADDR_VALIDITY,
FAULT_BLKADDR_CONSISTENCE,
+ FAULT_NO_SEGMENT,
FAULT_MAX,
};
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 71f523431e87..8ad88d5d4d1d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2653,6 +2653,11 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
spin_lock(&free_i->segmap_lock);
+ if (time_to_inject(sbi, FAULT_NO_SEGMENT)) {
+ ret = -ENOSPC;
+ goto out_unlock;
+ }
+
if (!new_sec && ((*newseg + 1) % SEGS_PER_SEC(sbi))) {
segno = find_next_zero_bit(free_i->free_segmap,
GET_SEG_FROM_SEC(sbi, hint + 1), *newseg + 1);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index bb056700b459..dc4fb9a661f2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -63,6 +63,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
[FAULT_LOCK_OP] = "lock_op",
[FAULT_BLKADDR_VALIDITY] = "invalid blkaddr",
[FAULT_BLKADDR_CONSISTENCE] = "inconsistent blkaddr",
+ [FAULT_NO_SEGMENT] = "no free segment",
};
void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned int rate,
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH 4/4] f2fs: introduce FAULT_NO_SEGMENT
Date: Thu, 22 Feb 2024 20:18:51 +0800 [thread overview]
Message-ID: <20240222121851.883141-4-chao@kernel.org> (raw)
In-Reply-To: <20240222121851.883141-1-chao@kernel.org>
Use it to simulate no free segment case during block allocation.
Signed-off-by: Chao Yu <chao@kernel.org>
---
Documentation/ABI/testing/sysfs-fs-f2fs | 1 +
Documentation/filesystems/f2fs.rst | 1 +
fs/f2fs/f2fs.h | 1 +
fs/f2fs/segment.c | 5 +++++
fs/f2fs/super.c | 1 +
5 files changed, 9 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 15044d7d4977..96b54259a02a 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -718,6 +718,7 @@ Description: Support configuring fault injection type, should be
FAULT_LOCK_OP 0x000020000
FAULT_BLKADDR_VALIDITY 0x000040000
FAULT_BLKADDR_CONSISTENCE 0x000080000
+ FAULT_NO_SEGMENT 0x000100000
=========================== ===========
What: /sys/fs/f2fs/<disk>/discard_io_aware_gran
diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
index 1b3b73aa3ab9..bc074b8eedbb 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -205,6 +205,7 @@ fault_type=%d Support configuring fault injection type, should be
FAULT_LOCK_OP 0x000020000
FAULT_BLKADDR_VALIDITY 0x000040000
FAULT_BLKADDR_CONSISTENCE 0x000080000
+ FAULT_NO_SEGMENT 0x000100000
=========================== ===========
mode=%s Control block allocation mode which supports "adaptive"
and "lfs". In "lfs" mode, there should be no random
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 6390c3d551cb..fdc9a4dc981d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -62,6 +62,7 @@ enum {
FAULT_LOCK_OP,
FAULT_BLKADDR_VALIDITY,
FAULT_BLKADDR_CONSISTENCE,
+ FAULT_NO_SEGMENT,
FAULT_MAX,
};
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 71f523431e87..8ad88d5d4d1d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2653,6 +2653,11 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
spin_lock(&free_i->segmap_lock);
+ if (time_to_inject(sbi, FAULT_NO_SEGMENT)) {
+ ret = -ENOSPC;
+ goto out_unlock;
+ }
+
if (!new_sec && ((*newseg + 1) % SEGS_PER_SEC(sbi))) {
segno = find_next_zero_bit(free_i->free_segmap,
GET_SEG_FROM_SEC(sbi, hint + 1), *newseg + 1);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index bb056700b459..dc4fb9a661f2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -63,6 +63,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
[FAULT_LOCK_OP] = "lock_op",
[FAULT_BLKADDR_VALIDITY] = "invalid blkaddr",
[FAULT_BLKADDR_CONSISTENCE] = "inconsistent blkaddr",
+ [FAULT_NO_SEGMENT] = "no free segment",
};
void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned int rate,
--
2.40.1
next prev parent reply other threads:[~2024-02-22 12:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 12:18 [f2fs-dev] [PATCH 1/4] f2fs: delete f2fs_get_new_segment() declaration Chao Yu
2024-02-22 12:18 ` Chao Yu
2024-02-22 12:18 ` [f2fs-dev] [PATCH 2/4] f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage Chao Yu
2024-02-22 12:18 ` Chao Yu
2024-02-27 17:50 ` [f2fs-dev] " Jaegeuk Kim
2024-02-27 17:50 ` Jaegeuk Kim
2024-02-28 1:23 ` [f2fs-dev] " Chao Yu
2024-02-28 1:23 ` Chao Yu
2024-02-22 12:18 ` [f2fs-dev] [PATCH 3/4] f2fs: fix to handle segment allocation failure correctly Chao Yu
2024-02-22 12:18 ` Chao Yu
2024-02-26 7:46 ` [f2fs-dev] " Chao Yu
2024-02-26 7:46 ` Chao Yu
2024-02-26 10:28 ` [f2fs-dev] " Zhiguo Niu
2024-02-26 10:28 ` Zhiguo Niu
2024-02-22 12:18 ` Chao Yu [this message]
2024-02-22 12:18 ` [PATCH 4/4] f2fs: introduce FAULT_NO_SEGMENT Chao Yu
2024-02-28 22:50 ` [f2fs-dev] [PATCH 1/4] f2fs: delete f2fs_get_new_segment() declaration patchwork-bot+f2fs
2024-02-28 22:50 ` patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240222121851.883141-4-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.