aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/ext4.txt8
-rw-r--r--fs/ext4/ext4.h3
-rw-r--r--fs/ext4/super.c50
3 files changed, 37 insertions, 24 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 232a575a0c48..168242b5c045 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -160,7 +160,9 @@ noload if the filesystem was not unmounted cleanly,
160 lead to any number of problems. 160 lead to any number of problems.
161 161
162data=journal All data are committed into the journal prior to being 162data=journal All data are committed into the journal prior to being
163 written into the main file system. 163 written into the main file system. Enabling
164 this mode will disable delayed allocation and
165 O_DIRECT support.
164 166
165data=ordered (*) All data are forced directly out to the main file 167data=ordered (*) All data are forced directly out to the main file
166 system prior to its metadata being committed to the 168 system prior to its metadata being committed to the
@@ -419,8 +421,8 @@ written to the journal first, and then to its final location.
419In the event of a crash, the journal can be replayed, bringing both data and 421In the event of a crash, the journal can be replayed, bringing both data and
420metadata into a consistent state. This mode is the slowest except when data 422metadata into a consistent state. This mode is the slowest except when data
421needs to be read from and written to disk at the same time where it 423needs to be read from and written to disk at the same time where it
422outperforms all others modes. Currently ext4 does not have delayed 424outperforms all others modes. Enabling this mode will disable delayed
423allocation support if this data journalling mode is selected. 425allocation and O_DIRECT support.
424 426
425/proc entries 427/proc entries
426============= 428=============
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ccfa81f33bb0..48ae98819d35 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -922,6 +922,9 @@ struct ext4_inode_info {
922#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ 922#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */
923#define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ 923#define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */
924 924
925#define EXT4_MOUNT2_EXPLICIT_DELALLOC 0x00000001 /* User explicitly
926 specified delalloc */
927
925#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ 928#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
926 ~EXT4_MOUNT_##opt 929 ~EXT4_MOUNT_##opt
927#define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ 930#define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 44d0c8db2239..ee2f74a7084d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1801,6 +1801,7 @@ set_qf_format:
1801 break; 1801 break;
1802 case Opt_nodelalloc: 1802 case Opt_nodelalloc:
1803 clear_opt(sb, DELALLOC); 1803 clear_opt(sb, DELALLOC);
1804 clear_opt2(sb, EXPLICIT_DELALLOC);
1804 break; 1805 break;
1805 case Opt_mblk_io_submit: 1806 case Opt_mblk_io_submit:
1806 set_opt(sb, MBLK_IO_SUBMIT); 1807 set_opt(sb, MBLK_IO_SUBMIT);
@@ -1817,6 +1818,7 @@ set_qf_format:
1817 break; 1818 break;
1818 case Opt_delalloc: 1819 case Opt_delalloc:
1819 set_opt(sb, DELALLOC); 1820 set_opt(sb, DELALLOC);
1821 set_opt2(sb, EXPLICIT_DELALLOC);
1820 break; 1822 break;
1821 case Opt_block_validity: 1823 case Opt_block_validity:
1822 set_opt(sb, BLOCK_VALIDITY); 1824 set_opt(sb, BLOCK_VALIDITY);
@@ -3224,6 +3226,33 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3224 &journal_ioprio, NULL, 0)) 3226 &journal_ioprio, NULL, 0))
3225 goto failed_mount; 3227 goto failed_mount;
3226 3228
3229 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
3230 printk_once(KERN_WARNING "EXT4-fs: Warning: mounting "
3231 "with data=journal disables delayed "
3232 "allocation and O_DIRECT support!\n");
3233 if (test_opt2(sb, EXPLICIT_DELALLOC)) {
3234 ext4_msg(sb, KERN_ERR, "can't mount with "
3235 "both data=journal and delalloc");
3236 goto failed_mount;
3237 }
3238 if (test_opt(sb, DIOREAD_NOLOCK)) {
3239 ext4_msg(sb, KERN_ERR, "can't mount with "
3240 "both data=journal and delalloc");
3241 goto failed_mount;
3242 }
3243 if (test_opt(sb, DELALLOC))
3244 clear_opt(sb, DELALLOC);
3245 }
3246
3247 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3248 if (test_opt(sb, DIOREAD_NOLOCK)) {
3249 if (blocksize < PAGE_SIZE) {
3250 ext4_msg(sb, KERN_ERR, "can't mount with "
3251 "dioread_nolock if block size != PAGE_SIZE");
3252 goto failed_mount;
3253 }
3254 }
3255
3227 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 3256 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
3228 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); 3257 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
3229 3258
@@ -3265,8 +3294,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3265 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) 3294 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))
3266 goto failed_mount; 3295 goto failed_mount;
3267 3296
3268 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3269
3270 if (blocksize < EXT4_MIN_BLOCK_SIZE || 3297 if (blocksize < EXT4_MIN_BLOCK_SIZE ||
3271 blocksize > EXT4_MAX_BLOCK_SIZE) { 3298 blocksize > EXT4_MAX_BLOCK_SIZE) {
3272 ext4_msg(sb, KERN_ERR, 3299 ext4_msg(sb, KERN_ERR,
@@ -3679,25 +3706,6 @@ no_journal:
3679 "available"); 3706 "available");
3680 } 3707 }
3681 3708
3682 if (test_opt(sb, DELALLOC) &&
3683 (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)) {
3684 ext4_msg(sb, KERN_WARNING, "Ignoring delalloc option - "
3685 "requested data journaling mode");
3686 clear_opt(sb, DELALLOC);
3687 }
3688 if (test_opt(sb, DIOREAD_NOLOCK)) {
3689 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
3690 ext4_msg(sb, KERN_WARNING, "Ignoring dioread_nolock "
3691 "option - requested data journaling mode");
3692 clear_opt(sb, DIOREAD_NOLOCK);
3693 }
3694 if (sb->s_blocksize < PAGE_SIZE) {
3695 ext4_msg(sb, KERN_WARNING, "Ignoring dioread_nolock "
3696 "option - block size is too small");
3697 clear_opt(sb, DIOREAD_NOLOCK);
3698 }
3699 }
3700
3701 err = ext4_setup_system_zone(sb); 3709 err = ext4_setup_system_zone(sb);
3702 if (err) { 3710 if (err) {
3703 ext4_msg(sb, KERN_ERR, "failed to initialize system " 3711 ext4_msg(sb, KERN_ERR, "failed to initialize system "