Commit e66509f0 authored by Namjae Jeon's avatar Namjae Jeon Committed by Jaegeuk Kim

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: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 66348b72
...@@ -83,7 +83,7 @@ static int is_multimedia_file(const unsigned char *s, const char *sub) ...@@ -83,7 +83,7 @@ static int is_multimedia_file(const unsigned char *s, const char *sub)
int ret; int ret;
if (sublen > slen) if (sublen > slen)
return 1; return 0;
ret = memcmp(s + slen - sublen, sub, sublen); ret = memcmp(s + slen - sublen, sub, sublen);
if (ret) { /* compare upper case */ if (ret) { /* compare upper case */
...@@ -91,10 +91,10 @@ static int is_multimedia_file(const unsigned char *s, const char *sub) ...@@ -91,10 +91,10 @@ static int is_multimedia_file(const unsigned char *s, const char *sub)
char upper_sub[8]; char upper_sub[8];
for (i = 0; i < sublen && i < sizeof(upper_sub); i++) for (i = 0; i < sublen && i < sizeof(upper_sub); i++)
upper_sub[i] = toupper(sub[i]); upper_sub[i] = toupper(sub[i]);
return memcmp(s + slen - sublen, upper_sub, sublen); return !memcmp(s + slen - sublen, upper_sub, sublen);
} }
return ret; return !ret;
} }
/* /*
...@@ -108,7 +108,7 @@ static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode, ...@@ -108,7 +108,7 @@ static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode,
int count = le32_to_cpu(sbi->raw_super->extension_count); int count = le32_to_cpu(sbi->raw_super->extension_count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (!is_multimedia_file(name, extlist[i])) { if (is_multimedia_file(name, extlist[i])) {
set_cold_file(inode); set_cold_file(inode);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment