Merge tag 'ntfs3_for_6.0' of https://github.com/Paragon-Software-Group/linux-ntfs3
[linux-2.6-block.git] / fs / ntfs3 / file.c
index b5f8837f41454cbe285f60c9207051f6143a4158..4f2ffc7ef296f1f7a8bb22a330b4321a0e6fbcc9 100644 (file)
@@ -22,20 +22,20 @@ static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
 {
        struct fstrim_range __user *user_range;
        struct fstrim_range range;
-       struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev);
        int err;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       if (!blk_queue_discard(q))
+       if (!bdev_max_discard_sectors(sbi->sb->s_bdev))
                return -EOPNOTSUPP;
 
        user_range = (struct fstrim_range __user *)arg;
        if (copy_from_user(&range, user_range, sizeof(range)))
                return -EFAULT;
 
-       range.minlen = max_t(u32, range.minlen, q->limits.discard_granularity);
+       range.minlen = max_t(u32, range.minlen,
+                            bdev_discard_granularity(sbi->sb->s_bdev));
 
        err = ntfs_trim_fs(sbi, &range);
        if (err < 0)
@@ -115,7 +115,6 @@ static int ntfs_extend_initialized_size(struct file *file,
        for (;;) {
                u32 zerofrom, len;
                struct page *page;
-               void *fsdata;
                u8 bits;
                CLST vcn, lcn, clen;
 
@@ -157,16 +156,14 @@ static int ntfs_extend_initialized_size(struct file *file,
                if (pos + len > new_valid)
                        len = new_valid - pos;
 
-               err = pagecache_write_begin(file, mapping, pos, len, 0, &page,
-                                           &fsdata);
+               err = ntfs_write_begin(file, mapping, pos, len, &page, NULL);
                if (err)
                        goto out;
 
                zero_user_segment(page, zerofrom, PAGE_SIZE);
 
                /* This function in any case puts page. */
-               err = pagecache_write_end(file, mapping, pos, len, len, page,
-                                         fsdata);
+               err = ntfs_write_end(file, mapping, pos, len, len, page, NULL);
                if (err < 0)
                        goto out;
                pos += len;
@@ -245,7 +242,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
                                lock_buffer(bh);
                                bh->b_end_io = end_buffer_read_sync;
                                get_bh(bh);
-                               submit_bh(REQ_OP_READ, 0, bh);
+                               submit_bh(REQ_OP_READ, bh);
 
                                wait_on_buffer(bh);
                                if (!buffer_uptodate(bh)) {