diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-27 06:09:05 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-27 06:31:15 -0500 |
commit | ab9fa662e4867455f44f4de96d29a7f09cf292c6 (patch) | |
tree | efa4cc308d41d83c0bd527df11bda8ca48e5eca8 | |
parent | 3843154598a00408f4214a68bd536fdf27b1df10 (diff) |
f2fs: add an sysfs entry to control the directory level
This patch adds an sysfs entry to control dir_level used by the large directory.
The description of this entry is:
dir_level This parameter controls the directory level to
support large directory. If a directory has a
number of files, it can reduce the file lookup
latency by increasing this dir_level value.
Otherwise, it needs to decrease this value to
reduce the space overhead. The default value is 0.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r-- | Documentation/filesystems/f2fs.txt | 7 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 3 | ||||
-rw-r--r-- | fs/f2fs/super.c | 7 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt index 8eb06b0a7d2b..803784e1e8ef 100644 --- a/Documentation/filesystems/f2fs.txt +++ b/Documentation/filesystems/f2fs.txt | |||
@@ -195,6 +195,13 @@ Files in /sys/fs/f2fs/<devname> | |||
195 | cleaning operations. The default value is 4096 | 195 | cleaning operations. The default value is 4096 |
196 | which covers 8GB block address range. | 196 | which covers 8GB block address range. |
197 | 197 | ||
198 | dir_level This parameter controls the directory level to | ||
199 | support large directory. If a directory has a | ||
200 | number of files, it can reduce the file lookup | ||
201 | latency by increasing this dir_level value. | ||
202 | Otherwise, it needs to decrease this value to | ||
203 | reduce the space overhead. The default value is 0. | ||
204 | |||
198 | ================================================================================ | 205 | ================================================================================ |
199 | USAGE | 206 | USAGE |
200 | ================================================================================ | 207 | ================================================================================ |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index a82691674918..6f88191f2a34 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -196,6 +196,8 @@ struct extent_info { | |||
196 | #define FADVISE_COLD_BIT 0x01 | 196 | #define FADVISE_COLD_BIT 0x01 |
197 | #define FADVISE_LOST_PINO_BIT 0x02 | 197 | #define FADVISE_LOST_PINO_BIT 0x02 |
198 | 198 | ||
199 | #define DEF_DIR_LEVEL 0 | ||
200 | |||
199 | struct f2fs_inode_info { | 201 | struct f2fs_inode_info { |
200 | struct inode vfs_inode; /* serve a vfs inode */ | 202 | struct inode vfs_inode; /* serve a vfs inode */ |
201 | unsigned long i_flags; /* keep an inode flags for ioctl */ | 203 | unsigned long i_flags; /* keep an inode flags for ioctl */ |
@@ -447,6 +449,7 @@ struct f2fs_sb_info { | |||
447 | unsigned int total_valid_node_count; /* valid node block count */ | 449 | unsigned int total_valid_node_count; /* valid node block count */ |
448 | unsigned int total_valid_inode_count; /* valid inode count */ | 450 | unsigned int total_valid_inode_count; /* valid inode count */ |
449 | int active_logs; /* # of active logs */ | 451 | int active_logs; /* # of active logs */ |
452 | int dir_level; /* directory level */ | ||
450 | 453 | ||
451 | block_t user_block_count; /* # of user blocks */ | 454 | block_t user_block_count; /* # of user blocks */ |
452 | block_t total_valid_block_count; /* # of valid blocks */ | 455 | block_t total_valid_block_count; /* # of valid blocks */ |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 475560e5ee71..1bd915362154 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -184,6 +184,7 @@ F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, max_small_discards, max_discards); | |||
184 | F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, ipu_policy, ipu_policy); | 184 | F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, ipu_policy, ipu_policy); |
185 | F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ipu_util, min_ipu_util); | 185 | F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ipu_util, min_ipu_util); |
186 | F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_victim_search, max_victim_search); | 186 | F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_victim_search, max_victim_search); |
187 | F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, dir_level, dir_level); | ||
187 | 188 | ||
188 | #define ATTR_LIST(name) (&f2fs_attr_##name.attr) | 189 | #define ATTR_LIST(name) (&f2fs_attr_##name.attr) |
189 | static struct attribute *f2fs_attrs[] = { | 190 | static struct attribute *f2fs_attrs[] = { |
@@ -196,6 +197,7 @@ static struct attribute *f2fs_attrs[] = { | |||
196 | ATTR_LIST(ipu_policy), | 197 | ATTR_LIST(ipu_policy), |
197 | ATTR_LIST(min_ipu_util), | 198 | ATTR_LIST(min_ipu_util), |
198 | ATTR_LIST(max_victim_search), | 199 | ATTR_LIST(max_victim_search), |
200 | ATTR_LIST(dir_level), | ||
199 | NULL, | 201 | NULL, |
200 | }; | 202 | }; |
201 | 203 | ||
@@ -359,6 +361,9 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb) | |||
359 | if (test_opt(F2FS_SB(sb), INLINE_XATTR)) | 361 | if (test_opt(F2FS_SB(sb), INLINE_XATTR)) |
360 | set_inode_flag(fi, FI_INLINE_XATTR); | 362 | set_inode_flag(fi, FI_INLINE_XATTR); |
361 | 363 | ||
364 | /* Will be used by directory only */ | ||
365 | fi->i_dir_level = F2FS_SB(sb)->dir_level; | ||
366 | |||
362 | return &fi->vfs_inode; | 367 | return &fi->vfs_inode; |
363 | } | 368 | } |
364 | 369 | ||
@@ -785,6 +790,8 @@ static void init_sb_info(struct f2fs_sb_info *sbi) | |||
785 | 790 | ||
786 | for (i = 0; i < NR_COUNT_TYPE; i++) | 791 | for (i = 0; i < NR_COUNT_TYPE; i++) |
787 | atomic_set(&sbi->nr_pages[i], 0); | 792 | atomic_set(&sbi->nr_pages[i], 0); |
793 | |||
794 | sbi->dir_level = DEF_DIR_LEVEL; | ||
788 | } | 795 | } |
789 | 796 | ||
790 | /* | 797 | /* |