diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3cdb0a2fc648..3d4fb81bacd5 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb, | |||
1645 | unsigned int *journal_ioprio, | 1645 | unsigned int *journal_ioprio, |
1646 | int is_remount) | 1646 | int is_remount) |
1647 | { | 1647 | { |
1648 | #ifdef CONFIG_QUOTA | ||
1649 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 1648 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
1650 | #endif | ||
1651 | char *p; | 1649 | char *p; |
1652 | substring_t args[MAX_OPT_ARGS]; | 1650 | substring_t args[MAX_OPT_ARGS]; |
1653 | int token; | 1651 | int token; |
@@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb, | |||
1696 | } | 1694 | } |
1697 | } | 1695 | } |
1698 | #endif | 1696 | #endif |
1697 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
1698 | int blocksize = | ||
1699 | BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | ||
1700 | |||
1701 | if (blocksize < PAGE_CACHE_SIZE) { | ||
1702 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
1703 | "dioread_nolock if block size != PAGE_SIZE"); | ||
1704 | return 0; | ||
1705 | } | ||
1706 | } | ||
1699 | return 1; | 1707 | return 1; |
1700 | } | 1708 | } |
1701 | 1709 | ||
@@ -2212,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb, | |||
2212 | __func__, inode->i_ino, inode->i_size); | 2220 | __func__, inode->i_ino, inode->i_size); |
2213 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", | 2221 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", |
2214 | inode->i_ino, inode->i_size); | 2222 | inode->i_ino, inode->i_size); |
2223 | mutex_lock(&inode->i_mutex); | ||
2215 | ext4_truncate(inode); | 2224 | ext4_truncate(inode); |
2225 | mutex_unlock(&inode->i_mutex); | ||
2216 | nr_truncates++; | 2226 | nr_truncates++; |
2217 | } else { | 2227 | } else { |
2218 | ext4_msg(sb, KERN_DEBUG, | 2228 | ext4_msg(sb, KERN_DEBUG, |
@@ -3223,6 +3233,10 @@ int ext4_calculate_overhead(struct super_block *sb) | |||
3223 | memset(buf, 0, PAGE_SIZE); | 3233 | memset(buf, 0, PAGE_SIZE); |
3224 | cond_resched(); | 3234 | cond_resched(); |
3225 | } | 3235 | } |
3236 | /* Add the journal blocks as well */ | ||
3237 | if (sbi->s_journal) | ||
3238 | overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); | ||
3239 | |||
3226 | sbi->s_overhead = overhead; | 3240 | sbi->s_overhead = overhead; |
3227 | smp_wmb(); | 3241 | smp_wmb(); |
3228 | free_page((unsigned long) buf); | 3242 | free_page((unsigned long) buf); |
@@ -3436,15 +3450,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3436 | clear_opt(sb, DELALLOC); | 3450 | clear_opt(sb, DELALLOC); |
3437 | } | 3451 | } |
3438 | 3452 | ||
3439 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3440 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
3441 | if (blocksize < PAGE_SIZE) { | ||
3442 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
3443 | "dioread_nolock if block size != PAGE_SIZE"); | ||
3444 | goto failed_mount; | ||
3445 | } | ||
3446 | } | ||
3447 | |||
3448 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 3453 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
3449 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); | 3454 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
3450 | 3455 | ||
@@ -3486,6 +3491,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3486 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 3491 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) |
3487 | goto failed_mount; | 3492 | goto failed_mount; |
3488 | 3493 | ||
3494 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3489 | if (blocksize < EXT4_MIN_BLOCK_SIZE || | 3495 | if (blocksize < EXT4_MIN_BLOCK_SIZE || |
3490 | blocksize > EXT4_MAX_BLOCK_SIZE) { | 3496 | blocksize > EXT4_MAX_BLOCK_SIZE) { |
3491 | ext4_msg(sb, KERN_ERR, | 3497 | ext4_msg(sb, KERN_ERR, |
@@ -4725,7 +4731,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
4725 | } | 4731 | } |
4726 | 4732 | ||
4727 | ext4_setup_system_zone(sb); | 4733 | ext4_setup_system_zone(sb); |
4728 | if (sbi->s_journal == NULL) | 4734 | if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) |
4729 | ext4_commit_super(sb, 1); | 4735 | ext4_commit_super(sb, 1); |
4730 | 4736 | ||
4731 | #ifdef CONFIG_QUOTA | 4737 | #ifdef CONFIG_QUOTA |