diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 54 |
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 | ||
929 | static int ext4_dquot_initialize(struct inode *inode, int type); | ||
930 | static int ext4_dquot_drop(struct inode *inode); | ||
931 | static int ext4_write_dquot(struct dquot *dquot); | 929 | static int ext4_write_dquot(struct dquot *dquot); |
932 | static int ext4_acquire_dquot(struct dquot *dquot); | 930 | static int ext4_acquire_dquot(struct dquot *dquot); |
933 | static int ext4_release_dquot(struct dquot *dquot); | 931 | static 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 | ||
944 | static struct dquot_operations ext4_quota_operations = { | 942 | static 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 | ||
3383 | static 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 | |||
3399 | static 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 | |||
3421 | static int ext4_write_dquot(struct dquot *dquot) | 3385 | static int ext4_write_dquot(struct dquot *dquot) |
3422 | { | 3386 | { |
3423 | int ret, err; | 3387 | int ret, err; |