Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186113
b: refs/heads/master
c: 907f455
h: refs/heads/master
i:
  186111: d2f318f
v: v3
  • Loading branch information
Christoph Hellwig authored and Jan Kara committed Mar 4, 2010
1 parent 55621e5 commit 260d171
Show file tree
Hide file tree
Showing 33 changed files with 221 additions and 57 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f7547580263d4a55efe06ce5cfd567f568be6e8
refs/heads/master: 907f4554e2521cb28b0009d17167760650a9561c
4 changes: 2 additions & 2 deletions trunk/fs/ext2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const struct file_operations ext2_file_operations = {
.compat_ioctl = ext2_compat_ioctl,
#endif
.mmap = generic_file_mmap,
.open = generic_file_open,
.open = dquot_file_open,
.release = ext2_release_file,
.fsync = ext2_fsync,
.splice_read = generic_file_splice_read,
Expand All @@ -87,7 +87,7 @@ const struct file_operations ext2_xip_file_operations = {
.compat_ioctl = ext2_compat_ioctl,
#endif
.mmap = xip_file_mmap,
.open = generic_file_open,
.open = dquot_file_open,
.release = ext2_release_file,
.fsync = ext2_fsync,
};
Expand Down
5 changes: 5 additions & 0 deletions trunk/fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode)
*/
void ext2_delete_inode (struct inode * inode)
{
if (!is_bad_inode(inode))
vfs_dq_init(inode);
truncate_inode_pages(&inode->i_data, 0);

if (is_bad_inode(inode))
Expand Down Expand Up @@ -1457,6 +1459,9 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
error = inode_change_ok(inode, iattr);
if (error)
return error;

if (iattr->ia_valid & ATTR_SIZE)
vfs_dq_init(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
error = dquot_transfer(inode, iattr);
Expand Down
51 changes: 34 additions & 17 deletions trunk/fs/ext2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/

#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include "ext2.h"
#include "xattr.h"
#include "acl.h"
Expand Down Expand Up @@ -99,24 +100,27 @@ struct dentry *ext2_get_parent(struct dentry *child)
*/
static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd)
{
struct inode * inode = ext2_new_inode (dir, mode);
int err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
inode->i_op = &ext2_file_inode_operations;
if (ext2_use_xip(inode->i_sb)) {
inode->i_mapping->a_ops = &ext2_aops_xip;
inode->i_fop = &ext2_xip_file_operations;
} else if (test_opt(inode->i_sb, NOBH)) {
inode->i_mapping->a_ops = &ext2_nobh_aops;
inode->i_fop = &ext2_file_operations;
} else {
inode->i_mapping->a_ops = &ext2_aops;
inode->i_fop = &ext2_file_operations;
}
mark_inode_dirty(inode);
err = ext2_add_nondir(dentry, inode);
struct inode *inode;

vfs_dq_init(dir);

inode = ext2_new_inode(dir, mode);
if (IS_ERR(inode))
return PTR_ERR(inode);

inode->i_op = &ext2_file_inode_operations;
if (ext2_use_xip(inode->i_sb)) {
inode->i_mapping->a_ops = &ext2_aops_xip;
inode->i_fop = &ext2_xip_file_operations;
} else if (test_opt(inode->i_sb, NOBH)) {
inode->i_mapping->a_ops = &ext2_nobh_aops;
inode->i_fop = &ext2_file_operations;
} else {
inode->i_mapping->a_ops = &ext2_aops;
inode->i_fop = &ext2_file_operations;
}
return err;
mark_inode_dirty(inode);
return ext2_add_nondir(dentry, inode);
}

static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
Expand All @@ -127,6 +131,8 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_
if (!new_valid_dev(rdev))
return -EINVAL;

vfs_dq_init(dir);

inode = ext2_new_inode (dir, mode);
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
Expand All @@ -151,6 +157,8 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
if (l > sb->s_blocksize)
goto out;

vfs_dq_init(dir);

inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO);
err = PTR_ERR(inode);
if (IS_ERR(inode))
Expand Down Expand Up @@ -194,6 +202,8 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
if (inode->i_nlink >= EXT2_LINK_MAX)
return -EMLINK;

