diff options
Diffstat (limited to 'fs/ext2/inode.c')
| -rw-r--r-- | fs/ext2/inode.c | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 71b032c65a02..fc13cc119aad 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
| @@ -41,6 +41,8 @@ MODULE_AUTHOR("Remy Card and others"); | |||
| 41 | MODULE_DESCRIPTION("Second Extended Filesystem"); | 41 | MODULE_DESCRIPTION("Second Extended Filesystem"); | 
| 42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); | 
| 43 | 43 | ||
| 44 | static int __ext2_write_inode(struct inode *inode, int do_sync); | ||
| 45 | |||
| 44 | /* | 46 | /* | 
| 45 | * Test whether an inode is a fast symlink. | 47 | * Test whether an inode is a fast symlink. | 
| 46 | */ | 48 | */ | 
| @@ -58,13 +60,15 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode) | |||
| 58 | */ | 60 | */ | 
| 59 | void ext2_delete_inode (struct inode * inode) | 61 | void ext2_delete_inode (struct inode * inode) | 
| 60 | { | 62 | { | 
| 63 | if (!is_bad_inode(inode)) | ||
| 64 | dquot_initialize(inode); | ||
| 61 | truncate_inode_pages(&inode->i_data, 0); | 65 | truncate_inode_pages(&inode->i_data, 0); | 
| 62 | 66 | ||
| 63 | if (is_bad_inode(inode)) | 67 | if (is_bad_inode(inode)) | 
| 64 | goto no_delete; | 68 | goto no_delete; | 
| 65 | EXT2_I(inode)->i_dtime = get_seconds(); | 69 | EXT2_I(inode)->i_dtime = get_seconds(); | 
| 66 | mark_inode_dirty(inode); | 70 | mark_inode_dirty(inode); | 
| 67 | ext2_write_inode(inode, inode_needs_sync(inode)); | 71 | __ext2_write_inode(inode, inode_needs_sync(inode)); | 
| 68 | 72 | ||
| 69 | inode->i_size = 0; | 73 | inode->i_size = 0; | 
| 70 | if (inode->i_blocks) | 74 | if (inode->i_blocks) | 
| @@ -1335,7 +1339,7 @@ bad_inode: | |||
| 1335 | return ERR_PTR(ret); | 1339 | return ERR_PTR(ret); | 
| 1336 | } | 1340 | } | 
| 1337 | 1341 | ||
| 1338 | int ext2_write_inode(struct inode *inode, int do_sync) | 1342 | static int __ext2_write_inode(struct inode *inode, int do_sync) | 
| 1339 | { | 1343 | { | 
| 1340 | struct ext2_inode_info *ei = EXT2_I(inode); | 1344 | struct ext2_inode_info *ei = EXT2_I(inode); | 
| 1341 | struct super_block *sb = inode->i_sb; | 1345 | struct super_block *sb = inode->i_sb; | 
| @@ -1440,6 +1444,11 @@ int ext2_write_inode(struct inode *inode, int do_sync) | |||
| 1440 | return err; | 1444 | return err; | 
| 1441 | } | 1445 | } | 
| 1442 | 1446 | ||
| 1447 | int ext2_write_inode(struct inode *inode, struct writeback_control *wbc) | ||
| 1448 | { | ||
| 1449 | return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL); | ||
| 1450 | } | ||
| 1451 | |||
| 1443 | int ext2_sync_inode(struct inode *inode) | 1452 | int ext2_sync_inode(struct inode *inode) | 
| 1444 | { | 1453 | { | 
| 1445 | struct writeback_control wbc = { | 1454 | struct writeback_control wbc = { | 
| @@ -1457,9 +1466,12 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1457 | error = inode_change_ok(inode, iattr); | 1466 | error = inode_change_ok(inode, iattr); | 
| 1458 | if (error) | 1467 | if (error) | 
| 1459 | return error; | 1468 | return error; | 
| 1469 | |||
| 1470 | if (iattr->ia_valid & ATTR_SIZE) | ||
| 1471 | dquot_initialize(inode); | ||
| 1460 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 1472 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 
| 1461 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 1473 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 
| 1462 | error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0; | 1474 | error = dquot_transfer(inode, iattr); | 
| 1463 | if (error) | 1475 | if (error) | 
| 1464 | return error; | 1476 | return error; | 
| 1465 | } | 1477 | } | 
