* [f2fs-dev] [PATCH v2 0/3] alloc_mode changed after remount on a small volume device
@ 2022-11-15 6:35 Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 1/3] f2fs: fix to " Yuwei Guan
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yuwei Guan @ 2022-11-15 6:35 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel
This series contains a fix patch for alloc_mode changed after remount
on a small volume device, and do cleanup for 'f2fs_tuning_parameters'
function.
The last one changes type for sbi->readdir_ra.
V1 -> v2 :
- set alloc_mode default state in default_options()
- let variable readdir_ra holds the sbi->readdir_ra state in
f2fs_fill_dentries()
Yuwei Guan (3):
f2fs: fix to alloc_mode changed after remount on a small volume device
f2fs: cleanup for 'f2fs_tuning_parameters' function
f2fs: change type for 'sbi->readdir_ra'
fs/f2fs/dir.c | 2 +-
fs/f2fs/f2fs.h | 2 +-
fs/f2fs/super.c | 17 +++++++++--------
fs/f2fs/sysfs.c | 5 +++++
4 files changed, 16 insertions(+), 10 deletions(-)
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [f2fs-dev] [PATCH v2 1/3] f2fs: fix to alloc_mode changed after remount on a small volume device
2022-11-15 6:35 [f2fs-dev] [PATCH v2 0/3] alloc_mode changed after remount on a small volume device Yuwei Guan
@ 2022-11-15 6:35 ` Yuwei Guan
2022-11-16 1:26 ` Chao Yu
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra' Yuwei Guan
2 siblings, 1 reply; 7+ messages in thread
From: Yuwei Guan @ 2022-11-15 6:35 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel
The commit 84b89e5d943d8 ("f2fs: add auto tuning for small devices") add
tuning for small volume device, now support to tune alloce_mode to 'reuse'
if it's small size. But the alloc_mode will change to 'default' when do
remount on this small size dievce. This patch fo fix alloc_mode changed
when do remount for a small volume device.
Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
---
fs/f2fs/super.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 3834ead04620..17b9e70b8f32 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2043,7 +2043,11 @@ static void default_options(struct f2fs_sb_info *sbi)
F2FS_OPTION(sbi).active_logs = NR_CURSEG_PERSIST_TYPE;
F2FS_OPTION(sbi).inline_xattr_size = DEFAULT_INLINE_XATTR_ADDRS;
- F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT;
+ if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main) <=
+ SMALL_VOLUME_SEGMENTS)
+ F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE;
+ else
+ F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT;
F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX;
F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID);
F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID);
@@ -4060,7 +4064,6 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
/* adjust parameters according to the volume size */
if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) {
- F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE;
if (f2fs_block_unit_discard(sbi))
sm_i->dcc_info->discard_granularity = 1;
sm_i->ipu_policy = 1 << F2FS_IPU_FORCE |
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function
2022-11-15 6:35 [f2fs-dev] [PATCH v2 0/3] alloc_mode changed after remount on a small volume device Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 1/3] f2fs: fix to " Yuwei Guan
@ 2022-11-15 6:35 ` Yuwei Guan
2022-11-16 1:26 ` Chao Yu
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra' Yuwei Guan
2 siblings, 1 reply; 7+ messages in thread
From: Yuwei Guan @ 2022-11-15 6:35 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel
A cleanup patch for 'f2fs_tuning_parameters' function.
Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
---
fs/f2fs/super.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 17b9e70b8f32..3e974c003b77 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4060,13 +4060,11 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
{
- struct f2fs_sm_info *sm_i = SM_I(sbi);
-
/* adjust parameters according to the volume size */
- if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) {
+ if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) {
if (f2fs_block_unit_discard(sbi))
- sm_i->dcc_info->discard_granularity = 1;
- sm_i->ipu_policy = 1 << F2FS_IPU_FORCE |
+ SM_I(sbi)->dcc_info->discard_granularity = 1;
+ SM_I(sbi)->ipu_policy = 1 << F2FS_IPU_FORCE |
1 << F2FS_IPU_HONOR_OPU_WRITE;
}
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra'
2022-11-15 6:35 [f2fs-dev] [PATCH v2 0/3] alloc_mode changed after remount on a small volume device Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 1/3] f2fs: fix to " Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Yuwei Guan
@ 2022-11-15 6:35 ` Yuwei Guan
2022-11-16 1:27 ` Chao Yu
2 siblings, 1 reply; 7+ messages in thread
From: Yuwei Guan @ 2022-11-15 6:35 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel
Before this patch, the varibale 'readdir_ra' takes effect if it's equal
to '1' or not, so we can change type for it from 'int' to 'bool'.
Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
---
fs/f2fs/dir.c | 2 +-
fs/f2fs/f2fs.h | 2 +-
fs/f2fs/super.c | 2 +-
fs/f2fs/sysfs.c | 5 +++++
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 21960a899b6a..eecbf5d6b002 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -1000,7 +1000,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
struct fscrypt_str de_name = FSTR_INIT(NULL, 0);
struct f2fs_sb_info *sbi = F2FS_I_SB(d->inode);
struct blk_plug plug;
- bool readdir_ra = sbi->readdir_ra == 1;
+ bool readdir_ra = sbi->readdir_ra;
bool found_valid_dirent = false;
int err = 0;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e6355a5683b7..384840216e7f 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1693,7 +1693,7 @@ struct f2fs_sb_info {
unsigned int total_node_count; /* total node block count */
unsigned int total_valid_node_count; /* valid node block count */
int dir_level; /* directory level */
- int readdir_ra; /* readahead inode in readdir */
+ bool readdir_ra; /* readahead inode in readdir */
u64 max_io_bytes; /* max io bytes to merge IOs */
block_t user_block_count; /* # of user blocks */
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 3e974c003b77..0d1adfdd0603 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4068,7 +4068,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
1 << F2FS_IPU_HONOR_OPU_WRITE;
}
- sbi->readdir_ra = 1;
+ sbi->readdir_ra = true;
}
static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index df27afd71ef4..53fbbb87dd0f 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -649,6 +649,11 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
return count;
}
+ if (!strcmp(a->attr.name, "readdir_ra")) {
+ sbi->readdir_ra = !!t;
+ return count;
+ }
+
*ui = (unsigned int)t;
return count;
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* Re: [f2fs-dev] [PATCH v2 1/3] f2fs: fix to alloc_mode changed after remount on a small volume device
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 1/3] f2fs: fix to " Yuwei Guan
@ 2022-11-16 1:26 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2022-11-16 1:26 UTC (permalink / raw)
To: Yuwei Guan, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2022/11/15 14:35, Yuwei Guan wrote:
> The commit 84b89e5d943d8 ("f2fs: add auto tuning for small devices") add
> tuning for small volume device, now support to tune alloce_mode to 'reuse'
> if it's small size. But the alloc_mode will change to 'default' when do
> remount on this small size dievce. This patch fo fix alloc_mode changed
> when do remount for a small volume device.
>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
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] 7+ messages in thread
* Re: [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Yuwei Guan
@ 2022-11-16 1:26 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2022-11-16 1:26 UTC (permalink / raw)
To: Yuwei Guan, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2022/11/15 14:35, Yuwei Guan wrote:
> A cleanup patch for 'f2fs_tuning_parameters' function.
>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
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] 7+ messages in thread
* Re: [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra'
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra' Yuwei Guan
@ 2022-11-16 1:27 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2022-11-16 1:27 UTC (permalink / raw)
To: Yuwei Guan, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2022/11/15 14:35, Yuwei Guan wrote:
> Before this patch, the varibale 'readdir_ra' takes effect if it's equal
> to '1' or not, so we can change type for it from 'int' to 'bool'.
>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
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] 7+ messages in thread
end of thread, other threads:[~2022-11-16 1:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 6:35 [f2fs-dev] [PATCH v2 0/3] alloc_mode changed after remount on a small volume device Yuwei Guan
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 1/3] f2fs: fix to " Yuwei Guan
2022-11-16 1:26 ` Chao Yu
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Yuwei Guan
2022-11-16 1:26 ` Chao Yu
2022-11-15 6:35 ` [f2fs-dev] [PATCH v2 3/3] f2fs: change type for 'sbi->readdir_ra' Yuwei Guan
2022-11-16 1:27 ` 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).