Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 1 | /* |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 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 |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #include <linux/fs.h> |
| 12 | #include <linux/f2fs_fs.h> |
| 13 | #include <linux/pagemap.h> |
| 14 | #include <linux/sched.h> |
| 15 | #include <linux/ctype.h> |
| 16 | |
| 17 | #include "f2fs.h" |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 18 | #include "node.h" |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 19 | #include "xattr.h" |
| 20 | #include "acl.h" |
| 21 | |
| 22 | static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) |
| 23 | { |
| 24 | struct super_block *sb = dir->i_sb; |
| 25 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 26 | nid_t ino; |
| 27 | struct inode *inode; |
| 28 | bool nid_free = false; |
| 29 | int err; |
| 30 | |
| 31 | inode = new_inode(sb); |
| 32 | if (!inode) |
| 33 | return ERR_PTR(-ENOMEM); |
| 34 | |
| 35 | mutex_lock_op(sbi, NODE_NEW); |
| 36 | if (!alloc_nid(sbi, &ino)) { |
| 37 | mutex_unlock_op(sbi, NODE_NEW); |
| 38 | err = -ENOSPC; |
| 39 | goto fail; |
| 40 | } |
| 41 | mutex_unlock_op(sbi, NODE_NEW); |
| 42 | |
| 43 | inode->i_uid = current_fsuid(); |
| 44 | |
| 45 | if (dir->i_mode & S_ISGID) { |
| 46 | inode->i_gid = dir->i_gid; |
| 47 | if (S_ISDIR(mode)) |
| 48 | mode |= S_ISGID; |
| 49 | } else { |
| 50 | inode->i_gid = current_fsgid(); |
| 51 | } |
| 52 | |
| 53 | inode->i_ino = ino; |
| 54 | inode->i_mode = mode; |
| 55 | inode->i_blocks = 0; |
| 56 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
| 57 | inode->i_generation = sbi->s_next_generation++; |
| 58 | |
| 59 | err = insert_inode_locked(inode); |
| 60 | if (err) { |
| 61 | err = -EINVAL; |
| 62 | nid_free = true; |
| 63 | goto out; |
| 64 | } |
| 65 | |
| 66 | mark_inode_dirty(inode); |
| 67 | return inode; |
| 68 | |
| 69 | out: |
| 70 | clear_nlink(inode); |
| 71 | unlock_new_inode(inode); |
| 72 | fail: |
| 73 | iput(inode); |
| 74 | if (nid_free) |
| 75 | alloc_nid_failed(sbi, ino); |
| 76 | return ERR_PTR(err); |
| 77 | } |
| 78 | |
| 79 | static int is_multimedia_file(const unsigned char *s, const char *sub) |
| 80 | { |
Leon Romanovsky | 9836b8b | 2012-12-27 19:55:46 +0200 | [diff] [blame] | 81 | size_t slen = strlen(s); |
| 82 | size_t sublen = strlen(sub); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 83 | int ret; |
| 84 | |
| 85 | if (sublen > slen) |
| 86 | return 1; |
| 87 | |
| 88 | ret = memcmp(s + slen - sublen, sub, sublen); |
| 89 | if (ret) { /* compare upper case */ |
| 90 | int i; |
| 91 | char upper_sub[8]; |
| 92 | for (i = 0; i < sublen && i < sizeof(upper_sub); i++) |
| 93 | upper_sub[i] = toupper(sub[i]); |
| 94 | return memcmp(s + slen - sublen, upper_sub, sublen); |
| 95 | } |
| 96 | |
| 97 | return ret; |
| 98 | } |
| 99 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 100 | /* |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 101 | * Set multimedia files as cold files for hot/cold data separation |
| 102 | */ |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 103 | static inline void set_cold_files(struct f2fs_sb_info *sbi, struct inode *inode, |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 104 | const unsigned char *name) |
| 105 | { |
| 106 | int i; |
| 107 | __u8 (*extlist)[8] = sbi->raw_super->extension_list; |
| 108 | |
| 109 | int count = le32_to_cpu(sbi->raw_super->extension_count); |
| 110 | for (i = 0; i < count; i++) { |
| 111 | if (!is_multimedia_file(name, extlist[i])) { |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 112 | set_cold_file(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 113 | break; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
| 119 | bool excl) |
| 120 | { |
| 121 | struct super_block *sb = dir->i_sb; |
| 122 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 123 | struct inode *inode; |
| 124 | nid_t ino = 0; |
| 125 | int err; |
| 126 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 127 | f2fs_balance_fs(sbi); |
| 128 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 129 | inode = f2fs_new_inode(dir, mode); |
| 130 | if (IS_ERR(inode)) |
| 131 | return PTR_ERR(inode); |
| 132 | |
| 133 | if (!test_opt(sbi, DISABLE_EXT_IDENTIFY)) |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 134 | set_cold_files(sbi, inode, dentry->d_name.name); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 135 | |
| 136 | inode->i_op = &f2fs_file_inode_operations; |
| 137 | inode->i_fop = &f2fs_file_operations; |
| 138 | inode->i_mapping->a_ops = &f2fs_dblock_aops; |
| 139 | ino = inode->i_ino; |
| 140 | |
| 141 | err = f2fs_add_link(dentry, inode); |
| 142 | if (err) |
| 143 | goto out; |
| 144 | |
| 145 | alloc_nid_done(sbi, ino); |
| 146 | |
| 147 | if (!sbi->por_doing) |
| 148 | d_instantiate(dentry, inode); |
| 149 | unlock_new_inode(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 150 | return 0; |
| 151 | out: |
| 152 | clear_nlink(inode); |
| 153 | unlock_new_inode(inode); |
| 154 | iput(inode); |
| 155 | alloc_nid_failed(sbi, ino); |
| 156 | return err; |
| 157 | } |
| 158 | |
| 159 | static int f2fs_link(struct dentry *old_dentry, struct inode *dir, |
| 160 | struct dentry *dentry) |
| 161 | { |
| 162 | struct inode *inode = old_dentry->d_inode; |
| 163 | struct super_block *sb = dir->i_sb; |
| 164 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 165 | int err; |
| 166 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 167 | f2fs_balance_fs(sbi); |
| 168 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 169 | inode->i_ctime = CURRENT_TIME; |
| 170 | atomic_inc(&inode->i_count); |
| 171 | |
| 172 | set_inode_flag(F2FS_I(inode), FI_INC_LINK); |
| 173 | err = f2fs_add_link(dentry, inode); |
| 174 | if (err) |
| 175 | goto out; |
| 176 | |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 177 | /* |
| 178 | * This file should be checkpointed during fsync. |
| 179 | * We lost i_pino from now on. |
| 180 | */ |
| 181 | set_cp_file(inode); |
| 182 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 183 | d_instantiate(dentry, inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 184 | return 0; |
| 185 | out: |
| 186 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); |
| 187 | iput(inode); |
| 188 | return err; |
| 189 | } |
| 190 | |
| 191 | struct dentry *f2fs_get_parent(struct dentry *child) |
| 192 | { |
| 193 | struct qstr dotdot = QSTR_INIT("..", 2); |
| 194 | unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot); |
| 195 | if (!ino) |
| 196 | return ERR_PTR(-ENOENT); |
| 197 | return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino)); |
| 198 | } |
| 199 | |
| 200 | static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, |
| 201 | unsigned int flags) |
| 202 | { |
| 203 | struct inode *inode = NULL; |
| 204 | struct f2fs_dir_entry *de; |
| 205 | struct page *page; |
| 206 | |
Jaegeuk Kim | 5a20d33 | 2013-03-03 13:58:05 +0900 | [diff] [blame] | 207 | if (dentry->d_name.len > F2FS_NAME_LEN) |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 208 | return ERR_PTR(-ENAMETOOLONG); |
| 209 | |
| 210 | de = f2fs_find_entry(dir, &dentry->d_name, &page); |
| 211 | if (de) { |
| 212 | nid_t ino = le32_to_cpu(de->ino); |
| 213 | kunmap(page); |
| 214 | f2fs_put_page(page, 0); |
| 215 | |
| 216 | inode = f2fs_iget(dir->i_sb, ino); |
| 217 | if (IS_ERR(inode)) |
| 218 | return ERR_CAST(inode); |
| 219 | } |
| 220 | |
| 221 | return d_splice_alias(inode, dentry); |
| 222 | } |
| 223 | |
| 224 | static int f2fs_unlink(struct inode *dir, struct dentry *dentry) |
| 225 | { |
| 226 | struct super_block *sb = dir->i_sb; |
| 227 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 228 | struct inode *inode = dentry->d_inode; |
| 229 | struct f2fs_dir_entry *de; |
| 230 | struct page *page; |
| 231 | int err = -ENOENT; |
| 232 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 233 | f2fs_balance_fs(sbi); |
| 234 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 235 | de = f2fs_find_entry(dir, &dentry->d_name, &page); |
| 236 | if (!de) |
| 237 | goto fail; |
| 238 | |
| 239 | err = check_orphan_space(sbi); |
| 240 | if (err) { |
| 241 | kunmap(page); |
| 242 | f2fs_put_page(page, 0); |
| 243 | goto fail; |
| 244 | } |
| 245 | |
| 246 | f2fs_delete_entry(de, page, inode); |
| 247 | |
| 248 | /* In order to evict this inode, we set it dirty */ |
| 249 | mark_inode_dirty(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 250 | fail: |
| 251 | return err; |
| 252 | } |
| 253 | |
| 254 | static int f2fs_symlink(struct inode *dir, struct dentry *dentry, |
| 255 | const char *symname) |
| 256 | { |
| 257 | struct super_block *sb = dir->i_sb; |
| 258 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 259 | struct inode *inode; |
Leon Romanovsky | 9836b8b | 2012-12-27 19:55:46 +0200 | [diff] [blame] | 260 | size_t symlen = strlen(symname) + 1; |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 261 | int err; |
| 262 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 263 | f2fs_balance_fs(sbi); |
| 264 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 265 | inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
| 266 | if (IS_ERR(inode)) |
| 267 | return PTR_ERR(inode); |
| 268 | |
| 269 | inode->i_op = &f2fs_symlink_inode_operations; |
| 270 | inode->i_mapping->a_ops = &f2fs_dblock_aops; |
| 271 | |
| 272 | err = f2fs_add_link(dentry, inode); |
| 273 | if (err) |
| 274 | goto out; |
| 275 | |
| 276 | err = page_symlink(inode, symname, symlen); |
| 277 | alloc_nid_done(sbi, inode->i_ino); |
| 278 | |
| 279 | d_instantiate(dentry, inode); |
| 280 | unlock_new_inode(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 281 | return err; |
| 282 | out: |
| 283 | clear_nlink(inode); |
| 284 | unlock_new_inode(inode); |
| 285 | iput(inode); |
| 286 | alloc_nid_failed(sbi, inode->i_ino); |
| 287 | return err; |
| 288 | } |
| 289 | |
| 290 | static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
| 291 | { |
| 292 | struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); |
| 293 | struct inode *inode; |
| 294 | int err; |
| 295 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 296 | f2fs_balance_fs(sbi); |
| 297 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 298 | inode = f2fs_new_inode(dir, S_IFDIR | mode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 299 | if (IS_ERR(inode)) |
Namjae Jeon | 61412b6 | 2012-12-01 10:56:25 +0900 | [diff] [blame] | 300 | return PTR_ERR(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 301 | |
| 302 | inode->i_op = &f2fs_dir_inode_operations; |
| 303 | inode->i_fop = &f2fs_dir_operations; |
| 304 | inode->i_mapping->a_ops = &f2fs_dblock_aops; |
Namjae Jeon | a0d4253 | 2012-12-08 14:54:18 +0900 | [diff] [blame] | 305 | mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 306 | |
| 307 | set_inode_flag(F2FS_I(inode), FI_INC_LINK); |
| 308 | err = f2fs_add_link(dentry, inode); |
| 309 | if (err) |
| 310 | goto out_fail; |
| 311 | |
| 312 | alloc_nid_done(sbi, inode->i_ino); |
| 313 | |
| 314 | d_instantiate(dentry, inode); |
| 315 | unlock_new_inode(inode); |
| 316 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 317 | return 0; |
| 318 | |
| 319 | out_fail: |
| 320 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); |
| 321 | clear_nlink(inode); |
| 322 | unlock_new_inode(inode); |
| 323 | iput(inode); |
| 324 | alloc_nid_failed(sbi, inode->i_ino); |
| 325 | return err; |
| 326 | } |
| 327 | |
| 328 | static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) |
| 329 | { |
| 330 | struct inode *inode = dentry->d_inode; |
| 331 | if (f2fs_empty_dir(inode)) |
| 332 | return f2fs_unlink(dir, dentry); |
| 333 | return -ENOTEMPTY; |
| 334 | } |
| 335 | |
| 336 | static int f2fs_mknod(struct inode *dir, struct dentry *dentry, |
| 337 | umode_t mode, dev_t rdev) |
| 338 | { |
| 339 | struct super_block *sb = dir->i_sb; |
| 340 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 341 | struct inode *inode; |
| 342 | int err = 0; |
| 343 | |
| 344 | if (!new_valid_dev(rdev)) |
| 345 | return -EINVAL; |
| 346 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 347 | f2fs_balance_fs(sbi); |
| 348 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 349 | inode = f2fs_new_inode(dir, mode); |
| 350 | if (IS_ERR(inode)) |
| 351 | return PTR_ERR(inode); |
| 352 | |
| 353 | init_special_inode(inode, inode->i_mode, rdev); |
| 354 | inode->i_op = &f2fs_special_inode_operations; |
| 355 | |
| 356 | err = f2fs_add_link(dentry, inode); |
| 357 | if (err) |
| 358 | goto out; |
| 359 | |
| 360 | alloc_nid_done(sbi, inode->i_ino); |
| 361 | d_instantiate(dentry, inode); |
| 362 | unlock_new_inode(inode); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 363 | return 0; |
| 364 | out: |
| 365 | clear_nlink(inode); |
| 366 | unlock_new_inode(inode); |
| 367 | iput(inode); |
| 368 | alloc_nid_failed(sbi, inode->i_ino); |
| 369 | return err; |
| 370 | } |
| 371 | |
| 372 | static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 373 | struct inode *new_dir, struct dentry *new_dentry) |
| 374 | { |
| 375 | struct super_block *sb = old_dir->i_sb; |
| 376 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
| 377 | struct inode *old_inode = old_dentry->d_inode; |
| 378 | struct inode *new_inode = new_dentry->d_inode; |
| 379 | struct page *old_dir_page; |
| 380 | struct page *old_page; |
| 381 | struct f2fs_dir_entry *old_dir_entry = NULL; |
| 382 | struct f2fs_dir_entry *old_entry; |
| 383 | struct f2fs_dir_entry *new_entry; |
| 384 | int err = -ENOENT; |
| 385 | |
Jaegeuk Kim | 1efef83 | 2012-12-19 16:25:21 +0900 | [diff] [blame] | 386 | f2fs_balance_fs(sbi); |
| 387 | |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 388 | old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
| 389 | if (!old_entry) |
| 390 | goto out; |
| 391 | |
| 392 | if (S_ISDIR(old_inode->i_mode)) { |
| 393 | err = -EIO; |
| 394 | old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page); |
| 395 | if (!old_dir_entry) |
| 396 | goto out_old; |
| 397 | } |
| 398 | |
| 399 | mutex_lock_op(sbi, RENAME); |
| 400 | |
| 401 | if (new_inode) { |
| 402 | struct page *new_page; |
| 403 | |
| 404 | err = -ENOTEMPTY; |
| 405 | if (old_dir_entry && !f2fs_empty_dir(new_inode)) |
| 406 | goto out_dir; |
| 407 | |
| 408 | err = -ENOENT; |
| 409 | new_entry = f2fs_find_entry(new_dir, &new_dentry->d_name, |
| 410 | &new_page); |
| 411 | if (!new_entry) |
| 412 | goto out_dir; |
| 413 | |
| 414 | f2fs_set_link(new_dir, new_entry, new_page, old_inode); |
| 415 | |
| 416 | new_inode->i_ctime = CURRENT_TIME; |
| 417 | if (old_dir_entry) |
| 418 | drop_nlink(new_inode); |
| 419 | drop_nlink(new_inode); |
| 420 | if (!new_inode->i_nlink) |
| 421 | add_orphan_inode(sbi, new_inode->i_ino); |
| 422 | f2fs_write_inode(new_inode, NULL); |
| 423 | } else { |
| 424 | err = f2fs_add_link(new_dentry, old_inode); |
| 425 | if (err) |
| 426 | goto out_dir; |
| 427 | |
| 428 | if (old_dir_entry) { |
| 429 | inc_nlink(new_dir); |
| 430 | f2fs_write_inode(new_dir, NULL); |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | old_inode->i_ctime = CURRENT_TIME; |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 435 | mark_inode_dirty(old_inode); |
| 436 | |
| 437 | f2fs_delete_entry(old_entry, old_page, NULL); |
| 438 | |
| 439 | if (old_dir_entry) { |
| 440 | if (old_dir != new_dir) { |
| 441 | f2fs_set_link(old_inode, old_dir_entry, |
| 442 | old_dir_page, new_dir); |
| 443 | } else { |
| 444 | kunmap(old_dir_page); |
| 445 | f2fs_put_page(old_dir_page, 0); |
| 446 | } |
| 447 | drop_nlink(old_dir); |
| 448 | f2fs_write_inode(old_dir, NULL); |
| 449 | } |
| 450 | |
| 451 | mutex_unlock_op(sbi, RENAME); |
Jaegeuk Kim | 57397d8 | 2012-11-02 17:11:10 +0900 | [diff] [blame] | 452 | return 0; |
| 453 | |
| 454 | out_dir: |
| 455 | if (old_dir_entry) { |
| 456 | kunmap(old_dir_page); |
| 457 | f2fs_put_page(old_dir_page, 0); |
| 458 | } |
| 459 | mutex_unlock_op(sbi, RENAME); |
| 460 | out_old: |
| 461 | kunmap(old_page); |
| 462 | f2fs_put_page(old_page, 0); |
| 463 | out: |
| 464 | return err; |
| 465 | } |
| 466 | |
| 467 | const struct inode_operations f2fs_dir_inode_operations = { |
| 468 | .create = f2fs_create, |
| 469 | .lookup = f2fs_lookup, |
| 470 | .link = f2fs_link, |
| 471 | .unlink = f2fs_unlink, |
| 472 | .symlink = f2fs_symlink, |
| 473 | .mkdir = f2fs_mkdir, |
| 474 | .rmdir = f2fs_rmdir, |
| 475 | .mknod = f2fs_mknod, |
| 476 | .rename = f2fs_rename, |
| 477 | .setattr = f2fs_setattr, |
| 478 | .get_acl = f2fs_get_acl, |
| 479 | #ifdef CONFIG_F2FS_FS_XATTR |
| 480 | .setxattr = generic_setxattr, |
| 481 | .getxattr = generic_getxattr, |
| 482 | .listxattr = f2fs_listxattr, |
| 483 | .removexattr = generic_removexattr, |
| 484 | #endif |
| 485 | }; |
| 486 | |
| 487 | const struct inode_operations f2fs_symlink_inode_operations = { |
| 488 | .readlink = generic_readlink, |
| 489 | .follow_link = page_follow_link_light, |
| 490 | .put_link = page_put_link, |
| 491 | .setattr = f2fs_setattr, |
| 492 | #ifdef CONFIG_F2FS_FS_XATTR |
| 493 | .setxattr = generic_setxattr, |
| 494 | .getxattr = generic_getxattr, |
| 495 | .listxattr = f2fs_listxattr, |
| 496 | .removexattr = generic_removexattr, |
| 497 | #endif |
| 498 | }; |
| 499 | |
| 500 | const struct inode_operations f2fs_special_inode_operations = { |
| 501 | .setattr = f2fs_setattr, |
| 502 | .get_acl = f2fs_get_acl, |
| 503 | #ifdef CONFIG_F2FS_FS_XATTR |
| 504 | .setxattr = generic_setxattr, |
| 505 | .getxattr = generic_getxattr, |
| 506 | .listxattr = f2fs_listxattr, |
| 507 | .removexattr = generic_removexattr, |
| 508 | #endif |
| 509 | }; |