namei.c (bdbc90fa55af632f8a883a3d93c54a08708ed80a) | namei.c (846ae671ad368e344a2b141c0f19e1014b27a0dd) |
---|---|
1/* 2 * fs/f2fs/namei.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 157 unchanged lines hidden (view full) --- 166} 167 168/* 169 * Set multimedia files as cold files for hot/cold data separation 170 */ 171static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode, 172 const unsigned char *name) 173{ | 1/* 2 * fs/f2fs/namei.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 157 unchanged lines hidden (view full) --- 166} 167 168/* 169 * Set multimedia files as cold files for hot/cold data separation 170 */ 171static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode, 172 const unsigned char *name) 173{ |
174 int i; 175 __u8 (*extlist)[8] = sbi->raw_super->extension_list; | 174 __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; 175 int i, count; |
176 | 176 |
177 int count = le32_to_cpu(sbi->raw_super->extension_count); | 177 down_read(&sbi->sb_lock); 178 179 count = le32_to_cpu(sbi->raw_super->extension_count); 180 |
178 for (i = 0; i < count; i++) { 179 if (is_multimedia_file(name, extlist[i])) { 180 file_set_cold(inode); 181 break; 182 } 183 } | 181 for (i = 0; i < count; i++) { 182 if (is_multimedia_file(name, extlist[i])) { 183 file_set_cold(inode); 184 break; 185 } 186 } |
187 188 up_read(&sbi->sb_lock); |
|
184} 185 | 189} 190 |
191int update_extension_list(struct f2fs_sb_info *sbi, const char *name, bool set) 192{ 193 __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; 194 int count = le32_to_cpu(sbi->raw_super->extension_count); 195 int i; 196 197 for (i = 0; i < count; i++) { 198 if (strcmp(name, extlist[i])) 199 continue; 200 201 if (set) 202 return -EINVAL; 203 204 memcpy(extlist[i], extlist[i + 1], 205 F2FS_EXTENSION_LEN * (count - i - 1)); 206 memset(extlist[count - 1], 0, F2FS_EXTENSION_LEN); 207 sbi->raw_super->extension_count = cpu_to_le32(count - 1); 208 return 0; 209 } 210 211 if (!set) 212 return -EINVAL; 213 214 if (count == F2FS_MAX_EXTENSION) 215 return -EINVAL; 216 217 strncpy(extlist[count], name, strlen(name)); 218 sbi->raw_super->extension_count = cpu_to_le32(count + 1); 219 return 0; 220} 221 |
|
186static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, 187 bool excl) 188{ 189 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 190 struct inode *inode; 191 nid_t ino = 0; 192 int err; 193 --- 970 unchanged lines hidden --- | 222static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, 223 bool excl) 224{ 225 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 226 struct inode *inode; 227 nid_t ino = 0; 228 int err; 229 --- 970 unchanged lines hidden --- |