aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 17:48:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 17:48:34 -0400
commit2c9e15a011c55ff96b2b8d2b126d1b9a96abba20 (patch)
tree6d9b27a07f88ad4509dcd86aa74a2cdecd0d5f4b /fs/ext4/super.c
parent805de022b100bcf796860fe88d7db4164066d1c3 (diff)
parentc16831b4cc9b0805adf8ca3001752a7ec10a17bf (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6: (27 commits) ext2: Zero our b_size in ext2_quota_read() trivial: fix typos/grammar errors in fs/Kconfig quota: Coding style fixes quota: Remove superfluous inlines quota: Remove uppercase aliases for quota functions. nfsd: Use lowercase names of quota functions jfs: Use lowercase names of quota functions udf: Use lowercase names of quota functions ufs: Use lowercase names of quota functions reiserfs: Use lowercase names of quota functions ext4: Use lowercase names of quota functions ext3: Use lowercase names of quota functions ext2: Use lowercase names of quota functions ramfs: Remove quota call vfs: Use lowercase names of quota functions quota: Remove dqbuf_t and other cleanups quota: Remove NODQUOT macro quota: Make global quota locks cacheline aligned quota: Move quota files into separate directory ext4: quota reservation for delayed allocation ...
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c54
1 files changed, 9 insertions, 45 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 39d1993cfa13..f7371a6a923d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -926,8 +926,6 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page, gfp_
926#define QTYPE2NAME(t) ((t) == USRQUOTA ? "user" : "group") 926#define QTYPE2NAME(t) ((t) == USRQUOTA ? "user" : "group")
927#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) 927#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
928 928
929static int ext4_dquot_initialize(struct inode *inode, int type);
930static int ext4_dquot_drop(struct inode *inode);
931static int ext4_write_dquot(struct dquot *dquot); 929static int ext4_write_dquot(struct dquot *dquot);
932static int ext4_acquire_dquot(struct dquot *dquot); 930static int ext4_acquire_dquot(struct dquot *dquot);
933static int ext4_release_dquot(struct dquot *dquot); 931static int ext4_release_dquot(struct dquot *dquot);
@@ -942,9 +940,13 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
942 const char *data, size_t len, loff_t off); 940 const char *data, size_t len, loff_t off);
943 941
944static struct dquot_operations ext4_quota_operations = { 942static struct dquot_operations ext4_quota_operations = {
945 .initialize = ext4_dquot_initialize, 943 .initialize = dquot_initialize,
946 .drop = ext4_dquot_drop, 944 .drop = dquot_drop,
947 .alloc_space = dquot_alloc_space, 945 .alloc_space = dquot_alloc_space,
946 .reserve_space = dquot_reserve_space,
947 .claim_space = dquot_claim_space,
948 .release_rsv = dquot_release_reserved_space,
949 .get_reserved_space = ext4_get_reserved_space,
948 .alloc_inode = dquot_alloc_inode, 950 .alloc_inode = dquot_alloc_inode,
949 .free_space = dquot_free_space, 951 .free_space = dquot_free_space,
950 .free_inode = dquot_free_inode, 952 .free_inode = dquot_free_inode,
@@ -1802,7 +1804,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1802 } 1804 }
1803 1805
1804 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); 1806 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
1805 DQUOT_INIT(inode); 1807 vfs_dq_init(inode);
1806 if (inode->i_nlink) { 1808 if (inode->i_nlink) {
1807 printk(KERN_DEBUG 1809 printk(KERN_DEBUG
1808 "%s: truncating inode %lu to %lld bytes\n", 1810 "%s: truncating inode %lu to %lld bytes\n",
@@ -3367,8 +3369,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
3367 * is locked for write. Otherwise the are possible deadlocks: 3369 * is locked for write. Otherwise the are possible deadlocks:
3368 * Process 1 Process 2 3370 * Process 1 Process 2
3369 * ext4_create() quota_sync() 3371 * ext4_create() quota_sync()
3370 * jbd2_journal_start() write_dquot() 3372 * jbd2_journal_start() write_dquot()
3371 * DQUOT_INIT() down(dqio_mutex) 3373 * vfs_dq_init() down(dqio_mutex)
3372 * down(dqio_mutex) jbd2_journal_start() 3374 * down(dqio_mutex) jbd2_journal_start()
3373 * 3375 *
3374 */ 3376 */
@@ -3380,44 +3382,6 @@ static inline struct inode *dquot_to_inode(struct dquot *dquot)
3380 return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type]; 3382 return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type];
3381} 3383}
3382 3384
3383static int ext4_dquot_initialize(struct inode *inode, int type)
3384{
3385 handle_t *handle;
3386 int ret, err;
3387
3388 /* We may create quota structure so we need to reserve enough blocks */
3389 handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
3390 if (IS_ERR(handle))
3391 return PTR_ERR(handle);
3392 ret = dquot_initialize(inode, type);
3393 err = ext4_journal_stop(handle);
3394 if (!ret)
3395 ret = err;
3396 return ret;
3397}
3398
3399static int ext4_dquot_drop(struct inode *inode)
3400{
3401 handle_t *handle;
3402 int ret, err;
3403
3404 /* We may delete quota structure so we need to reserve enough blocks */
3405 handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
3406 if (IS_ERR(handle)) {
3407 /*
3408 * We call dquot_drop() anyway to at least release references
3409 * to quota structures so that umount does not hang.
3410 */
3411 dquot_drop(inode);
3412 return PTR_ERR(handle);
3413 }
3414 ret = dquot_drop(inode);
3415 err = ext4_journal_stop(handle);
3416 if (!ret)
3417 ret = err;
3418 return ret;
3419}
3420
3421static int ext4_write_dquot(struct dquot *dquot) 3385static int ext4_write_dquot(struct dquot *dquot)
3422{ 3386{
3423 int ret, err; 3387 int ret, err;