aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4.h1
-rw-r--r--fs/ext4/ext4_jbd2.h10
-rw-r--r--fs/ext4/inode.c27
-rw-r--r--fs/ext4/super.c21
4 files changed, 15 insertions, 44 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 8b56b53328eb..8b6d297c8c73 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -873,7 +873,6 @@ struct ext4_inode_info {
873#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ 873#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
874#define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */ 874#define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */
875#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */ 875#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
876#define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */
877#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ 876#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
878#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 877#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
879#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 878#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 8ae8168900bf..38d1e66e5843 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -313,17 +313,15 @@ static inline int ext4_should_writeback_data(struct inode *inode)
313 * This function controls whether or not we should try to go down the 313 * This function controls whether or not we should try to go down the
314 * dioread_nolock code paths, which makes it safe to avoid taking 314 * dioread_nolock code paths, which makes it safe to avoid taking
315 * i_mutex for direct I/O reads. This only works for extent-based 315 * i_mutex for direct I/O reads. This only works for extent-based
316 * files, and it doesn't work for nobh or if data journaling is 316 * files, and it doesn't work if data journaling is enabled, since the
317 * enabled, since the dioread_nolock code uses b_private to pass 317 * dioread_nolock code uses b_private to pass information back to the
318 * information back to the I/O completion handler, and this conflicts 318 * I/O completion handler, and this conflicts with the jbd's use of
319 * with the jbd's use of b_private. 319 * b_private.
320 */ 320 */
321static inline int ext4_should_dioread_nolock(struct inode *inode) 321static inline int ext4_should_dioread_nolock(struct inode *inode)
322{ 322{
323 if (!test_opt(inode->i_sb, DIOREAD_NOLOCK)) 323 if (!test_opt(inode->i_sb, DIOREAD_NOLOCK))
324 return 0; 324 return 0;
325 if (test_opt(inode->i_sb, NOBH))
326 return 0;
327 if (!S_ISREG(inode->i_mode)) 325 if (!S_ISREG(inode->i_mode))
328 return 0; 326 return 0;
329 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 327 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 15ff8d8d839b..b485987f0146 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2553,18 +2553,16 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
2553/* 2553/*
2554 * This function is used as a standard get_block_t calback function 2554 * This function is used as a standard get_block_t calback function
2555 * when there is no desire to allocate any blocks. It is used as a 2555 * when there is no desire to allocate any blocks. It is used as a
2556 * callback function for block_prepare_write(), nobh_writepage(), and 2556 * callback function for block_prepare_write() and block_write_full_page().
2557 * block_write_full_page(). These functions should only try to map a 2557 * These functions should only try to map a single block at a time.
2558 * single block at a time.
2559 * 2558 *
2560 * Since this function doesn't do block allocations even if the caller 2559 * Since this function doesn't do block allocations even if the caller
2561 * requests it by passing in create=1, it is critically important that 2560 * requests it by passing in create=1, it is critically important that
2562 * any caller checks to make sure that any buffer heads are returned 2561 * any caller checks to make sure that any buffer heads are returned
2563 * by this function are either all already mapped or marked for 2562 * by this function are either all already mapped or marked for
2564 * delayed allocation before calling nobh_writepage() or 2563 * delayed allocation before calling block_write_full_page(). Otherwise,
2565 * block_write_full_page(). Otherwise, b_blocknr could be left 2564 * b_blocknr could be left unitialized, and the page write functions will
2566 * unitialized, and the page write functions will be taken by 2565 * be taken by surprise.
2567 * surprise.
2568 */ 2566 */
2569static int noalloc_get_block_write(struct inode *inode, sector_t iblock, 2567static int noalloc_get_block_write(struct inode *inode, sector_t iblock,
2570 struct buffer_head *bh_result, int create) 2568 struct buffer_head *bh_result, int create)
@@ -2749,9 +2747,7 @@ static int ext4_writepage(struct page *page,
2749 return __ext4_journalled_writepage(page, len); 2747 return __ext4_journalled_writepage(page, len);
2750 } 2748 }
2751 2749
2752 if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode)) 2750 if (page_bufs && buffer_uninit(page_bufs)) {
2753 ret = nobh_writepage(page, noalloc_get_block_write, wbc);
2754 else if (page_bufs && buffer_uninit(page_bufs)) {
2755 ext4_set_bh_endio(page_bufs, inode); 2751 ext4_set_bh_endio(page_bufs, inode);
2756 ret = block_write_full_page_endio(page, noalloc_get_block_write, 2752 ret = block_write_full_page_endio(page, noalloc_get_block_write,
2757 wbc, ext4_end_io_buffer_write); 2753 wbc, ext4_end_io_buffer_write);
@@ -4125,17 +4121,6 @@ int ext4_block_truncate_page(handle_t *handle,
4125 length = blocksize - (offset & (blocksize - 1)); 4121 length = blocksize - (offset & (blocksize - 1));
4126 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); 4122 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
4127 4123
4128 /*
4129 * For "nobh" option, we can only work if we don't need to
4130 * read-in the page - otherwise we create buffers to do the IO.
4131 */
4132 if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) &&
4133 ext4_should_writeback_data(inode) && PageUptodate(page)) {
4134 zero_user(page, offset, length);
4135 set_page_dirty(page);
4136 goto unlock;
4137 }
4138
4139 if (!page_has_buffers(page)) 4124 if (!page_has_buffers(page))
4140 create_empty_buffers(page, blocksize, 0); 4125 create_empty_buffers(page, blocksize, 0);
4141 4126
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4e8983a9811b..422a4ce66778 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -946,8 +946,6 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
946 seq_puts(seq, ",journal_async_commit"); 946 seq_puts(seq, ",journal_async_commit");
947 else if (test_opt(sb, JOURNAL_CHECKSUM)) 947 else if (test_opt(sb, JOURNAL_CHECKSUM))
948 seq_puts(seq, ",journal_checksum"); 948 seq_puts(seq, ",journal_checksum");
949 if (test_opt(sb, NOBH))
950 seq_puts(seq, ",nobh");
951 if (test_opt(sb, I_VERSION)) 949 if (test_opt(sb, I_VERSION))
952 seq_puts(seq, ",i_version"); 950 seq_puts(seq, ",i_version");
953 if (!test_opt(sb, DELALLOC)) 951 if (!test_opt(sb, DELALLOC))
@@ -1624,10 +1622,12 @@ set_qf_format:
1624 *n_blocks_count = option; 1622 *n_blocks_count = option;
1625 break; 1623 break;
1626 case Opt_nobh: 1624 case Opt_nobh:
1627 set_opt(sbi->s_mount_opt, NOBH); 1625 ext4_msg(sb, KERN_WARNING,
1626 "Ignoring deprecated nobh option");
1628 break; 1627 break;
1629 case Opt_bh: 1628 case Opt_bh:
1630 clear_opt(sbi->s_mount_opt, NOBH); 1629 ext4_msg(sb, KERN_WARNING,
1630 "Ignoring deprecated bh option");
1631 break; 1631 break;
1632 case Opt_i_version: 1632 case Opt_i_version:
1633 set_opt(sbi->s_mount_opt, I_VERSION); 1633 set_opt(sbi->s_mount_opt, I_VERSION);
@@ -2912,18 +2912,7 @@ no_journal:
2912 ext4_msg(sb, KERN_ERR, "insufficient memory"); 2912 ext4_msg(sb, KERN_ERR, "insufficient memory");
2913 goto failed_mount_wq; 2913 goto failed_mount_wq;
2914 } 2914 }
2915 if (test_opt(sb, NOBH)) { 2915
2916 if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
2917 ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
2918 "its supported only with writeback mode");
2919 clear_opt(sbi->s_mount_opt, NOBH);
2920 }
2921 if (test_opt(sb, DIOREAD_NOLOCK)) {
2922 ext4_msg(sb, KERN_WARNING, "dioread_nolock option is "
2923 "not supported with nobh mode");
2924 goto failed_mount_wq;
2925 }
2926 }
2927 EXT4_SB(sb)->dio_unwritten_wq = create_workqueue("ext4-dio-unwritten"); 2916 EXT4_SB(sb)->dio_unwritten_wq = create_workqueue("ext4-dio-unwritten");
2928 if (!EXT4_SB(sb)->dio_unwritten_wq) { 2917 if (!EXT4_SB(sb)->dio_unwritten_wq) {
2929 printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n"); 2918 printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n");