Skip to content

Commit e66509f

Browse files
Namjae JeonJaegeuk Kim
authored andcommitted
f2fs: make is_multimedia_file code align with its name
The code conditions put inside the function is_multimedia_file are reverse to the name i.e, we need to negate the return to actually check if the file is a multimedia file. So, change the code and usage path to align both the name and comparision conditions. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
1 parent 66348b7 commit e66509f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/f2fs/namei.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ static int is_multimedia_file(const unsigned char *s, const char *sub)
8383
int ret;
8484

8585
if (sublen > slen)
86-
return 1;
86+
return 0;
8787

8888
ret = memcmp(s + slen - sublen, sub, sublen);
8989
if (ret) { /* compare upper case */
9090
int i;
9191
char upper_sub[8];
9292
for (i = 0; i < sublen && i < sizeof(upper_sub); i++)
9393
upper_sub[i] = toupper(sub[i]);
94-
return memcmp(s + slen - sublen, upper_sub, sublen);
94+
return !memcmp(s + slen - sublen, upper_sub, sublen);
9595
}
9696

97-
return ret;
97+
return !ret;
9898
}
9999

100100
/*
@@ -108,7 +108,7 @@ static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode,
108108

109109
int count = le32_to_cpu(sbi->raw_super->extension_count);
110110
for (i = 0; i < count; i++) {
111-
if (!is_multimedia_file(name, extlist[i])) {
111+
if (is_multimedia_file(name, extlist[i])) {
112112
set_cold_file(inode);
113113
break;
114114
}

0 commit comments

Comments
 (0)