* [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer
@ 2024-04-02 23:54 Jaegeuk Kim
2024-04-08 17:55 ` Daeho Jeong
2024-04-09 3:28 ` Chao Yu
0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2024-04-02 23:54 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
This addresses high GC cost at runtime.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
include/f2fs_fs.h | 8 +++++++-
mkfs/f2fs_format.c | 5 +++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index fc56396fa358..870a6e4823d2 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -1775,6 +1775,12 @@ static inline uint32_t get_reserved(struct f2fs_super_block *sb, double ovp)
return round_up(reserved, segs_per_sec) * segs_per_sec;
}
+static inline uint32_t overprovision_segment_buffer(struct f2fs_super_block *sb)
+{
+ /* Give 6 current sections to avoid huge GC overheads. */
+ return 6 * get_sb(segs_per_sec);
+}
+
static inline double get_best_overprovision(struct f2fs_super_block *sb)
{
double ovp, candidate, end, diff, space;
@@ -1798,7 +1804,7 @@ static inline double get_best_overprovision(struct f2fs_super_block *sb)
if (ovp < 0)
continue;
space = usable_main_segs - max((double)reserved, ovp) -
- 2 * get_sb(segs_per_sec);
+ overprovision_segment_buffer(sb);
if (max_space < space) {
max_space = space;
max_ovp = candidate;
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 8f632f8d74b4..e26a513ed80c 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -778,7 +778,8 @@ static int f2fs_write_check_point_pack(void)
* In non configurable reserved section case, overprovision
* segments are always bigger than two sections.
*/
- if (get_cp(overprov_segment_count) < 2 * get_sb(segs_per_sec)) {
+ if (get_cp(overprov_segment_count) <
+ overprovision_segment_buffer(sb)) {
MSG(0, "\tError: Not enough overprovision segments (%u)\n",
get_cp(overprov_segment_count));
goto free_cp_payload;
@@ -787,7 +788,7 @@ static int f2fs_write_check_point_pack(void)
get_cp(rsvd_segment_count));
} else {
set_cp(overprov_segment_count, get_cp(overprov_segment_count) +
- 2 * get_sb(segs_per_sec));
+ overprovision_segment_buffer(sb));
}
if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
--
2.44.0.478.gd926399ef9-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer
2024-04-02 23:54 [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer Jaegeuk Kim
@ 2024-04-08 17:55 ` Daeho Jeong
2024-04-09 3:28 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Daeho Jeong @ 2024-04-08 17:55 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On Tue, Apr 2, 2024 at 4:56 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> This addresses high GC cost at runtime.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> include/f2fs_fs.h | 8 +++++++-
> mkfs/f2fs_format.c | 5 +++--
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index fc56396fa358..870a6e4823d2 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -1775,6 +1775,12 @@ static inline uint32_t get_reserved(struct f2fs_super_block *sb, double ovp)
> return round_up(reserved, segs_per_sec) * segs_per_sec;
> }
>
> +static inline uint32_t overprovision_segment_buffer(struct f2fs_super_block *sb)
> +{
> + /* Give 6 current sections to avoid huge GC overheads. */
> + return 6 * get_sb(segs_per_sec);
> +}
> +
> static inline double get_best_overprovision(struct f2fs_super_block *sb)
> {
> double ovp, candidate, end, diff, space;
> @@ -1798,7 +1804,7 @@ static inline double get_best_overprovision(struct f2fs_super_block *sb)
> if (ovp < 0)
> continue;
> space = usable_main_segs - max((double)reserved, ovp) -
> - 2 * get_sb(segs_per_sec);
> + overprovision_segment_buffer(sb);
> if (max_space < space) {
> max_space = space;
> max_ovp = candidate;
> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
> index 8f632f8d74b4..e26a513ed80c 100644
> --- a/mkfs/f2fs_format.c
> +++ b/mkfs/f2fs_format.c
> @@ -778,7 +778,8 @@ static int f2fs_write_check_point_pack(void)
> * In non configurable reserved section case, overprovision
> * segments are always bigger than two sections.
> */
> - if (get_cp(overprov_segment_count) < 2 * get_sb(segs_per_sec)) {
> + if (get_cp(overprov_segment_count) <
> + overprovision_segment_buffer(sb)) {
> MSG(0, "\tError: Not enough overprovision segments (%u)\n",
> get_cp(overprov_segment_count));
> goto free_cp_payload;
> @@ -787,7 +788,7 @@ static int f2fs_write_check_point_pack(void)
> get_cp(rsvd_segment_count));
> } else {
> set_cp(overprov_segment_count, get_cp(overprov_segment_count) +
> - 2 * get_sb(segs_per_sec));
> + overprovision_segment_buffer(sb));
> }
>
> if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
> --
> 2.44.0.478.gd926399ef9-goog
>
>
>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer
2024-04-02 23:54 [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer Jaegeuk Kim
2024-04-08 17:55 ` Daeho Jeong
@ 2024-04-09 3:28 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2024-04-09 3:28 UTC (permalink / raw)
To: Jaegeuk Kim, linux-f2fs-devel
On 2024/4/3 7:54, Jaegeuk Kim wrote:
> This addresses high GC cost at runtime.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-09 3:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 23:54 [f2fs-dev] [PATCH] f2fs-tools: give 6 sections for overprovision buffer Jaegeuk Kim
2024-04-08 17:55 ` Daeho Jeong
2024-04-09 3:28 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).