]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/ext4/inode.c
Merge tag 'ext4_for_linue' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[mirror_ubuntu-zesty-kernel.git] / fs / ext4 / inode.c
index 85e41a2a39adc6b8ed6fa62625c5f61b342db77e..b3a5213bc73eac2082cbfa16bad66bba89c32ed4 100644 (file)
@@ -2678,12 +2678,8 @@ static int ext4_nonda_switch(struct super_block *sb)
        /*
         * Start pushing delalloc when 1/2 of free blocks are dirty.
         */
-       if (dirty_blocks && (free_blocks < 2 * dirty_blocks) &&
-           !writeback_in_progress(sb->s_bdi) &&
-           down_read_trylock(&sb->s_umount)) {
-               writeback_inodes_sb(sb, WB_REASON_FS_FREE_SPACE);
-               up_read(&sb->s_umount);
-       }
+       if (dirty_blocks && (free_blocks < 2 * dirty_blocks))
+               try_to_writeback_inodes_sb(sb, WB_REASON_FS_FREE_SPACE);
 
        if (2 * free_blocks < 3 * dirty_blocks ||
                free_blocks < (dirty_blocks + EXT4_FREECLUSTERS_WATERMARK)) {
@@ -3114,7 +3110,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
                            ssize_t size, void *private, int ret,
                            bool is_async)
 {
-       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(iocb->ki_filp);
         ext4_io_end_t *io_end = iocb->private;
 
        /* if not async direct IO or dio with 0 bytes write, just return */
@@ -3649,7 +3645,7 @@ int ext4_can_truncate(struct inode *inode)
 
 int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        if (!S_ISREG(inode->i_mode))
                return -EOPNOTSUPP;
 
@@ -5021,7 +5017,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
        unsigned long len;
        int ret;
        struct file *file = vma->vm_file;
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct address_space *mapping = inode->i_mapping;
        handle_t *handle;
        get_block_t *get_block;
@@ -5063,7 +5059,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
                                            0, len, NULL,
                                            ext4_bh_unmapped)) {
                        /* Wait so that we don't change page under IO */
-                       wait_on_page_writeback(page);
+                       wait_for_stable_page(page);
                        ret = VM_FAULT_LOCKED;
                        goto out;
                }