Skip to content

Commit 12607c1

Browse files
author
Jaegeuk Kim
committed
f2fs: specify extent cache for read explicitly
Let's descrbie it's read extent cache. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent ed8ac22 commit 12607c1

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

fs/f2fs/extent_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void __f2fs_init_extent_tree(struct inode *inode, struct page *ipage)
383383
if (!i_ext || !i_ext->len)
384384
return;
385385

386-
get_extent_info(&ei, i_ext);
386+
get_read_extent_info(&ei, i_ext);
387387

388388
write_lock(&et->lock);
389389
if (atomic_read(&et->node_cnt))
@@ -710,7 +710,7 @@ unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int nr_shrink)
710710
unsigned int node_cnt = 0, tree_cnt = 0;
711711
int remained;
712712

713-
if (!test_opt(sbi, EXTENT_CACHE))
713+
if (!test_opt(sbi, READ_EXTENT_CACHE))
714714
return 0;
715715

716716
if (!atomic_read(&sbi->total_zombie_tree))

fs/f2fs/f2fs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];
9292
#define F2FS_MOUNT_FLUSH_MERGE 0x00000400
9393
#define F2FS_MOUNT_NOBARRIER 0x00000800
9494
#define F2FS_MOUNT_FASTBOOT 0x00001000
95-
#define F2FS_MOUNT_EXTENT_CACHE 0x00002000
95+
#define F2FS_MOUNT_READ_EXTENT_CACHE 0x00002000
9696
#define F2FS_MOUNT_DATA_FLUSH 0x00008000
9797
#define F2FS_MOUNT_FAULT_INJECTION 0x00010000
9898
#define F2FS_MOUNT_USRQUOTA 0x00080000
@@ -600,7 +600,7 @@ enum {
600600
#define F2FS_MIN_EXTENT_LEN 64 /* minimum extent length */
601601

602602
/* number of extent info in extent cache we try to shrink */
603-
#define EXTENT_CACHE_SHRINK_NUMBER 128
603+
#define READ_EXTENT_CACHE_SHRINK_NUMBER 128
604604

605605
#define RECOVERY_MAX_RA_BLOCKS BIO_MAX_VECS
606606
#define RECOVERY_MIN_RA_BLOCKS 1
@@ -830,15 +830,15 @@ struct f2fs_inode_info {
830830
loff_t original_i_size; /* original i_size before atomic write */
831831
};
832832

833-
static inline void get_extent_info(struct extent_info *ext,
833+
static inline void get_read_extent_info(struct extent_info *ext,
834834
struct f2fs_extent *i_ext)
835835
{
836836
ext->fofs = le32_to_cpu(i_ext->fofs);
837837
ext->blk = le32_to_cpu(i_ext->blk);
838838
ext->len = le32_to_cpu(i_ext->len);
839839
}
840840

841-
static inline void set_raw_extent(struct extent_info *ext,
841+
static inline void set_raw_read_extent(struct extent_info *ext,
842842
struct f2fs_extent *i_ext)
843843
{
844844
i_ext->fofs = cpu_to_le32(ext->fofs);
@@ -4407,7 +4407,7 @@ static inline bool f2fs_may_extent_tree(struct inode *inode)
44074407
{
44084408
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
44094409

4410-
if (!test_opt(sbi, EXTENT_CACHE) ||
4410+
if (!test_opt(sbi, READ_EXTENT_CACHE) ||
44114411
is_inode_flag_set(inode, FI_NO_EXTENT) ||
44124412
(is_inode_flag_set(inode, FI_COMPRESSED_FILE) &&
44134413
!f2fs_sb_has_readonly(sbi)))

fs/f2fs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
629629

630630
if (et) {
631631
read_lock(&et->lock);
632-
set_raw_extent(&et->largest, &ri->i_ext);
632+
set_raw_read_extent(&et->largest, &ri->i_ext);
633633
read_unlock(&et->lock);
634634
} else {
635635
memset(&ri->i_ext, 0, sizeof(ri->i_ext));

fs/f2fs/node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
8585
sizeof(struct ino_entry);
8686
mem_size >>= PAGE_SHIFT;
8787
res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
88-
} else if (type == EXTENT_CACHE) {
88+
} else if (type == READ_EXTENT_CACHE) {
8989
mem_size = (atomic_read(&sbi->total_ext_tree) *
9090
sizeof(struct extent_tree) +
9191
atomic_read(&sbi->total_ext_node) *

fs/f2fs/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ enum mem_type {
146146
NAT_ENTRIES, /* indicates the cached nat entry */
147147
DIRTY_DENTS, /* indicates dirty dentry pages */
148148
INO_ENTRIES, /* indicates inode entries */
149-
EXTENT_CACHE, /* indicates extent cache */
149+
READ_EXTENT_CACHE, /* indicates read extent cache */
150150
DISCARD_CACHE, /* indicates memory of cached discard cmds */
151151
COMPRESS_PAGE, /* indicates memory of cached compressed pages */
152152
BASE_CHECK, /* check kernel status */

fs/f2fs/segment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg)
449449
return;
450450

451451
/* try to shrink extent cache when there is no enough memory */
452-
if (!f2fs_available_free_memory(sbi, EXTENT_CACHE))
453-
f2fs_shrink_extent_tree(sbi, EXTENT_CACHE_SHRINK_NUMBER);
452+
if (!f2fs_available_free_memory(sbi, READ_EXTENT_CACHE))
453+
f2fs_shrink_extent_tree(sbi, READ_EXTENT_CACHE_SHRINK_NUMBER);
454454

455455
/* check the # of cached NAT entries */
456456
if (!f2fs_available_free_memory(sbi, NAT_ENTRIES))

fs/f2fs/super.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
814814
set_opt(sbi, FASTBOOT);
815815
break;
816816
case Opt_extent_cache:
817-
set_opt(sbi, EXTENT_CACHE);
817+
set_opt(sbi, READ_EXTENT_CACHE);
818818
break;
819819
case Opt_noextent_cache:
820-
clear_opt(sbi, EXTENT_CACHE);
820+
clear_opt(sbi, READ_EXTENT_CACHE);
821821
break;
822822
case Opt_noinline_data:
823823
clear_opt(sbi, INLINE_DATA);
@@ -1954,7 +1954,7 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
19541954
seq_puts(seq, ",barrier");
19551955
if (test_opt(sbi, FASTBOOT))
19561956
seq_puts(seq, ",fastboot");
1957-
if (test_opt(sbi, EXTENT_CACHE))
1957+
if (test_opt(sbi, READ_EXTENT_CACHE))
19581958
seq_puts(seq, ",extent_cache");
19591959
else
19601960
seq_puts(seq, ",noextent_cache");
@@ -2076,7 +2076,7 @@ static void default_options(struct f2fs_sb_info *sbi)
20762076
set_opt(sbi, INLINE_XATTR);
20772077
set_opt(sbi, INLINE_DATA);
20782078
set_opt(sbi, INLINE_DENTRY);
2079-
set_opt(sbi, EXTENT_CACHE);
2079+
set_opt(sbi, READ_EXTENT_CACHE);
20802080
set_opt(sbi, NOHEAP);
20812081
clear_opt(sbi, DISABLE_CHECKPOINT);
20822082
set_opt(sbi, MERGE_CHECKPOINT);
@@ -2218,7 +2218,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
22182218
bool need_restart_ckpt = false, need_stop_ckpt = false;
22192219
bool need_restart_flush = false, need_stop_flush = false;
22202220
bool need_restart_discard = false, need_stop_discard = false;
2221-
bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE);
2221+
bool no_read_extent_cache = !test_opt(sbi, READ_EXTENT_CACHE);
22222222
bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT);
22232223
bool no_io_align = !F2FS_IO_ALIGNED(sbi);
22242224
bool no_atgc = !test_opt(sbi, ATGC);
@@ -2308,7 +2308,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
23082308
}
23092309

23102310
/* disallow enable/disable extent_cache dynamically */
2311-
if (no_extent_cache == !!test_opt(sbi, EXTENT_CACHE)) {
2311+
if (no_read_extent_cache == !!test_opt(sbi, READ_EXTENT_CACHE)) {
23122312
err = -EINVAL;
23132313
f2fs_warn(sbi, "switch extent_cache option is not allowed");
23142314
goto restore_opts;

0 commit comments

Comments
 (0)