vfs_dq_init(dir);

inode->i_ctime = CURRENT_TIME_SEC;
inode_inc_link_count(inode);
atomic_inc(&inode->i_count);
Expand All @@ -216,6 +226,8 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
if (dir->i_nlink >= EXT2_LINK_MAX)
goto out;

vfs_dq_init(dir);

inode_inc_link_count(dir);

inode = ext2_new_inode (dir, S_IFDIR | mode);
Expand Down Expand Up @@ -262,6 +274,8 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
struct page * page;
int err = -ENOENT;

vfs_dq_init(dir);

de = ext2_find_entry (dir, &dentry->d_name, &page);
if (!de)
goto out;
Expand Down Expand Up @@ -304,6 +318,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
struct ext2_dir_entry_2 * old_de;
int err = -ENOENT;

vfs_dq_init(old_dir);
vfs_dq_init(new_dir);

old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page);
if (!old_de)
goto out;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const struct file_operations ext3_file_operations = {
.compat_ioctl = ext3_compat_ioctl,
#endif
.mmap = generic_file_mmap,
.open = generic_file_open,
.open = dquot_file_open,
.release = ext3_release_file,
.fsync = ext3_sync_file,
.splice_read = generic_file_splice_read,
Expand Down
5 changes: 5 additions & 0 deletions trunk/fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ void ext3_delete_inode (struct inode * inode)
{
handle_t *handle;

if (!is_bad_inode(inode))
vfs_dq_init(inode);

truncate_inode_pages(&inode->i_data, 0);

if (is_bad_inode(inode))
Expand Down Expand Up @@ -3148,6 +3151,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
if (error)
return error;

if (ia_valid & ATTR_SIZE)
vfs_dq_init(inode);
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
handle_t *handle;
Expand Down
18 changes: 18 additions & 0 deletions trunk/fs/ext3/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,8 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
struct inode * inode;
int err, retries = 0;

vfs_dq_init(dir);

retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -1730,6 +1732,8 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
if (!new_valid_dev(rdev))
return -EINVAL;

vfs_dq_init(dir);

retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -1766,6 +1770,8 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
if (dir->i_nlink >= EXT3_LINK_MAX)
return -EMLINK;

vfs_dq_init(dir);

retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -2060,7 +2066,9 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)

/* Initialize quotas before so that eventual writes go in
* separate transaction */
vfs_dq_init(dir);
vfs_dq_init(dentry->d_inode);

handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
return PTR_ERR(handle);
Expand Down Expand Up @@ -2119,7 +2127,9 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)

/* Initialize quotas before so that eventual writes go
* in separate transaction */
vfs_dq_init(dir);
vfs_dq_init(dentry->d_inode);

handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
return PTR_ERR(handle);
Expand Down Expand Up @@ -2174,6 +2184,8 @@ static int ext3_symlink (struct inode * dir,
if (l > dir->i_sb->s_blocksize)
return -ENAMETOOLONG;

vfs_dq_init(dir);

retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 +
Expand Down Expand Up @@ -2228,6 +2240,9 @@ static int ext3_link (struct dentry * old_dentry,

if (inode->i_nlink >= EXT3_LINK_MAX)
return -EMLINK;

vfs_dq_init(dir);

/*
* Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
* otherwise has the potential to corrupt the orphan inode list.
Expand Down Expand Up @@ -2278,6 +2293,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
struct ext3_dir_entry_2 * old_de, * new_de;
int retval, flush_file = 0;

vfs_dq_init(old_dir);
vfs_dq_init(new_dir);

old_bh = new_bh = dir_bh = NULL;

/* Initialize quotas before so that eventual writes go
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
sb->s_dirt = 1;
}
}
return generic_file_open(inode, filp);
return dquot_file_open(inode, filp);
}

const struct file_operations ext4_file_operations = {
Expand Down
5 changes: 5 additions & 0 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ void ext4_delete_inode(struct inode *inode)
handle_t *handle;
int err;

if (!is_bad_inode(inode))
vfs_dq_init(inode);

if (ext4_should_order_data(inode))
ext4_begin_ordered_truncate(inode, 0);
truncate_inode_pages(&inode->i_data, 0);
Expand Down Expand Up @@ -5251,6 +5254,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
if (error)
return error;

if (ia_valid & ATTR_SIZE)
vfs_dq_init(inode);
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
handle_t *handle;
Expand Down
17 changes: 17 additions & 0 deletions trunk/fs/ext4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,8 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, int mode,
struct inode *inode;
int err, retries = 0;

vfs_dq_init(dir);

retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -1800,6 +1802,8 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
if (!new_valid_dev(rdev))
return -EINVAL;

vfs_dq_init(dir);

retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -1837,6 +1841,8 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if (EXT4_DIR_LINK_MAX(dir))
return -EMLINK;

vfs_dq_init(dir);

retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
Expand Down Expand Up @@ -2136,7 +2142,9 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)

/* Initialize quotas before so that eventual writes go in
* separate transaction */
vfs_dq_init(dir);
vfs_dq_init(dentry->d_inode);

handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
return PTR_ERR(handle);
Expand Down Expand Up @@ -2195,7 +2203,9 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)

/* Initialize quotas before so that eventual writes go
* in separate transaction */
vfs_dq_init(dir);
vfs_dq_init(dentry->d_inode);

handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
return PTR_ERR(handle);
Expand Down Expand Up @@ -2250,6 +2260,8 @@ static int ext4_symlink(struct inode *dir,
if (l > dir->i_sb->s_blocksize)
return -ENAMETOOLONG;

vfs_dq_init(dir);

retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 5 +
Expand Down Expand Up @@ -2308,6 +2320,8 @@ static int ext4_link(struct dentry *old_dentry,
if (inode->i_nlink >= EXT4_LINK_MAX)
return -EMLINK;

vfs_dq_init(dir);

/*
* Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
* otherwise has the potential to corrupt the orphan inode list.
Expand Down Expand Up @@ -2358,6 +2372,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
struct ext4_dir_entry_2 *old_de, *new_de;
int retval, force_da_alloc = 0;

vfs_dq_init(old_dir);
vfs_dq_init(new_dir);

old_bh = new_bh = dir_bh = NULL;

/* Initialize quotas before so that eventual writes go
Expand Down
3 changes: 0 additions & 3 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <linux/mm.h>
#include <linux/dcache.h>
#include <linux/init.h>
#include <linux/quotaops.h>
#include <linux/slab.h>
#include <linux/writeback.h>
#include <linux/module.h>
Expand Down Expand Up @@ -1210,8 +1209,6 @@ void generic_delete_inode(struct inode *inode)

if (op->delete_inode) {
void (*delete)(struct inode *) = op->delete_inode;
if (!is_bad_inode(inode))
vfs_dq_init(inode);
/* Filesystems implementing their own
* s_op->delete_inode are required to call
* truncate_inode_pages and clear_inode()
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/jfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static int jfs_open(struct inode *inode, struct file *file)
{
int rc;

if ((rc = generic_file_open(inode, file)))
if ((rc = dquot_file_open(inode, file)))
return rc;

/*
Expand Down Expand Up @@ -98,6 +98,8 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
if (rc)
return rc;

if (iattr->ia_valid & ATTR_SIZE)
vfs_dq_init(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
rc = dquot_transfer(inode, iattr);
Expand Down
Loading

0 comments on commit 260d171

Please sign in to comment.