diff options
Diffstat (limited to 'fs/hugetlbfs/inode.c')
| -rw-r--r-- | fs/hugetlbfs/inode.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a4e9a7ec3691..6e5bd42f3860 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
| @@ -371,27 +371,10 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
| 371 | hugetlb_unreserve_pages(inode, start, freed); | 371 | hugetlb_unreserve_pages(inode, start, freed); |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | static void hugetlbfs_delete_inode(struct inode *inode) | 374 | static void hugetlbfs_evict_inode(struct inode *inode) |
| 375 | { | 375 | { |
| 376 | truncate_hugepages(inode, 0); | 376 | truncate_hugepages(inode, 0); |
| 377 | clear_inode(inode); | 377 | end_writeback(inode); |
| 378 | } | ||
| 379 | |||
| 380 | static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock) | ||
| 381 | { | ||
| 382 | if (generic_detach_inode(inode)) { | ||
| 383 | truncate_hugepages(inode, 0); | ||
| 384 | clear_inode(inode); | ||
| 385 | destroy_inode(inode); | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | static void hugetlbfs_drop_inode(struct inode *inode) | ||
| 390 | { | ||
| 391 | if (!inode->i_nlink) | ||
| 392 | generic_delete_inode(inode); | ||
| 393 | else | ||
| 394 | hugetlbfs_forget_inode(inode); | ||
| 395 | } | 378 | } |
| 396 | 379 | ||
| 397 | static inline void | 380 | static inline void |
| @@ -448,19 +431,20 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 448 | 431 | ||
| 449 | error = inode_change_ok(inode, attr); | 432 | error = inode_change_ok(inode, attr); |
| 450 | if (error) | 433 | if (error) |
| 451 | goto out; | 434 | return error; |
| 452 | 435 | ||
| 453 | if (ia_valid & ATTR_SIZE) { | 436 | if (ia_valid & ATTR_SIZE) { |
| 454 | error = -EINVAL; | 437 | error = -EINVAL; |
| 455 | if (!(attr->ia_size & ~huge_page_mask(h))) | 438 | if (attr->ia_size & ~huge_page_mask(h)) |
| 456 | error = hugetlb_vmtruncate(inode, attr->ia_size); | 439 | return -EINVAL; |
| 440 | error = hugetlb_vmtruncate(inode, attr->ia_size); | ||
| 457 | if (error) | 441 | if (error) |
| 458 | goto out; | 442 | return error; |
| 459 | attr->ia_valid &= ~ATTR_SIZE; | ||
| 460 | } | 443 | } |
| 461 | error = inode_setattr(inode, attr); | 444 | |
| 462 | out: | 445 | setattr_copy(inode, attr); |
| 463 | return error; | 446 | mark_inode_dirty(inode); |
| 447 | return 0; | ||
| 464 | } | 448 | } |
| 465 | 449 | ||
| 466 | static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | 450 | static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, |
| @@ -712,9 +696,8 @@ static const struct inode_operations hugetlbfs_inode_operations = { | |||
| 712 | static const struct super_operations hugetlbfs_ops = { | 696 | static const struct super_operations hugetlbfs_ops = { |
| 713 | .alloc_inode = hugetlbfs_alloc_inode, | 697 | .alloc_inode = hugetlbfs_alloc_inode, |
| 714 | .destroy_inode = hugetlbfs_destroy_inode, | 698 | .destroy_inode = hugetlbfs_destroy_inode, |
| 699 | .evict_inode = hugetlbfs_evict_inode, | ||
| 715 | .statfs = hugetlbfs_statfs, | 700 | .statfs = hugetlbfs_statfs, |
| 716 | .delete_inode = hugetlbfs_delete_inode, | ||
| 717 | .drop_inode = hugetlbfs_drop_inode, | ||
| 718 | .put_super = hugetlbfs_put_super, | 701 | .put_super = hugetlbfs_put_super, |
| 719 | .show_options = generic_show_options, | 702 | .show_options = generic_show_options, |
| 720 | }; | 703 | }; |
