Skip to content

Commit c31e496

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix compile warning in f2fs_destroy_node_manager()
fs/f2fs/node.c: In function ‘f2fs_destroy_node_manager’: fs/f2fs/node.c:3390:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] 3390 | } Merging below pointer arrays into common one, and reuse it by cast type. struct nat_entry *natvec[NATVEC_SIZE]; struct nat_entry_set *setvec[SETVEC_SIZE]; Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 0135c48 commit c31e496

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

fs/f2fs/node.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,7 +3062,7 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
30623062
struct f2fs_nm_info *nm_i = NM_I(sbi);
30633063
struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
30643064
struct f2fs_journal *journal = curseg->journal;
3065-
struct nat_entry_set *setvec[SETVEC_SIZE];
3065+
struct nat_entry_set *setvec[NAT_VEC_SIZE];
30663066
struct nat_entry_set *set, *tmp;
30673067
unsigned int found;
30683068
nid_t set_idx = 0;
@@ -3095,7 +3095,7 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
30953095
remove_nats_in_journal(sbi);
30963096

30973097
while ((found = __gang_lookup_nat_set(nm_i,
3098-
set_idx, SETVEC_SIZE, setvec))) {
3098+
set_idx, NAT_VEC_SIZE, setvec))) {
30993099
unsigned idx;
31003100

31013101
set_idx = setvec[found - 1]->set + 1;
@@ -3316,8 +3316,9 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi)
33163316
{
33173317
struct f2fs_nm_info *nm_i = NM_I(sbi);
33183318
struct free_nid *i, *next_i;
3319-
struct nat_entry *natvec[NATVEC_SIZE];
3320-
struct nat_entry_set *setvec[SETVEC_SIZE];
3319+
void *vec[NAT_VEC_SIZE];
3320+
struct nat_entry **natvec = (struct nat_entry **)vec;
3321+
struct nat_entry_set **setvec = (struct nat_entry_set **)vec;
33213322
nid_t nid = 0;
33223323
unsigned int found;
33233324

@@ -3340,7 +3341,7 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi)
33403341
/* destroy nat cache */
33413342
f2fs_down_write(&nm_i->nat_tree_lock);
33423343
while ((found = __gang_lookup_nat_cache(nm_i,
3343-
nid, NATVEC_SIZE, natvec))) {
3344+
nid, NAT_VEC_SIZE, natvec))) {
33443345
unsigned idx;
33453346

33463347
nid = nat_get_nid(natvec[found - 1]) + 1;
@@ -3356,8 +3357,9 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi)
33563357

33573358
/* destroy nat set cache */
33583359
nid = 0;
3360+
memset(vec, 0, sizeof(void *) * NAT_VEC_SIZE);
33593361
while ((found = __gang_lookup_nat_set(nm_i,
3360-
nid, SETVEC_SIZE, setvec))) {
3362+
nid, NAT_VEC_SIZE, setvec))) {
33613363
unsigned idx;
33623364

33633365
nid = setvec[found - 1]->set + 1;

fs/f2fs/node.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
#define DEF_RF_NODE_BLOCKS 0
3636

3737
/* vector size for gang look-up from nat cache that consists of radix tree */
38-
#define NATVEC_SIZE 64
39-
#define SETVEC_SIZE 32
38+
#define NAT_VEC_SIZE 32
4039

4140
/* return value for read_node_page */
4241
#define LOCKED_PAGE 1

0 commit comments

Comments
 (0)